Bonum Certa Men Certa

Self-Hosting Videos With Free Formats and Animated Previews, Watermarks/Logos and Translucency

Summary: We examine the power of video editing with ffmpeg, chained with command-line scripting and HTML5 features

The Web is a powerful platform -- to the point where it's a little 'too' powerful if put in the hands of malicious actors. But we're still using the Web by default; it's just what most people use. Video functionality on the Web improved a lot over the years, putting aside DRM/EME. So let's explore what we can accomplish with some command-line scripting and ffmpeg.



We're always trying to encourage digital autonomy, which is why we adopt self-hosting whenever possible. This includes videos. For the sake of example, in this post we use an old video about Gemini proxies. It was picked at random, no special reason at all. None.

Extracting bits of the video with ffmpeg isn't hard (check the official ffmpeg Web site; their documentation explains the pertinent options, which should be changed depending on the video):

ffmpeg -ss 600 -t 5 -i gemini-proxies.webm -vf "select=not(mod(n\,1)),fps=10,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 roy-talks.gif

This gets us started:



To add the resultant preview (known as "poster") to the video, consider using the following, based on the above example: poster="http://techrights.org/wp-content/uploads/2021/04/roy-talks.gif"

This attribute belongs in the <video> element as it is part of the standard.

Add the watermark/logo with ffmpeg:

ffmpeg -i roy-talks.gif -i mogz-video-poster-4-small.png -filter_complex "overlay=0:H-h--1" -codec:a copy roy-talks2.gif

We use artwork prepared by Mogz for us.

These two passes may be lossy and maybe possible to combine rather easily, but splitting it into two stages aids simplicity. Here it goes:



For center: overlay=(W-w)/2:(H-h)/2 Top left (with 5 pixels of padding): overlay=5:5 Top right: overlay=W-w-5:5 Bottom right: overlay=W-w-5:H-h-5 Bottom left: overlay=5:H-h-5

With improved quality and translucency:

ffmpeg -i roy-talks.gif -i mogz-video-poster-4-small.png -filter_complex "[1]format=rgba,colorchannelmixer=aa=0.7[logo];[0][logo]overlay=0:H-h--1:format=auto" -codec:a copy roy-talks2.gif



The above scripts are possible to chain together and variables can be used, too. Let's change the time to one minute from the start (-ss 60) for a duration of 2 seconds (-t 2):

VIDEO_FILE='gemini-proxies' ffmpeg -ss 60 -t 2 -i $VIDEO_FILE.webm -vf "select=not(mod(n\,1)),fps=10,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 intermediate.gif ffmpeg -i intermediate.gif -i mogz-video-poster-4-small.png -filter_complex "[1]format=rgba,colorchannelmixer=aa=0.7[logo];[0][logo]overlay=0:H-h--1:format=auto" -codec:a copy $VIDEO_FILE.gif

Of course it is also possible to use loops and batch-process many files in this way. Welcome to the power of GNU/Linux.



Voila. The translucency is easier to see because of the mug of coffee.

Recent Techrights' Posts

Hiring for Tech Roles Based on Perceived Loyalty is No Better Than Hiring to Meet Diversity Quotas
What we're seeing right now is a national security disaster and it is almost purely about technology
S.E.O. SPAM by Serial Sloppers With L.L.M. Garbage is Hurting Linux
We continue to run Slopwatch
IBM Says That Half of Its "Assets" is Basically Pure Fiction ("Goodwill")
It times get tough, IBM can sell "Goodwill" at the local pawn shop and pay back the lenders, right?
 
