-
Notifications
You must be signed in to change notification settings - Fork 523
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Wrong frame rate in output MPD/M3U8 with v1 CTTS boxes in input #751
Comments
It seems that the frame rate in the output manifests/playlists is based on the duration of the first sample. With v1 CTTS boxes, this sample duration is not calculated correctly. I found a cheap solution: prefer the second sample duration over the first. :-) That seems to work in my tests, but there is probably a better solution. I'm still getting familiar with the source code. |
The correct duration is 512. The first segment has an offset of 1024, and Packager sees the duration as 1536. This is why it calculates a frame rate of 10 instead of 30. |
The output of a verbose log with some interesting info: Pushing frame: , key=1, dur=1536, dts=0, cts=0, size=763 I'm not sure the first frame duration is actually "wrong". It might just be that it's the wrong thing for the frame-rate calculation. So I see two relatively easy options to fix it:
In my example, I have 30 frames, 29 of which have the duration 512 and the first of which has the duration of 1536. The average duration is 546. The final frame's CTS is 15360, but the max frame CTS is 15872. Since I'm encoding a 1-second clip, the difference between those two is significant, and makes the difference between a calculated frame rate of 29.07 fps and 28.13 fps. The average seems less error-prone, especially for reasonably-sized content. |
@joeyparrish Thanks for looking into it. For this particular stream, looks like the actual frame rate of the stream is 30 fps (15360 / 512). The first frame should have a timestamp of dts=1024 and cts=1024, but they are normalized to 0 by FFmpeg, which results in a duration of 1536 for the first frame.
I think taking the average is the right choice. I am a bit concerned on the live packaging scenario, as there could be gaps and overlaps. There may be temporary fluctuation, but it should stablize over time with the average method. |
@joeyparrish are we good with the second frame duration approach? If not I have a patch to compute this based on average as well, and perhaps we could turn on the average for VOD mode (while leaving second sample for live?). |
Yeah, that sounds reasonable. Use second for live, use average for VOD. Average may be too difficult for live. |
System info
Operating System: gLinux / Debian testing
Shaka Packager Version: v2.4.2-c60e988-release
Issue and steps to reproduce the problem
Packager Command:
Both sets of outputs should have the same frame rate, and according to ffprobe, they basically do:
But Shaka Packager puts very different numbers into the DASH manifests & HLS master playlists. Both DASH & HLS outputs say 30 fps for the version with v0 CTTS boxes, and 10 fps for the version with v1 CTTS boxes:
The text was updated successfully, but these errors were encountered: