Strip audio track from hero-video.mp4 (fixes Firefox suspend inhibitor)#573
Draft
danzatt wants to merge 1 commit into
Draft
Strip audio track from hero-video.mp4 (fixes Firefox suspend inhibitor)#573danzatt wants to merge 1 commit into
danzatt wants to merge 1 commit into
Conversation
The hero video on flatcar.org is decorative — autoplay, muted, loop —
but the source MP4 ships with an AAC audio track. Firefox treats any
autoplaying <video> with an audio track as 'playing video' and
registers a suspend inhibitor with the desktop session via
org.freedesktop.PowerManagement, even when the muted attribute is set:
$ gnome-session-inhibit --list
org.mozilla.firefox: Playing video (suspend)
The result: any user who leaves a flatcar.org tab open cannot suspend
their machine (laptop lid close / idle suspend / 'Suspend' menu all
silently fail) until the tab is closed or backgrounded.
Stripping the unused audio track with
ffmpeg -i hero-video.mp4 -an -c:v copy -movflags +faststart out.mp4
fixes the inhibitor, shaves ~770 KB off the asset, and changes nothing
visible to users (the video is muted regardless).
Contributor
Author
|
I've just tested this PR locally and it does the trick. However, it would be better to switch away from 40MB video altogether. |
Contributor
|
Thanks, I initially thought this couldn't be avoided, but I didn't realise it was the audio. I agree though that 40MB is really excessive. It's currently encoded as H.264, which isn't the most efficient and is not a free codec. VP9 in a WebM is a better choice. Re-encoding with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The hero video (
static/videos/hero-video.mp4) on flatcar.org is purely decorative — embedded withautoplay muted loopinthemes/flatcar/layouts/partials/hero.htmlvia thevideo-player.htmlpartial. But the source MP4 ships with an unused AAC audio track (192 kbps, ~32 s).Firefox treats any autoplaying
<video>element that has an audio track as "playing video" and registers a suspend inhibitor with the desktop session over D-Bus (org.freedesktop.PowerManagement.Inhibit), regardless of themutedattribute. With aflatcar.orgtab open you can observe:User-visible impact: anyone leaving a flatcar.org tab open in Firefox cannot suspend their machine — laptop lid close, idle suspend, and the GNOME "Suspend" menu all silently fail until the tab is closed or backgrounded.
Fix
Strip the unused audio track. The video stream is copied as-is (no re-encode, no quality loss):
Result
gnome-session-inhibit --listbefore/after.mutedalready.+faststartkeeps the moov atom at the front so the browser can start playback before the full file arrives.Verification