Links 01/02/2025: Chinese and American Censorship, Cloud-[sic]Native Targeted by Software Patents
Links for the day
Links 01/02/2025: Belated Happy New Year 2025 and Gabbro 0.1.2
Links for the day
Links 01/02/2025: Administrative Chaos and Aviation Disasters Persist
Links for the day
Arrested: Albanian Outreachy whistleblowers, Sonny Piers GNOME & Debian connections
Reprinted with permission from Daniel Pocock
Links 1/2/2025: LLM Hype Revisited, Linuxwashing by Oumi
Links for the day
Growing Evidence That the Patent Industry Has Become a Major Scam
Seeing that the patent "industry" has turned to serious crimes (sometimes to cover up corruption) and seeing that the net negative is clearer for all to see, people who argue for abolition of all patents will have a field day
Planet Ubuntu Overrun by LLM Slop? Faizul "Piju" 9M2PJU Seems to be Publishing Fake Articles About "Linux"...
Maybe it is "assisted" by LLM slop, but slop is slop and it introduces many problems
Gemini Links 01/02/2025: LLMs, Analog Computer, and BorgBackup
Links for the day
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Friday, January 31, 2025
IRC logs for Friday, January 31, 2025
Links 31/01/2025: Mass Layoffs at Amazon and Microsoft, Sweden Again Fails to Protect Critics of Violence
Links for the day
Slopwatch: Fake Articles About "Linux" and More (Latest Roundup Featuring BetaNews, Janus Atienza, and Brittany Day From Guardian Digital, Inc)
LLM slop season
Microsoft Staff Explains How Microsoft Swindled Employees and Avoided Paying Out Severance Pay (Microsoft Hasn't Much Money Left in the Bank)
This is a classic way to avoid paying workers
"Not one of us" by Dr. Andy Farnell
Elon Musk has brought embarrassment to nerds and technologists
Gemini Links 31/01/2025: "Bulletin Buble" and "Why Blog?"
Links for the day
Static Site Generators (SSGs) Pay Off: Vastly Faster Sites, Much Smaller Hosting Bills
success story for SSGs
Of Note: Linux Foundation Has Already Let Linux.com Rot for About 4 Months (No Activity)
there's no campaign aside from marketing spam there
Techrights Should be Even Faster Now
We're now better off
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Thursday, January 30, 2025
IRC logs for Thursday, January 30, 2025
Richard Stallman (RMS) Gave 3 Talks in India in Less Than a Week
In India this month we've not seen a single negative comment about RMS
Indian Data Biases statCounter For or Against "Linux"
In statCounter, the GNU/Linux increases and decreases are deeply tied to what it does with data collected in India
The Corporate Media Pretends That Facebook ("Meta") Has Performed Well, But Its Debt Doubles Every 2 Years Despite Mass Layoffs
That same media also helps parrot misleading financial claims
Microsoft's Debt Surged by More Than 6,000,000,000 Dollars in Just 3 Months
numbers released hours ago
The Sheer Irony of Microsoft Proxy Accusing Others of 'Stealing'
Wherever DeepSick's data came from, Microsoft (or its proxy) is in no position to issue criticism.
The Difference a Decade (and GAFAM Money) Makes
Credibility cannot be purchased
[Meme] The Free Software Foundation (FSF) Has Critics Because Its Message is Effective
Applying to others the same standards one is willing to violate?
The Free Software Foundation (FSF) Raised $422,000 (Another $22k in the Two Weeks After Campaign Ended), Proving That Truth and Justice Tend to Find a Way
10,000+ dollars a week even without campaigning for more funds
Faking Revenue Increase by Buying Your Own Products and Services (Through Scams and Scammers Like Scam Altman)
Is this what society deserves? Media that instead of exposing corruption has chosen to participate in it and profit from it?
Microsoft Mass Layoffs Without Severance Pay Reported Hours After Microsoft Reported Weak Numbers and Microsoft Stock Fell
Microsoft has a bloodbath this month
Links 30/01/2025: Fentanylware (TikTok) Causes Deaths, FBI Seizes Domains
Links for the day
Gemini Links 30/01/2025: Action vs Inaction, Gopherholes, and More
Links for the day
Another Slew of Fake Articles About 'Linux' and 'Security' From Brittany Day at linuxsecurity.com (Spamfarm/Slopfarm)
linuxsecurity.com is basically a pariah and parasite. It lessens the incentive to write real articles about "Linux" by generating fake ones to outrank the originals.
Links 30/01/2025: Microsoft Wants Convicted Felon to Give Fentanylware (TikTok) to It (After Making a Phonecall Asking for That in 2019), "Moving Away From Google's Ecosystem"
Links for the day
Jack M. Germain (LinuxInsider) Seems to Have Turned to LLM Slop, Graphics Slop, and B2B SPAM
LinuxInsider is barely active anymore
Links 30/01/2025: Amazon Layoffs and DeepSeek Panic
Links for the day
Gemini Links 30/01/2025: Chaos Reigns, E-mail, Searching
Links for the day
IBM: Many Thousands of Layoffs in 2025
If 2025 is expected to be the same, then perhaps about 20,000 IBM workers will no longer be there
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Wednesday, January 29, 2025
IRC logs for Wednesday, January 29, 2025