-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
video tracks are not aligned #85
Comments
When you package multi-bitrate video, you need to ensure that all the variants of your video streams have key frames at the same location, so that the fragments in the variant streams are aligned. |
Just got the same problem. I actually use scene detection on purpose, it's simply way better with than without (better for visual quality for fast moving dynamic scenes), but always with fixed 2 seconds GOP alignment, which corresponds to 2 seconds segment size that I want to use in fmp4 hls with mp4dash. Here is how I encode samples that cause "video tracks are not aligned" error (ffmpeg 3.4.1, constrained VBR 110% setup):
Same 3 commands for 480p, 720p and 1080p, all parameters are the same except bitrate, bufsize, maxrate and obviously "-vf" (each variant is produced with its own separate 1st pass). So all four have a fixed GOP alignment, even with scene detection enabled. This is known to not cause any problems with ffmpeg HLS TS muxer (when used with TS mezzanine files) and with Shaka packager HLS fMP4 (when used with MP4 mezzanine files). That probably means that those two packagers somehow successfully handle this problem internally, since testing does not uncover any problems whatsoever (multi-bitrate setup is throughly tested with Flowplayer, which is based on hls.js). I even studied the output (those four mezzanine files) with Telestream Switch Pro, it allows to beautifully visualize all GOP positions. All I-frames' positions in 360, 480, 720 and 1080 variants seem to correspond one to another, again, even with scene detection enabled, which means IDR I-frames at same fixed intervals each 2 seconds + additional non IDR I-frames at scene changes. Positions of those latter seem to be the same too, in all four variants, at least at first sight. I was unable to find any differences in those non IDR I-frames' positions. So does that mean that scene detection is a show stopper to using bento to correctly produce multi-bitrate hls fmp4? P.S.: I also tried to add --index, --force-i-frame-sync auto, --force-i-frame-sync all, none of that helps: mp4fragment --fragment-duration 2000 --index --force-i-frame-sync all audio.m4a audio_fragmented.mp4 mp4dash --hls audio_fragmented.mp4 out360_fragmented.mp4 out480_fragmented.mp4 out720_fragmented.mp4 out1080_fragmented.mp4 I still get error:
|
I slighty modified ffmpeg call and that completely solved the problem. Seems like it really was not properly aligned and now I constrained ffmpeg to do a real fixed GOP alignment, while keeping scene detection enabled. For those who are interested, instead of:
I did
Where:
Doubing keyint is required to trick ffmpeg, since otherwise it does not allow to assign the same value to both keyint_min and keyint, it tends to divide keyint by 2 internally. This trick allows to compensate that and to have the same keyint_min and keyint, even if in metadata it would appear as not the same values, in reality it is. More info here: Then it works:
|
I solved with a different combination fix the GOP size: |
Recently encounter the same problem and I solved it by updating ffmpeg to the latest ( from 4.3.x to 6.0.x ) |
what bento4 command must be used if the file is HEVC ? |
I'm trying to run
mp4dash
with two inputs representing the same video in different size:It fails with
ERROR: video tracks are not aligned
I've tracked down that error that is raised here Apparently, some sample counts differ. Sample counts are generated here and I have honestly no idea what they correspond to.The large and small videos have been previously fragmented with
mp4fragment
(no particular settings) and the original versions have been created with ffmeg using the same original video as input and simply changing size settings.The text was updated successfully, but these errors were encountered: