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

[Teaser] The EPO is Still Calling Monopolies "Products"
Coming soon
Why We Cover the Topics That We've Long Focused on (by Choice)
We'll continue to cover suppressed issues because such issues are usually obstructed
[Meme] The Reasonable Man
"The reasonable man adapts himself to the world"
International Troll Alert by Helen Plews
Helen Plews from Cybershow has this new article
The FSF (Free Software Foundation, Inc.) Can Reach Its Funding Goal of $400,000. This Bothers the Imposters and Foes of the FSF.
Software Freedom is something we must perpetually fight for
Linux Foundation Pays for LLM Slop (Puff Pieces Made by Bots) About the Linux Foundation
The so-called Linux Foundation is responsible for the production of spam and slop
General Consultative Committee (GCC) Meeting at the European Patent Office (EPO) Shows Existing Problems
the "real problems" and why "digitalisation" doesn't solve them
 
[Meme] Vendor Capture for 'Civility's Sake'
"I CoCed him already"
Anonymity for Sources
At the moment we can learn about stories in person or in encrypted voice chat
What Topics We Prioritise
On fishing for topics to cover
Oligarch-Owned Media Twists the Narrative and Demands More Surveillance
Corruption is the real issue here
Windows Falls to Single-Digit "Market Share" in Benin
Windows has fallen even further
[Meme] Doing Online Activism in Social Control Media
Dictators have always loved lists
Gemini Links 13/12/2024: Creative Moods, Berkeley DB, and More
Links for the day
Microsoft Windows Falls to New All-Time Low in Guatemala (Less Than a Quarter)
When it comes to operating systems, we don't think we've mentioned it before
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Thursday, December 12, 2024
IRC logs for Thursday, December 12, 2024
[Meme] Leave My /home Alone
A new version of Systemd
There's a New Version of Lagrange (Gemini Reader) and Its Developer is Making an IDE/Editor
I share or reciprocate almost anything I can through Gemini Protocol
Nick's Job at OSI: Promote Microsoft, Promote Proprietary Software
This is what Microsoft pays him to do
[Meme] Award-Winning Back-stabbing Opportunists
part of the rebel alliance
Azerbaijan Rejects Microsoft
Azerbaijan seems to have very little interest in Microsoft
[Meme] You Just Grab Him by the CoC
Sponsors of Python Software Foundation... "You don't like Python's corporate sponsor?"
Explaining What Deb Nicholson Does to the Python Software Foundation
Of course the OSI, which Nicholson also occupied, still helps Microsoft attack copyleft
IBM Said to Be Firing People Days Before Christmas
IBM is entering taboo territories
Microsoft Falls to Just 11% in Ivory Coast
Microsoft tried hard to catch up in mobile
Links 12/12/2024: Shell Settles With Greenpeace, DOJ Whistleblower Pilot Program
Links for the day
Gemini Links 12/12/2024: AuraGem TV and Advent of Code 2024
Links for the day
Fake "Linux" News, Produced by Microsoft Chatbots in 'Brittany Day' or "LinuxSecurity" Clothing
She's back at it
Microsoft OSI Promoting GitHub, Which is Proprietary and a Massive GPL Violator
OSI works for Microsoft, speaks for Microsoft, promotes proprietary software
Links 12/12/2024: Another 'Self-driving' Cars Dead End, Infowars Sale Blocked by Court
Links for the day
Links 12/12/2024: "Hey Hi" Hype Debunked, ActivityPub and Gemini Software on Same Server
Links for the day
Google Has Only Solidified Its Search Monopoly in Africa Since Microsoft's Chatbot/LLM Hype Started
Africa is basically a "Failed Market" to Microsoft
[Teaser] EPO is Running Out of Brains
EPO has been in the business of offering fake patents
South Korea Has Its Own Alternative to IBM's Proprietary RHEL
Owing to the Open Enterprise Linux Association (OpenELA)
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Wednesday, December 11, 2024
IRC logs for Wednesday, December 11, 2024
Fresh Rumour of Wave of IBM Layoffs Less Than a Fortnight Before Xmas Day
Unverified and anonymous
Links 11/12/2024: Additional Surveillance Ambitions and Cyberattacks on Sudanese Media
Links for the day
Links 11/12/2024: More Google Layoffs Rumoured for January, 'Linux' Foundation Colonises India
Links for the day
Mozilla's Firefox is Floundering, in the United Kingdom Its Share Fell to 2% This Month
HTTPS is becoming little but a transport layer for Chrome-like browsers, i.e. proprietary things with DRM and perhaps attestation (which means you cannot modify them; you'd get blocked for trying)
Protecting People From So-called 'Social Media' is Not Censorship (No More Than Banning or Restricting Access to Cigarettes is 'Censorship')
it's not censorship when the thing you are censoring [sic] is itself a censorship powerhouse operated by a foreign and hostile nation (or oligarchs of Musk's nature)
[Meme] Solving Real Problems With So-called 'Social Media'?
Feeding and medically treating animals helps, unlike "likes"
Links 11/12/2024: Climate Warming, 'People Can Fly' Layoffs
Links for the day
Gemini Links 11/12/2024: LLMs as Plagiarism, Advent of Code 2024 Momentum
Links for the day
In United Arab Emirates (UAE), Microsoft Now on One in 8 Internet-Connected Devices?
Web-connected clients are becoming scarce that run Microsoft operating systems (Windows)
IBM and Microsoft Hats at Linux Foundation
"Fedora Project Leader Matthew Miller: A change of hats!"
IBM's Latest Fedora Divestment Speaks for Itself
Microsoft must be very pleased with what IBM is doing
Why is UK Press Gazette Jingoistic About Plagiarists and LLM Slop Disguised as Journalism?
Press Gazette appears to be participating in the attack on honest journalism
EPO is Corrupt Like Always, What Changed is the Lack of Media Coverage (No Transparency Means No Democracy)
We need to revive online media and encourage dissent
[Meme] How NOT to Do Activism Online
So many self-professed liberals continue participating and driving traffic (ads) in X
In Central Africa, Which is Bigger Than Europe, Windows is About 5% in Terms of "Market Share"
they apparently got so fed up with colonialism
Communicating Outside of Skinnerboxes and Social Control Media
Tackling collective isolation and miscommunication (or communications being controlled by middlemen)
Number of Libera.Chat Users (Simultaneously Online) Falls to Lowest Figure in Over 3 Years
Notice the downward trend/curve in recent months
[Meme] Social Control Media is NOT Free Speech
It's time to discard that stupid argument that banning an abusive censor is "censorship"
Banning Not Only TikTok... if Not for FOMOC (Fear of Missing on Constituents)
It's a sort of addiction by peer pressure
Shedding Light on How the EPO Sheds Off Staff in Order to Grant Loads of Invalid (Fake) Patents in Europe
The people who decide on these policies lack a background in science
Montenegro's Share of GNU/Linux Reaches All-Time High
We don't really know why, but that's just what the data from statCounter suggests
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Tuesday, December 10, 2024
IRC logs for Tuesday, December 10, 2024