Skip to content
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 (different frame rates) #263

Open
sasquatch74 opened this issue Apr 9, 2018 · 16 comments
Open

Video tracks are not aligned (different frame rates) #263

sasquatch74 opened this issue Apr 9, 2018 · 16 comments
Assignees
Labels

Comments

@sasquatch74
Copy link

I am facing the following issue:

  1. The inputs are 5 multi bit-rate mp4 files. Four of these have a frame rate of 25 fps and the fifth one has 10 fps.
  2. I checked the GOP size on each of them. The 25 fps files have GOP size of 1 second (i.e., one I-frame every 25 frames). The 10 fps file has the GOP size of 1 second (i.e., one I-frame every 10 frames).
  3. mp4fragment command seems to work fine:
    mp4fragment.exe --fragment-duration 10000 inputfile.mp4 outputfile.mp4
  4. mp4dash always returns the following error:
    WARNING: video sample count mismatch between "File 5#1" and "File 4#1"
    ERROR: video tracks are not aligned ("File 5#1" differs from File 1#1)
  5. If I remove the 10 fps file from the mp4dash command, it works fine and generates the dash manifest.

I understand that mp4dash requires the key-frames to align, but when you have files with different frame rates, the key frames do not align by frame count but they do align if you consider the time in seconds or milliseconds.

What am I doing wrong?

@maetthu
Copy link

maetthu commented Jun 30, 2018

@sasquatch74 I'm facing the same issue. Did you find a solution/workaround?

@barbibulle
Copy link
Contributor

To be honest, this isn't a scenario I have tested (different frame rates). So it may very well be an issue with the Bento4 packager. I will try this use case and followup.

@barbibulle barbibulle self-assigned this Jul 1, 2018
@maetthu
Copy link

maetthu commented Jul 2, 2018

@barbibulle thanks :)

Up until now, we had all our videos up to 1080p, all being 30fps and a fixed 60 frames keyframe interval, but now we're trying to add 1080p@60 and 1440p@60 with a 120 frame keyframe interval to the mix, but with them added, mp4dash complains about the alignment. I tried forcing mp4fragment to a 2s segment size for both, but with the same result. As far as I understand, both align at 2s, despite the different framerate.

@sasquatch74
Copy link
Author

@maetthu We couldn't make Bento4 packager work when source mp4 files had different frame rates. We used a different packager (the one from Unified Streaming - this is not free) to get it to work.

@maetthu
Copy link

maetthu commented Sep 21, 2018

@barbibulle Did you have a chance to look into this? No worries if not, it's just that we will start with our encoding project soon and it would be nice to know if multiple framerates is something you'd consider worth supporting in the Bento4 packager.

@barbibulle
Copy link
Contributor

@maetthu Sorry for not having looked at this earlier. Would it be possible for send me a link to some sample files that I could use to easily replicate the issue on my side? This would save me some time. Thanks.

@maetthu
Copy link

maetthu commented Sep 24, 2018

@barbibulle sure! thanks for looking at it 🙂

These are streaming versions I transcoded from 1080p@60fps version of the Big Buck Bunny video:

Steps to reproduce:

$ mp4fragment 1080p_60.mp4 1080p_60.fmp4
found regular I-frame interval: 120 frames (at 60.000 frames per second)
$ mp4fragment 720p_30.mp4 720p_30.fmp4
found regular I-frame interval: 60 frames (at 30.000 frames per second)
$ mp4dash -o out/ -f --mpd-name=master.mpd --hls *.fmp4
Parsing media file 1: 1080p_60.fmp4
Parsing media file 2: 720p_30.fmp4
WARNING: video sample count mismatch between "File 2#2" and "File 1#2"
ERROR: video tracks are not aligned ("File 2#2" differs from File 1#2)

@maetthu
Copy link

maetthu commented Oct 29, 2018

@barbibulle did you have a chance looking into it?

@barbibulle
Copy link
Contributor

I have fixed this on master (still haven't pushed a new set of pre-compiled binaries).
Let me know if this works for you.

@wmucheru
Copy link

wmucheru commented Oct 3, 2019

@barbibulle Thanks for the fix on this. I'm however facing this issue when running mp4dash for 360, 480 and 720p renditions of my mp4 file to generate an ABR stream. I'm using the latest binaries for macOS but still facing this issue. What can I do to run it successfully?

@Benny739
Copy link

Same issue here

@rodrigo-brito
Copy link

Same problem here, the last Linux release returns the same error.

@baloda
Copy link

baloda commented Nov 6, 2020

Facing the same issue. can someone help me? not sure how and what to fix
FFmpeg Transcoding:

ffmpeg -loglevel error -i source.mp4
-map 0:v
-movflags +faststart -vsync 1
-c:v libx264
-s 256x144
-g 30
-profile:v main
-b:v 244894
-y 1.mp4

ffmpeg -loglevel error -i source.mp4
-map 0:v
-movflags +faststart -vsync 1
-c:v libx264
-s 416x234
-b:v 424101
-g 30
-profile:v main
-y 2.mp4

ERROR: video tracks are not aligned ("File 2#1" differs from File 1#1)

debug output of mp4dash:
Segment Count = 56
Type = video
Sample Count = 2767
Average segment bitrate = 253547
Max segment bitrate = 645680
Required bandwidth = 386983
Average segment duration = 2.001481481481483

Segment Count            = 56
Type                     = video
Sample Count             = 2767
Average segment bitrate  = 439965
Max segment bitrate      = 1136650
Required bandwidth       = 721261
Average segment duration = 2.001481481481483

@rodrigo-brito
Copy link

rodrigo-brito commented Nov 6, 2020

Hi @baloda. I solved the problem with a fixed fps (24FPS) and segments of two seconds (gop = 2 * 24 = 48). My FFMPEG parameters are:

-c:v libx264 -preset faster -x264opts keyint=48:min-keyint=48:no-scenecut -strict -2 -r 24

In mp4fragment, I also used the parameter --fragment-duration 2000

@deBilla
Copy link

deBilla commented Jan 30, 2024

Issue should be due to GOP Misalignment
Adding following options to ffmpeg command solved my issue
-keyint_min 48 -g 48 -sc_threshold 0

What these do?
-keyint_min 48: keyint represents the key frame (IDR frame) interval. This option limits the IDR frame interval to a minimum of 48 frames, which is the same length as the previously set GOP.
-sc_threshold 0: Disable scene recognition, that is, disable automatic addition of IDR frames

@maytham553
Copy link

Any solve ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants