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

Length mismatch issue with FMP4/CMAF content #7592

Closed
vip644 opened this issue Jul 4, 2020 · 13 comments
Closed

Length mismatch issue with FMP4/CMAF content #7592

vip644 opened this issue Jul 4, 2020 · 13 comments
Assignees
Labels

Comments

@vip644
Copy link

vip644 commented Jul 4, 2020

Issue description:

Hi,
I am trying to generate a fmp4 CMAF DRM with the CBCS protection scheme using bento4 and trying to play on android exoplayer.

Here is the command I am using to generate the dash manifest
mp4dash --profiles=on-demand --mpd-name manifest.mpd --encryption-cenc-scheme=cbcs --encryption-args=“--global-option mpeg-cenc.piff-compatible:true” --encryption-key=:: --widevine-header=provider:demo.ki#content_id:#protection_scheme:cbcs --hls --mpd-name=manifest.mpd --hls-master-playlist-name=manifest.m3u8 fragmented.mp4

example command i am using
mp4dash --mpd-name manifest.mpd --encryption-cenc-scheme=cbcs --encryption-args=“--global-option mpeg-cenc.piff-compatible:true” --encryption-key=8762c548e79c740f7b5d2f5f09f85929:aae2a539812edc302599f027c8689fad:00000000000000000000000000000000 --widevine-header=provider:demo.ki#content_id:8762c548e79c740f7b5d2f5f09f85929#protection_scheme:cbcs --hls --mpd-name=manifest.mpd --hls-master-playlist-name=manifest.m3u8 sintel-1024-surround.mp4
The content works on Chrome using shakaplayer.

There is already an existing closed bug on the bento4 issues page regarding the same issue
axiomatic-systems/Bento4#428 where it looks like it is an issue with exoplayer.
Is there any workaround for this?

Stack-trace:

2020-07-03 16:54:54.708 3562-3603/com.vipin.exokotlin E/ExoPlayerImplInternal: Source error
      com.google.android.exoplayer2.ParserException: Length mismatch: 0, 1285
        at com.google.android.exoplayer2.extractor.mp4.FragmentedMp4Extractor.parseSaiz(FragmentedMp4Extractor.java:802)
        at com.google.android.exoplayer2.extractor.mp4.FragmentedMp4Extractor.parseTraf(FragmentedMp4Extractor.java:725)
        at com.google.android.exoplayer2.extractor.mp4.FragmentedMp4Extractor.parseMoof(FragmentedMp4Extractor.java:693)
        at com.google.android.exoplayer2.extractor.mp4.FragmentedMp4Extractor.onMoofContainerAtomRead(FragmentedMp4Extractor.java:542)
        at com.google.android.exoplayer2.extractor.mp4.FragmentedMp4Extractor.onContainerAtomRead(FragmentedMp4Extractor.java:456)
        at com.google.android.exoplayer2.extractor.mp4.FragmentedMp4Extractor.processAtomEnded(FragmentedMp4Extractor.java:434)
        at com.google.android.exoplayer2.extractor.mp4.FragmentedMp4Extractor.readAtomPayload(FragmentedMp4Extractor.java:429)
        at com.google.android.exoplayer2.extractor.mp4.FragmentedMp4Extractor.read(FragmentedMp4Extractor.java:315)
        at com.google.android.exoplayer2.source.chunk.ContainerMediaChunk.load(ContainerMediaChunk.java:135)
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:415)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)

Version of ExoPlayer: 2.11.7

Device: Google Pixel 3
Version: Android 9

@ojw28
Copy link
Contributor

ojw28 commented Jul 5, 2020

Looks like any sampleCount for which sampleCount <= out.sampleCount would be valid according to the spec, but we currently only handle sampleCount == out.sampleCount in parseSaiz.

It's probably worth looking at parseSenc at the same time, which has a similar check. I think what's valid is different for that box though. Possibly sampleCount == out.sampleCount || sampleCount == 0.

Over to @kim-vde who's been looking at FMP4 parsing.

@kim-vde
Copy link
Contributor

kim-vde commented Jul 7, 2020

Could you provide a test content so that I can test? If you're unable to share it publicly, please send it to dev.exoplayer@gmail.com using a subject in the format "Issue #7592". Please also update this issue to indicate you’ve done this.

@vip644
Copy link
Author

vip644 commented Jul 8, 2020

I've sent you a mail regarding test content on dev.exoplayer@gmail.com with all the information related to it.

@kim-vde
Copy link
Contributor

kim-vde commented Jul 8, 2020

Can you also send the DRM license URL (as in the demo app samples)?

@vip644
Copy link
Author

vip644 commented Jul 9, 2020

Please check your mail box, I've sent the DRM license URL.

@kim-vde
Copy link
Contributor

kim-vde commented Jul 9, 2020

I don't have the length mismatch error with the fix I implemented but I have a DRM error. I seems there is something wrong with the response.

2020-07-09 09:06:57.688 29903-30149/com.google.android.exoplayer2.demo E/ExoPlayerImplInternal: Playback error
      com.google.android.exoplayer2.ExoPlaybackException: Source error
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:487)
        at android.os.Handler.dispatchMessage(Handler.java:103)
        at android.os.Looper.loop(Looper.java:214)
        at android.os.HandlerThread.run(HandlerThread.java:67)
     Caused by: com.google.android.exoplayer2.drm.DrmSession$DrmSessionException: java.lang.IllegalArgumentException: Failed to handle key response
        at com.google.android.exoplayer2.drm.DefaultDrmSession.onError(DefaultDrmSession.java:514)
        at com.google.android.exoplayer2.drm.DefaultDrmSession.onKeysError(DefaultDrmSession.java:509)
        at com.google.android.exoplayer2.drm.DefaultDrmSession.onKeyResponse(DefaultDrmSession.java:494)
        at com.google.android.exoplayer2.drm.DefaultDrmSession.access$100(DefaultDrmSession.java:54)
        at com.google.android.exoplayer2.drm.DefaultDrmSession$ResponseHandler.handleMessage(DefaultDrmSession.java:553)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:214) 
        at android.os.HandlerThread.run(HandlerThread.java:67) 
     Caused by: java.lang.IllegalArgumentException: Failed to handle key response
        at android.media.MediaDrm.provideKeyResponse(Native Method)
        at com.google.android.exoplayer2.drm.FrameworkMediaDrm.provideKeyResponse(FrameworkMediaDrm.java:216)
        at com.google.android.exoplayer2.drm.DefaultDrmSession.onKeyResponse(DefaultDrmSession.java:482)
        at com.google.android.exoplayer2.drm.DefaultDrmSession.access$100(DefaultDrmSession.java:54) 
        at com.google.android.exoplayer2.drm.DefaultDrmSession$ResponseHandler.handleMessage(DefaultDrmSession.java:553) 
        at android.os.Handler.dispatchMessage(Handler.java:107) 
        at android.os.Looper.loop(Looper.java:214) 
        at android.os.HandlerThread.run(HandlerThread.java:67) 

@vip644
Copy link
Author

vip644 commented Jul 9, 2020

Wait let me check the issue with the DRM, seems there some key mismatch. If this doesn't work then I'll provide you another content url.

@vip644
Copy link
Author

vip644 commented Jul 9, 2020

I've shared another Content url with license url which is giving me length mismatch error. Please check your mailbox.

@kim-vde
Copy link
Contributor

kim-vde commented Jul 9, 2020

I can't access the manifest URL.

Caused by: com.google.android.exoplayer2.ext.cronet.CronetDataSource$OpenException: eq: Exception in CronetUrlRequest: net::ERR_CERT_AUTHORITY_INVALID, ErrorCode=11, InternalErrorCode=-202, Retryable=false

@vip644
Copy link
Author

vip644 commented Jul 9, 2020

You're getting ERR_CERT_AUTHORITY_INVALID because of the given IP Address doesn't contain any certificate over https. In this case please try to accept the self-signed certificate for the given IP Address.

kim-vde added a commit that referenced this issue Jul 10, 2020
Issue: #7592
PiperOrigin-RevId: 320556981
@kim-vde
Copy link
Contributor

kim-vde commented Jul 10, 2020

I just pushed a fix on the dev-2 branch. Can you try it and tell me if you still have issues?

@vip644
Copy link
Author

vip644 commented Jul 15, 2020

Issue has been fixed on the dev-2 branch. Now I'm not getting any issue regarding length mismatch.

@kim-vde
Copy link
Contributor

kim-vde commented Jul 15, 2020

I'll close the issue then. Feel free to open another one if you encounter other problems.

@kim-vde kim-vde closed this as completed Jul 15, 2020
ojw28 pushed a commit that referenced this issue Aug 19, 2020
Issue: #7592
PiperOrigin-RevId: 320556981
zxzx74147 pushed a commit to zxzx74147/ExoPlayer that referenced this issue Sep 7, 2020
@google google locked and limited conversation to collaborators Sep 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants