Bonum Certa Men Certa

Adding, Seaming Together, Merging, or Concatenating Videos From the Command Line With FFMPEG (Scripting for Streamlining of Workflows)

Video download link



Summary: In order to enrich the looks of videos with almost no extra time/effort (all scripted, no GUIs should be needed) use ffmpeg with the concat operator; but there are several big gotchas, namely lack of sound and need for consistency across formats/codecs and even sampling rates

TODAY we focused on some site 'logistics' and especially dealt with video and sound. The goal is to automate some tasks and/or improve the presentation of multimedia using Free software. Free as in freedom...



Frankly, the tool we used to generate some video segments was an "online" thing called Canva (never heard of it before, but it seems powerful enough and doesn't require downloading anything, logging in etc. -- not even an E-mail address). On the face of it, problem solved! But no... it gets trickier from then on. I spent many hours working around barriers.

Well, ffmpeg is very powerful and extremely versatile. However, as it turns out, ffmpeg will first need to convert .mp4 files downloaded from there (Canva) so as to incorporate sound, even if it's just mute (inaudible sound track).

For this reason and for that purpose, as per people who had similar issues concatenation tracks that lack sound (merged or combined with some that do have sound), run a command as follows (depending on the sampling rate, 48000 in my case, or else the sound/pitch will be funny).

ffmpeg -i "file.mp4" -f lavfi -i anullsrc=cl=mono:r=48000 -shortest -y "file-new.mp4"

Assuming you now have a track that is compatible with what you'd merge it with, ensure that the original is moreover re-encoded for it to be applied consistently. As I always record as WebM, I need to then run (for a video like the above):

ffmpeg -i video-ffmpeg-concat.webm -c:v libx264 -preset slow video-ffmpeg-concat.mp4

This yields something suitable as it must be strictly compatible in sampling, codec type, and other factors. That's a limitation in ffmpeg. This is a common issue for a lot of people and it took me hours to overcome (many trials and errors). I wished to document this as other people too got stuck (many forum posts).

Depending on which files you wish to concatenate with (and the order), write down the 'recipe', e.g. recipe.txt, containing

file file-new.mp4
file testing-6.mp4
file outro-new.mp4


Relative paths too can be prepended (e.g. file Videos/outro-new.mp4). The ffmpeg documentation explains the syntax better. There's a lot more about concat [1, 2].

Then run everything as follows:

ffmpeg -f concat -i recipe.txt output.webm

The reason the assembly of files is done with .mp4 files (to yield a WebM) is the insistence of Canva that downloaded videos are either MP4 or GIF. There must be some better ways and I'll improve this over time (this is all still very fresh in the mind; I've spent a lot of time on this).

From now on we have the ability to make videos that are 1) smaller in size because of re-encoding with strong compression and 2) have a little bit of extra context. We'll improve this over time and push to git.

Update: This is what the outcome can look like (mind start and end of clip).

Video download link

Recent Techrights' Posts

Something to Celebrate in Gemini Protocol
More capsules and users join in
Apparently Confirmed: IBM Layoffs in Canada Today, Hundreds Affected
Impacting "177 people", says one person, "in Ottawa"
 
The SLAPPs From the Microsoft Strangler (and Sidekick) No Better Than Patent Trolling
one must never settle with trolls
Links 28/03/2025: Last Reminder "to Delete Your 23andMe Data", "UK's First Permanent Facial Recognition Cameras Installed"
Links for the day
Microsoft Canonical Continues Its FUD (Fear, Uncertainty, Doubt) Campaign, Reveals Google Too Sponsored It
They're paid-for lies from a Chinese company that takes GAFAM money to write puff pieces about them
Android Rises Above 76% in Mozambique, Leaving Windows in the Dust
Windows may soon be measured as smaller than Apple's iOS
IBM, Red Hat and Microsoft Probably Also Manipulate Metrics (It Helps Con the Shareholders)
Wall Street's credibility will depend on enforcement of "checks and balances"
Slopwatch: trendhunter.com and Other Pure Junk From "Google News"
The need to vet sources is hardly new; anyone can spew out anything, anywhere. There's a need for vetting.
Gemini Links 28/03/2025: Rewatching The X-Files, Slop Concerns, and NOSTR Censorship
Links for the day
Links 28/03/2025: Australia at Risk, EPO Grants Illegal Patents With Illegal Effect
Links for the day
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Thursday, March 27, 2025
IRC logs for Thursday, March 27, 2025
Links 27/03/2025: Obituary to a Shop, Russia Trying to Buy Time
Links for the day
Links 27/03/2025: Slop, Autosuggestions, and Nostr
Links for the day
When Windows Was Dominant (1990s) Browser Monopoly Meant MSIE, But Now Google Android is Dominant and the Web in a 'Webapps' Era Works With (or Is Designed for) Chrome-isms
We've been there before
Slopwatch: BetaNews, LinuxSecurity.com, and the Attack on Web Search Using Fake and Likely Plagiarised Pages
Changing a few words here and there won't change the fact that it's not properly authored
Links 27/03/2025: U.S. Honeybee Deaths Reach Record High, Legal Occupation Next in Line After War on Science
Links for the day
Using Courts for 'Revenge' is Always a Losing Strategy
Trying to cause someone you dislike to spend a lot of money
IBM CFO James Kavanaugh Refers to Firing of Almost 10,000 Americans as "Workforce Rebalancing" (Shifting IBM's Centre of Balance to Low-salary Contracts/Countries)
The scale of IBM layoffs is getting too large to evade WARN Notices
[Video] Dr. Richard Stallman's Keynote Speech in Kerala Finally Uploaded
In non-free format and proprietary YouTube, but perhaps that's better than nothing
Islands Are Leaving Microsoft Behind, According to statCounter
Android has had a very strong year
EPO Management Fails to Deny That the Office is Discriminating Against Women
Europe's second-largest institution isn't just exceedingly corrupt but also immoral
In Some Countries the Market Share of Vista 11 is Going Down, Not Up
despite being released in 2021
Rumour: Mass Layoffs in IBM Canada Today
Maybe later today some people from Canada will say something firmer and maybe some media will even talk about that
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Wednesday, March 26, 2025
IRC logs for Wednesday, March 26, 2025
Gemini Links 27/03/2025: X-Files' "Kill Switch", Orlando, and ASN (Autonomous System Number) 'Hack'
Links for the day
Links 26/03/2025: Healthcare Cuts and Turkey's Own "2025 Project" (Culling Opposition)
Links for the day
LLM Slopfarm: A Site's Last Incarnation Before Throwing in the Towel, Going Offline Permanently
A lot of coverage that claims to be about Finland is chatbot-generated nonsense or poorly-plagiarised work
Microsoft Canonical Pays IDG to Spread FUD (Fear, Uncertainty, Doubt)
this seems a tad exploitative and reminds us of the time Novell kept telling companies that using anything other than SUSE was dangerous
Gemini Links 26/03/2025: GTD, Zenshuu, and Geminispace Community
Links for the day
Links 26/03/2025: Media's Failures, Arrests of Journalists, Limitations of End-to-End Encryption
Links for the day
LLM Slop (Lots of It Spewed Out by Microsoft) Versus Linux
Microsoft is a very, very evil company. It doesn't mind destroying the Web if there's a chance it'll make a buck in the process or mess up people's brains (in Microsoft's favour).
Slopfarms (Sites That Only Ever Publish LLM Slop) Are Killing Google News
pair of slopfarms still propped up by Google News
Microsoft's Serial Strangler's Law Firm Has a Long History of Fronting for People Who Do Bad and/or Illegal Things
Whose terrible idea was this?
Novell and Microsoft Apologist/Booster Bruce Byfield Writing About the FSF is a Recipe for Problems
Totally not shoehorning some agenda
Looking Forward to the Fall of UPC and Revocation of the Unified Patent Court (UPC) Agreement, Which Was Always Illegal and Unconstitutional
We'll try to keep abreast of any progress in this case
Slopwatch: Google News, LinuxSecurity.com, and the General Demise of the Web
many supposed or so-called "news" pages are just spewed out by some chatbots (or tools which help plagiarise original articles without getting caught; detection gets harder)
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Tuesday, March 25, 2025
IRC logs for Tuesday, March 25, 2025