Skip to content
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

iframe_playlist for fmp4 doesn't contain all keyframes #1468

Open
SteveR-PMP opened this issue Dec 21, 2024 · 3 comments
Open

iframe_playlist for fmp4 doesn't contain all keyframes #1468

SteveR-PMP opened this issue Dec 21, 2024 · 3 comments

Comments

@SteveR-PMP
Copy link
Contributor

System info

Operating System: Ubuntu 20.04
Shaka Packager Version: 3.4.1 (latest)

Issue and steps to reproduce the problem

Packager Command:
build/packager/packager 'in=packager/media/test/data/bear-1280x720.mp4,stream=video,output=/tmp/shaka/test/bear.mp4,iframe_playlist_name=stream_iframe.m3u8' --hls_master_playlist_output /tmp/shaka/test/master.m3u8

Extra steps to reproduce the problem?
This is using the sample mp4 files included with shaka that only have a few key frames but still will demonstrate the problem.

What is the expected result?
The resulting stream_iframe.m3u8 should contain an entry for each keyframe as it does with ts segment as shown here:
build/packager/packager 'in=packager/media/test/data/bear-1280x720.mp4,stream=video,segment_template=/tmp/shaka/test/seg_$Number$.ts,iframe_playlist_name=stream_iframe.m3u8' --hls_master_playlist_output /tmp/shaka/test/master.m3u8

#EXT-X-I-FRAMES-ONLY
#EXTINF:1.001,
#EXT-X-BYTERANGE:31584@376
seg_1.ts
#EXTINF:1.001,
#EXT-X-BYTERANGE:38352@276172
seg_1.ts
#EXTINF:0.734,
#EXT-X-BYTERANGE:44180@615324
seg_1.ts

What happens instead?
I only get an entry for the initial keyframe of a segment.
#EXT-X-I-FRAMES-ONLY
#EXT-X-MAP:URI="bear.mp4",BYTERANGE="866@0"
#EXTINF:2.736,
#EXT-X-BYTERANGE:31903@910
bear.mp4

<Please attach the input files or email to shaka-packager-issues@google.com.>

@vish91
Copy link
Contributor

vish91 commented Jan 10, 2025

Hey @joeyparrish @cosmin when you get time can we get some thoughts from you on this ? Trying to figure out if this is a bug or if we are missing some param to ensure the iframe playlist for HLS is correct irrespective of using ts or m4s or a fmp4.

@SteveR-PMP
Copy link
Contributor Author

I found the relevant code starting here:

bool first_key_frame = true;

Which includes a comment suggesting this was intentional:
It also implies that only the first key frame can be included.

I'm not seeing the implication in the HLS spec that only the first key frame can be included, but I may just be missing it.

@baassisnos
Copy link

For me it was solved by setting --segment_duration to the size of the segment (example 4) and --fragment_duration to the size of the keyframe (example 2) so the hls playlist was generated correctly.

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

No branches or pull requests

3 participants