question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Relocate MOOV alternative for Matroska files & optimizing MKVs for streaming

See original GitHub issue

There’s a tool called mkvpropedit that can rewrite the new statistics for an MKV file, which is great since most of the time the metadata stuff like bitrate and track size don’t show after conversion, for example the command is like this: mkvpropedit --add-track-statistics-tags <file/path> it goes from this (no size and bitrate info):

Audio #1
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : A_AAC-2
Duration                                 : 23 min 15 s
Channel(s)                               : 6 channels
Channel layout                           : C L R Ls Rs LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Title                                    : 5.1 Channel / 5.1 Channel
Writing library                          : Lavc58.134.100 libfdk_aac
Language                                 : English
Default                                  : Yes
Forced                                   : No

to this with the mkvpropedit command:

Audio #1
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : A_AAC-2
Duration                                 : 23 min 15 s
Bit rate                                 : 406 kb/s
Channel(s)                               : 6 channels
Channel layout                           : C L R Ls Rs LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 67.5 MiB (4%)
Title                                    : 5.1 Channel / 5.1 Channel
Writing library                          : Lavc58.134.100 libfdk_aac
Language                                 : English
Default                                  : Yes
Forced                                   : No

This may seem too much for just a few extra headers, but it would be really great to have it as an option to check my settings/or when I’d like to deploy it into my servers and check everything is going nicely, this is already done when relocate moov is enabled, so it would be cool to have on MKVs

One more thing, there’s a tool called mkclean that basically optimizes the MKVs for streaming, adding it as an option would be amazing, I think it might be possible as an post-process command or something but I think it would be cool to have it baked into the tool

Just an important thing to some, it will re-write the cues, some might not want that for other reasons, so I recommend adding this as an opt-in option

Note: I haven’t really tested/compared if there is an ffmpeg command that can basically do one/both (or if it does it already), I searched but most results talk about other things or unrelated stuff, so one of these features could be already be possible by ffmpeg, I don’t really know

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mdhigginscommented, May 16, 2022

That warning is normal for MKVs, QTFS not supported but other ffmpeg parameters are applied, the QTFS pass is still attempted just because it fails gracefully if it’s the wrong format

3a6ae9e3591f764b99512c5f9aa5fd6d5b94eb1d

Silence that warning and moved to debug level logging to reduce confusion and explicitly don’t attempt on MKVs now

1reaction
VXszcommented, Jan 21, 2022

Oh that looks great, I haven’t really tried ffmpeg’s index thing so I can’t tell much about it, but it’s awesome to see it integrated 😃, sadly I can’t check if it works correctly currently, but it’s probably good to go

Read more comments on GitHub >

github_iconTop Results From Across the Web

Optimizing MP4 Video for Fast Streaming - Pavtube
Want to stream MP4 video quickly? Optimizing MP4 video is the best way, 3 solutions are here to help you to optimize MP4...
Read more >
Make MKV file suitable for streaming with ffmpeg (or avconv)
Building on top of Gyan's answer, mkclean is that right tool to optimize MKVs for streaming. However, I noticed some quirks in how...
Read more >
Optimizing .mkv files for streaming with mkclean during ...
There are two ways to fix this, one way is to remux the mkv file, the other is to “clean” the mkv file....
Read more >
h.264 - Is there a downside to putting the MOOV atom at the ...
Having the MOOV atom at the end has no special benefit, it is just not as inconvenient in local playback situations where seeking...
Read more >
Revisiting Video Encoding: MP4 and WebM
Matroska files, usually just called MKV files, use a kind of binary XML called EBML to store different things like video tracks, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found