-
Notifications
You must be signed in to change notification settings - Fork 237
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
[MPD K20/21] Audio stopped working with CBCS encryption #1502
Comments
with CBCS is shown these ffmpeg errors, imo this could be or bad decrypted data or not supported stream
I can't help on that, maybe someone else will be able to provide help |
Thanks for taking the time to look into the issue. I'm secretly hoping the ffmpeg/ac3 errors are caused because the audio isn't decrypted by inputstream adaptive making Kodi fail to playback the audio and output those errors in the logs because the audio stream it is trying to open is still encrypted and can't understand it this way. When opening the CBCS streams in the web browser the audio works as it should, I did found a way to still access the CENC streams and the audio works in Kodi but most likely they will close those streams soon. I tried to do some comparison between the CENC and CBCS audio streams using a few different tools but I can't detect much difference between the two, my knowledge analyzing and comparing streams is limited but here are some details: So far I can see the streams provide two audio tracks one AC3 and one AAC. CBCS and CENC both have the same audio tracks: The audio tracks seem to be using identical codecs... as far as I can see, it also won't make much sense to me if they would use completely different audio codecs when the only logical difference should be the DRM to reduce unnecessary server load on their end. Edit: added a few more dash examples to the logs that hopefully might help. |
All I can suggest is either The log is consistent with the audio decoder being fed junk... I'm inclined to think that it's just not being decrypted at all. I don't think it's likely the files themselves are the wrong codec compared to what the manifest reports. Are you able to provide more info on if/how we could reproduce this ourselves (is it a free service and is it geolocked)? |
Thanks for the reply. The live streams are provided by my ISP and seem to be locked to my ip or hostname, the requested mpd links expire after a few minutes so I unfortunately can't share the streams. I can build inputstream adaptive manually and tried to change a few things but I don't have enough knowledge on how the CBCS decryption fully works, attaching visual studio debugger to Kodi doesn't work with DRM streams because Kodi crashes. (According to the wiki this is because of the encryption) Just tried a few other free CBCS streams I found online, for example this one also only has working video and no audio on the CBCS stream: Edit: converted to m3u playlists https://github.com/Trdum/cbcsplaylist Stream URLs: License URL: Request header: Post data: Hope the audio not working on the stream above is caused by the same issue as my stream. If this is not the case I can add extra debug logs to inputstream adaptive to help find the issue there. Few more CBCS example streams I tested: |
Ok, you need to put something like this: Inbetween these 2 lines: inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp Lines 177 to 178 in 31dc91e
and these 2 lines: inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp Lines 199 to 200 in 31dc91e
Mode should be 2 for CBCS and 1 for CENC (0 for unencrypted which shouldn't happen) And of course for your CBCS stream you should be seeing log statements for both audio and video stream IDs e.g 1001, 1004... something like that. I haven't actually compiled and tested myself but it should be right |
ISP Stream CBCS:inputstream.adaptive: Decrypting sample 177178 - Stream Id: 1001, mode: 2, crypt blocks: 1, skip blocks: 9 Opening stream: 1001 source: 256 Creating video codec with codec id: 27 ISP Stream CENC:inputstream.adaptive: Decrypting sample 177178 - Stream Id: 1001, mode: 1, crypt blocks: 0, skip blocks: 0 Opening stream: 1001 source: 256 Creating video codec with codec id: 27 Test Axinom Stream CBCS:AddOnLog: inputstream.adaptive: Decrypting sample 177178 - Stream Id: 1001, mode: 2, crypt blocks: 1, skip blocks: 9 Opening stream: 1001 source: 256 Creating video codec with codec id: 27 Test Axinom Stream CENC:inputstream.adaptive: Decrypting sample 177178 - Stream Id: 1001, mode: 1, crypt blocks: 0, skip blocks: 0 Opening stream: 1001 source: 256 Creating video codec with codec id: 27 Both my ISP and Axinom test CBCS stream seems to be skipping the audio track decryption. On the CBCS streams I only see stream 1001 and it's not showing any logs for line 199/200, when I place the debug log on line 175 the audio track shows up as "Stream Id: 1002, mode: 0, crypt blocks: 0, skip blocks: 0" Perhaps you can try to open the Axinom stream on your Kodi to see if you have the same result, guess this will also make it alot easier for you to find the issue using that stream, guessing the issue is the same as my ISP stream. I made m3u files of the Axinom streams so you can easily open them as files in Kodi to test here: Thanks for helping. |
Ok thanks for all that info, very helpful! My usual Windows debugging trick of setting a sleep statement then attaching debugger and breaking afterwards isn't working atm, just crashes :/ inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp Lines 378 to 379 in 31dc91e
Even though the TRAF atom is there under the MOOF, it fails to get it So maybe a bug in bento4? @CastagnaIT have you had any luck recently with attaching debugger in Windows when widevine is involved? Otherwise maybe we have to look at setting up some test code to load a file in and try that way... |
unfurnately no way debugwith drm... inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp Lines 385 to 387 in 31dc91e
imo this happens on second part of Create method https://github.com/xbmc/Bento4/blob/1f295b8a7c2c20c6398032dcfbf398ddb68a3300/Source/C%2B%2B/Core/Ap4CommonEncryption.cpp#L2788-L2789 on video packet the saio/saiz/senc there are but on audio packet these atoms seem to be all missing |
its similar situation about your old issue: axiomatic-systems/Bento4#781 |
Yeah I can see that a workaround could be to create a senc atom. I'm not having much luck. I can create a senc atom but can't get the sample count populated. Otherwise I can create the data for the atom but can't get it to dynamic cast. Or, we ask bento4 to help with this case upstream. What do you think? |
senc atom just needs to be 16 bytes and added as child to traf and set traf as parent
|
i tested sample stream with shaka player that a/v works hoping to find some hint on sourcecode but without luck, |
I've opened an issue at bento4 axiomatic-systems/Bento4#944 |
Bug report
Describe the bug
Recently my live television provider switched from CENC to CBCS encryption, unfortunately after this the audio playback stopped working.
Expected Behavior
Working video and audio when opening the live stream.
Actual Behavior
Stream opens without audio/sound and the video sometimes seems to be buffering every x seconds probably due to the audio not getting decrypted and decoded properly.
Kodi does show the audio tracks when you open the audio settings in the player, but there is no sound on both the audio tracks.
Possible Fix
See if there is a way to fix or add support for CBCS audio if this is the issue and not a codec problem.
To Reproduce
The live streams seem to be limited/locked to my ip or hostname by my isp, so you sadly won't be able to open them if your isp does not match.
Debuglog, DASH and MPD
You can find debug logs, dash files and mpd files here:
https://github.com/trdum/cbcsinput
Your Environment
Tested operating systems:
Tested Kodi versions:
The text was updated successfully, but these errors were encountered: