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

When Abusive Law Firms (Working for Microsofters Against Us) Assert That Someone Writing in Social Media About Himself is Confidential Information
There was no reason to throw "GDPR" into 2 SLAPPs; they know it, but the goal was to increase the cost of a Defence and lessen the incentive to challenge the SLAPPs
Throwing Money at Lawyers Can't Stop Us (It Never Did)
Even just trying to censor things can result in the opposite of the desired outcome
BetaNews Has More or Less Died After Experiments With LLM Slop, Is Linuxsecurity Next?
It doesn't seem like BetaNews knows what it's doing, let alone what it talks about
 
Gemini Links 15/06/2025: "AI Fatigue and Crappiness"
Links for the day
Microsoft Attack Dogs Against Watchdogs and Guard Dogs in Software
Last year Microsofters hired attack dogs or "guns for hire"
Slop Cannot Replace Domain Expertise
All this "AI" hype (it's not even intelligence, it's all a misnomer, as many of us have insisted all along) will fizzle and be written off as a failed experiment
IBM's Fresh 'PIPs' (Action Before Layoffs)
At times like these, even once-reputable employers resort to PIPs and other procedures/tricks for denial of workers' rights
Microsoft is a Problem Not Just for Denmark
Every country should consider what Denmark is doing, why Denmark is doing it, and then do the same
The Slopfarms' Self Detonation
If more sites like BetaNews go under, then maybe we can still salvage some of the Web
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Saturday, June 14, 2025
IRC logs for Saturday, June 14, 2025
Links 14/06/2025: FDA Changes Priorities, Cassette Data Storage From The 1970s
Links for the day
Gemini Links 14/06/2025: Steam Next Fest and Thoughts on Gemini
Links for the day
Site/Datacentre Maintenance Next Week
speed things up
Bulgaria: GNU/Linux Near 10%
The Bulgarian market seems to be changing
I Never Spoke to BetaNews. But BetaNews Wants to Ensure I Never Will, Either.
Sometimes just the reluctance to talk about it can say a great deal
Online Search or Large Search Engines Aren't Working Anymore
business models that directly compete with interests of Web users
Holidays and Breaks
I've hardly taken any long breaks since I got married
Danish OpenDocument Freedom
"year of Linux"
Links 14/06/2025: Wars and L.A. Distortion Effect
Links for the day
Gemini Links 14/06/2025: Historic Ada Design and GeminiSpace.Club to Expire
Links for the day
Links 14/06/2025: India Plane Crash and Middle-Eastern War
Links for the day
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Friday, June 13, 2025
IRC logs for Friday, June 13, 2025
Gemini Links 13/06/2025: (Not)virtues and Project Yeet Broadband
Links for the day
Links 13/06/2025: Journalists Targeted by Cracking, China-Japan and Israel-Iran Tensions Grow
Links for the day
Links 13/06/2025: US Reduces Nonessential Staff at Baghdad Embassy Ahead of Strikes in Iran, Invasion of California Debated
Links for the day
X11 is Free Software
Whether you agree (e.g. on politics) with the person/s forking it doesn't matter
The More Time Passes, the Better Our Advice on Social Control Media Seems
At the end of the day, any platform you do not control yourself is working for someone else
Twitter (X) is Dying, Now It's Just Like a Mafia-Type Operation of the Man Who Does Nazi Salutes in Public
a form of extortion
UK High Court Blasts Brett Wilson LLP for Misusing "GDPR" After Failed Efforts to Censor Critics Using 'Libel' Claims
No wonder this firm is rapidly shrinking
Recent Blunders in Microsoft GitHub (e.g. Slop-Generated Bug Reports or GPL Violations 'as a Service') Taking Their Toll?
Put bluntly, if you still use Microsoft GitHub, then you're slave to Microsoft
American Imperialism and Microsoft Plagiarism
Techrights will therefore do what Microsoft does not want it to do: it'll write even more about Microsoft
When They Have Nothing Left to Help Advance Abusive Litigation for Microsoft People... Other Than Throwing ~500 Pages of Someone Else's Work Into a PDF
Microsoft is having a very tough year
The Price of Exposing Corruption in Poland (and Elsewhere)
It's easier to participate in corruption than to merely do the right thing and oppose it
Slopwatch and Yet More Holes in 'Secure Boot' (as Usual!), Promoted Inside Linux by the Man We Are Suing
Today's Slopwatch will be short
Gemini Links 13/06/2025: People You've Left Behind, Life Update and OS Changes
Links for the day
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Thursday, June 12, 2025
IRC logs for Thursday, June 12, 2025