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

Strange bug in audio init segments #2773

Closed
MarianoFacundoArch opened this issue Mar 9, 2024 · 7 comments
Closed

Strange bug in audio init segments #2773

MarianoFacundoArch opened this issue Mar 9, 2024 · 7 comments

Comments

@MarianoFacundoArch
Copy link

MarianoFacundoArch commented Mar 9, 2024

With the following gpac command:

-i transcoded/video_h264_720_vcrf_23.mp4:#HLSPL=video/h264_720_vcrf_23/index.m3u8 @ cecrypt:cfile=drm/drmSpecs/65ebb3d94544b359e976b34665d152c0.xml:FID=SRC1::#HLSKey=skd://65ebb3d94544b359e976b34665d152c0",KEYFORMAT="com.apple.streamingkeydelivery",KEYFORMATVERSIONS="1 -i transcoded/video_h264_480_vb_1500k.mp4:#HLSPL=video/h264_480_vb_1500k/index.m3u8 @ cecrypt:cfile=drm/drmSpecs/65ebb3d94544b359e976b347980565a6.xml:FID=SRC2::#HLSKey=skd://65ebb3d94544b359e976b347980565a6",KEYFORMAT="com.apple.streamingkeydelivery",KEYFORMATVERSIONS="1 -i transcoded/video_h264_360_vb_1M.mp4:#HLSPL=video/h264_360_vb_1M/index.m3u8 @ cecrypt:cfile=drm/drmSpecs/65ebb3d94544b359e976b348cfcdc854.xml:FID=SRC3::#HLSKey=skd://65ebb3d94544b359e976b348cfcdc854",KEYFORMAT="com.apple.streamingkeydelivery",KEYFORMATVERSIONS="1 -i transcoded/video_h264_240_vb_500k.mp4:#HLSPL=video/h264_240_vb_500k/index.m3u8 @ cecrypt:cfile=drm/drmSpecs/65ebb3d94544b359e976b349c7dbc8ff.xml:FID=SRC4::#HLSKey=skd://65ebb3d94544b359e976b349c7dbc8ff",KEYFORMAT="com.apple.streamingkeydelivery",KEYFORMATVERSIONS="1 -i transcoded/video_h264_1080_vcrf_21.mp4:#HLSPL=video/h264_1080_vcrf_21/index.m3u8 @ cecrypt:cfile=drm/drmSpecs/65ebb3d94544b359e976b34ae17ee22c.xml:FID=SRC5::#HLSKey=skd://65ebb3d94544b359e976b34ae17ee22c",KEYFORMAT="com.apple.streamingkeydelivery",KEYFORMATVERSIONS="1 -i transcoded/audio_aac_ab_64k_asr_44100_ac_1.mp4:#HLSPL=audio/aac_ab_64k_asr_44100_ac_1/index.m3u8 @ cecrypt:cfile=drm/drmSpecs/65ebb3d94544b359e976b34b4f8e2722.xml:FID=SRC6::#HLSKey=skd://65ebb3d94544b359e976b34b4f8e2722",KEYFORMAT="com.apple.streamingkeydelivery",KEYFORMATVERSIONS="1 -i transcoded/audio_aac_ab_128k_asr_44100_ac_2.mp4:#HLSPL=audio/aac_ab_128k_asr_44100_ac_2/index.m3u8 @ cecrypt:cfile=drm/drmSpecs/65ebb3d94544b359e976b34c12b121c6.xml:FID=SRC7::#HLSKey=skd://65ebb3d94544b359e976b34c12b121c6",KEYFORMAT="com.apple.streamingkeydelivery",KEYFORMATVERSIONS="1 -o drm/protected/live.m3u8:template=seg-$Number$:dual:segdur=2:SID=SRC1,SRC2,SRC3,SRC4,SRC5,SRC6,SRC7:profile=main

For some unknown reason, the $Number$ does not resolve as init in the audio tracks. It does for video.
Even when nto specifying template names, I started noticing that for audio tracks the output init track was by default _dash.mp4 while for video tracks it was _dashinit.mp4.
I guess there might be a bug but I cannot find why or where. Maybe related to when there are several audio inputs? The file inputs have only one track each video or audio.

@rbouqueau
Copy link
Member

I can reproduce with:

rm -rf hls/ && \
gpac avgen:dur=4 \
@@0 c=aac:b=64k:#HLSPL=audio/aac_ab_64k_asr_44100_ac_1/index.m3u8:FID=S0 \
@@0 c=aac:b=128k:#HLSPL=audio/aac_ab_128k_asr_44100_ac_1/index.m3u8:FID=S1 \
-o hls/live.m3u8:template='seg-$Number$':dual:segdur=2:profile=main:SID=S0,S1 && \
ls -lR hls

@MarianoFacundoArch
Copy link
Author

This is worse than expected, the output content is not able to be played if it contains audio tracks from my current tests

@MarianoFacundoArch
Copy link
Author

Ok, the audio track encryption does not work even when encrypting just one track.
I guess the "init" not being properly named is another bug itself (the one in this post) so I created a new bug for the probable issue with encrypting audio tracks in cenc too, so it is easier to track by separate each bug

@MarianoFacundoArch
Copy link
Author

Did we get any news on this bug? Can I help somehow?

@jeanlf
Copy link
Member

jeanlf commented Mar 26, 2024

For some unknown reason, the does not resolve as init in the audio tracks.
It is intended - if you specify the template and need a replacement for init, use $Init=FOO$

It does for video.

It should not, and I cannot reproduce locally with your command line.

  • with template=seg-$Number$, all init segs are called seg-.mp4
  • without template, all init segs are called SRCNAME_dash.mp4

Are you sure these are not leftovers from previous tests ? If not and still reproducible, please upload some test content.

All tracks are encrypted as well, and playback / decryption is OK in GPAC. What are you using for playback validation ?

@MarianoFacundoArch
Copy link
Author

The problem is just with the naming (The produced files can be played without any issue), as @rbouqueau said the problem is in the naming specifically.
$Number$ in video tracks resolve to init, but in audio tracks to null.

I would expect for template=seg-$Number$
to always resolve seg-init in both video and audio tracks, or at least the same in those two.
In my opinion the correct would be init, but in any case I would expect the case for video tracks and audio tracks to be similar.

For audio tracks:
image

For video tracks:
image

Command I am using:

-i /temp/transcoded/video_h264_720p_vcrf_23.mp4:FID=SRCORIG1:#HLSPL=video/720p/media.m3u8 @ cecrypt:cfile=/temp/drm/drmSpecs/66034e1bef44f2e1a1acecd600000000.xml:FID=SRC1::#HLSKey=skd://66034e1bef44f2e1a1acecd600000000",KEYFORMAT="com.apple.streamingkeydelivery",KEYFORMATVERSIONS="1 -i /temp/transcoded/video_h264_480p_vb_1500k.mp4:FID=SRCORIG2:#HLSPL=video/480p/media.m3u8 @ cecrypt:cfile=/temp/drm/drmSpecs/66034e1bef44f2e1a1acecd700000000.xml:FID=SRC2::#HLSKey=skd://66034e1bef44f2e1a1acecd700000000",KEYFORMAT="com.apple.streamingkeydelivery",KEYFORMATVERSIONS="1 -i /temp/transcoded/video_h264_360p_vb_1M.mp4:FID=SRCORIG3:#HLSPL=video/360p/media.m3u8 @ cecrypt:cfile=/temp/drm/drmSpecs/66034e1bef44f2e1a1acecd800000000.xml:FID=SRC3::#HLSKey=skd://66034e1bef44f2e1a1acecd800000000",KEYFORMAT="com.apple.streamingkeydelivery",KEYFORMATVERSIONS="1 -i /temp/transcoded/video_h264_240p_vb_500k.mp4:FID=SRCORIG4:#HLSPL=video/240p/media.m3u8 @ cecrypt:cfile=/temp/drm/drmSpecs/66034e1bef44f2e1a1acecd900000000.xml:FID=SRC4::#HLSKey=skd://66034e1bef44f2e1a1acecd900000000",KEYFORMAT="com.apple.streamingkeydelivery",KEYFORMATVERSIONS="1 -i /temp/transcoded/video_h264_1080p_vcrf_21.mp4:FID=SRCORIG5:#HLSPL=video/1080p/media.m3u8 @ cecrypt:cfile=/temp/drm/drmSpecs/66034e1bef44f2e1a1acecda00000000.xml:FID=SRC5::#HLSKey=skd://66034e1bef44f2e1a1acecda00000000",KEYFORMAT="com.apple.streamingkeydelivery",KEYFORMATVERSIONS="1 -i /temp/transcoded/audio_aac_ab_64k_asr_44100_ac_1.mp4:FID=SRCORIG6:#HLSPL=audio/64k/media.m3u8 @ cecrypt:cfile=/temp/drm/drmSpecs/66034e1bef44f2e1a1acecdb00000000.xml:FID=SRC6::#HLSKey=skd://66034e1bef44f2e1a1acecdb00000000",KEYFORMAT="com.apple.streamingkeydelivery",KEYFORMATVERSIONS="1 -i /temp/transcoded/audio_aac_ab_128k_asr_44100_ac_2.mp4:FID=SRCORIG7:#HLSPL=audio/128k/media.m3u8 @ cecrypt:cfile=/temp/drm/drmSpecs/66034e1bef44f2e1a1acecdc00000000.xml:FID=SRC7::#HLSKey=skd://66034e1bef44f2e1a1acecdc00000000",KEYFORMAT="com.apple.streamingkeydelivery",KEYFORMATVERSIONS="1 -o /temp/drm/protected/master.m3u8:template=seg-$Number$:dual:segdur=5:SID=SRC1,SRC2,SRC3,SRC4,SRC5,SRC6,SRC7:profile=main:title=Manifest title::info=https://www.demo.com/

File pack:
Archive.zip

@jeanlf
Copy link
Member

jeanlf commented Mar 27, 2024

Got it, this was due to bitstream switching mode detection (in your case, audio tracks use bitstream switching mode since they have the same decoder config). This was preventing the default "init" to be appended (compat with old arch).

This is now fixed, thanks for the report

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

No branches or pull requests

3 participants