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

unmuxed cmaf hls trun version #1547

Open
kidoubled opened this issue Oct 23, 2024 · 6 comments
Open

unmuxed cmaf hls trun version #1547

kidoubled opened this issue Oct 23, 2024 · 6 comments

Comments

@kidoubled
Copy link

using unmuxed cmaf in hls, getting a trun version of 0. I believe I've deduced this is leveraging the dash packager, and if I can set the media_set->version >=2, i'd get trun version 1.

p = mp4_fragment_write_video_trun_atom(p, sequence, first_frame_offset, media_set->version >= 2 ? 1 : 0);

I think this could be sourced from the submodule_context->request params, when in mapped mode, but after that, I lose the path. https://github.com/kaltura/nginx-vod-module/blob/master/ngx_http_vod_module.c#L5286

hoping I'm on the right track, and that someone can help me with the rest. Thanks in advance

@kidoubled
Copy link
Author

I found the version parsing from the filename https://github.com/kaltura/nginx-vod-module/blob/master/ngx_http_vod_request_parse.c#L522

which is set here for dash:

p = vod_copy(p, "-x3", sizeof("-x3") - 1); // TODO: remove this after deployment
but I can't see how this would be set for unmuxed hls

@kidoubled
Copy link
Author

kidoubled commented Oct 30, 2024

@erankor
would checking for track count =1 and adding a -x3 in one of these locations be a good solution to how to get unmixed cmaf hls to use trun version 1 with signed pts delay?
https://github.com/kaltura/nginx-vod-module/blob/master/vod/manifest_utils.c#L399
https://github.com/kaltura/nginx-vod-module/blob/master/vod/hls/m3u8_builder.c#L206

alternatively, perhaps I could get away with using a sub_filter to turn .m4s into -x3.m4s?

@kidoubled
Copy link
Author

kidoubled commented Oct 31, 2024

testing the subfilter approach using a config similar to this:

location /cmaf/hls/ {
            vod hls;
            vod_hls_force_unmuxed_segments on;
            vod_hls_container_format fmp4;

            sub_filter '.m4s' '-x3.m4s';
            sub_filter_once off;
            sub_filter_types application/vnd.apple.mpegurl;
        }

which seems to be working. I'd be interested to know if there's a better approach.

@erankor
Copy link
Contributor

erankor commented Nov 9, 2024

Hi @kidoubled, out of curiosity, why do you care if it's version 0 or 1?
The URL version (-x3) was added for backward compatibility - at some point I changed the trun version from 0 to 1, but I wanted it to affect only new streams - so that the player won't get a mix of version 0 & version 1.
Btw, I implemented a solution similar to your solution here - #985 (comment)

@erankor
Copy link
Contributor

erankor commented Nov 9, 2024

In our live packager (a more recent project, using some of the code initially written here), I'm always using version 1 for video -
https://github.com/kaltura/media-framework/blob/master/nginx-pckg-module/src/media/mp4/mp4_muxer.c#L316

@kidoubled
Copy link
Author

kidoubled commented Nov 9, 2024

@erankor some newer players don't work well with version 0 / without the signed pts delay... always using version 1 for video makes a great deal of sense these days, and I can see that would occur with almost all modes of operation within the packager, except unmuxed hls, because that ends up using the dash packager code, but without adding the -x3 modifier to the uris. I'll plan to use the subfilter, but would be open to working on a PR if you had thoughts about the best way to address. Is the "right way" to fix this removing the legacy backwards compatibility at this point?

Also, I had noticed #985 (comment) and used it as inspiration for my approach above. Thanks for the project and all the community support over the years.

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

No branches or pull requests

2 participants