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

Does hls.js support extracting SEI frame from videos? #4421

Closed
dongrixinyu opened this issue Nov 11, 2021 · 6 comments · Fixed by #4459
Closed

Does hls.js support extracting SEI frame from videos? #4421

dongrixinyu opened this issue Nov 11, 2021 · 6 comments · Fixed by #4459
Labels
Feature proposal Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix.
Milestone

Comments

@dongrixinyu
Copy link

Is your feature request related to a problem? Please describe.

No

Describe the solution you'd like

I really appreciated that the fabulous hls.js favored my daily frontend work.

However I still have a problem concerning the SEI frame data from videos encoded in h264

the situation is as follows:

My video is encoded in h264 with SEI data after every I frame. and I wanna extract SEI info in the fontend browser and continue to parse this data by myself.
So I am confused that if hls.js provide such api or sdk functions for me to extract every SEI.

really look forward to your reply.

Thank you!

Additional context

No response

@dongrixinyu dongrixinyu added Feature proposal Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. labels Nov 11, 2021
@dylanjha
Copy link
Contributor

@dongrixinyu would this event help?

  • Hls.Events.FRAG_PARSING_USERDATA - fired when parsing sei text is completed
    data: { id : demuxer id, frag: fragment object, samples : [ sei samples pes ] }

Found it in the list of runtime events

@dongrixinyu
Copy link
Author

Thank you for your answer. and I ll reply after i tried this hook

@dongrixinyu
Copy link
Author

@dongrixinyu would this event help?

  • Hls.Events.FRAG_PARSING_USERDATA - fired when parsing sei text is completed
    data: { id : demuxer id, frag: fragment object, samples : [ sei samples pes ] }

Found it in the list of runtime events

I tried this hook api via code below:

    <script>
        var video = document.getElementById('video');
        var hls = new Hls();
        // bind them together
        hls.attachMedia(video);
        // MEDIA_ATTACHED event is fired by hls object once MediaSource is ready
        hls.on(Hls.Events.MEDIA_ATTACHED, function () {
            // hls.loadSource('https://live.ig-dev.uavcmlc.com:443/live/test_rtsp_stream.m3u8?token=E5xZiWsNEQ6D');
            hls.loadSource('http://192.168.35.51:26789/test.m3u8');
            hls.on(Hls.Events.MANIFEST_PARSED, function (event, data) {
                console.log(
                    'manifest loaded, found ' + data.levels.length + ' quality level'
                );
            });
            hls.on(Hls.Events.FRAG_PARSING_USERDATA, function (event, data) {
                console.log('event =====> ', event, 'data =====> ', data)
            })
        });
    </script>

and my source is a m3u8 file containing several mpegs-ts files with SEI info.
when I get the ts file, the hls.js indeed get the log as below:
test_sei

then what I am confused about is:

  • when hls.js get a mpegs-ts file, this hook can get all SEI info at once? Can we get the SEI info one frame after another when I play the video file?
  • in the picture above, userData is the SEI info,right?

Thanks again for your guide and help!

@dylanjha
Copy link
Contributor

@dongrixinyu I'm not sure the answer to your 2 questions.

Did you try this code above with the Hls.Events.FRAG_PARSING_USERDATA listener? What were the results?

robwalch added a commit that referenced this issue Dec 15, 2021
Resolves #2623 (Add CMAF CC support)
Resolves #4242 (Fix parsing multiple user data unregistered SEI)
Closes #4421 (Does hls.js support extracting SEI frame from videos?)
Fixes #4317 (Progressive mode is broken with fmp4 playback)
robwalch added a commit that referenced this issue Dec 15, 2021
Resolves #2623 (Add CMAF CC support)
Resolves #4242 (Fix parsing multiple user data unregistered SEI)
Closes #4421 (Does hls.js support extracting SEI frame from videos?)
Fixes #4317 (Progressive mode is broken with fmp4 playback)
robwalch added a commit that referenced this issue Dec 16, 2021
Resolves #2623 (Add CMAF CC support)
Resolves #4242 (Fix parsing multiple user data unregistered SEI)
Closes #4421 (Does hls.js support extracting SEI frame from videos?)
Fixes #4317 (Progressive mode is broken with fmp4 playback)
robwalch added a commit that referenced this issue Dec 16, 2021
Resolves #2623 (Add CMAF CC support)
Resolves #4242 (Fix parsing multiple user data unregistered SEI)
Closes #4421 (Does hls.js support extracting SEI frame from videos?)
Fixes #4317 (Progressive mode is broken with fmp4 playback)
robwalch added a commit that referenced this issue Jan 18, 2022
Resolves #2623 (Add CMAF CC support)
Resolves #4242 (Fix parsing multiple user data unregistered SEI)
Closes #4421 (Does hls.js support extracting SEI frame from videos?)
Fixes #4317 (Progressive mode is broken with fmp4 playback)
robwalch added a commit that referenced this issue Jan 25, 2022
Resolves #2623 (Add CMAF CC support)
Resolves #4242 (Fix parsing multiple user data unregistered SEI)
Closes #4421 (Does hls.js support extracting SEI frame from videos?)
Fixes #4317 (Progressive mode is broken with fmp4 playback)
@antonm76
Copy link

antonm76 commented Apr 1, 2022

@robwalch I set SEI user data in my stream and then I able to read them with FRAG_PARSING_USERDATA events but it is only possible for HLS streams with MPEGTS segments.
When I try to use FMP4 (with ffmpeg's hls muxer) or M4S (which are generated by the ffmpeg's dash muxer) user data samples are always emty.

@antonm76
Copy link

antonm76 commented Apr 1, 2022

@robwalch I use v.1.1.5

@robwalch robwalch added this to the 1.2.0 milestone Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature proposal Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants