question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VideoFrameDecoder fails decoding mp4

See original GitHub issue

Describe the bug Getting a video frame from an online resource fails for mp4 files, it works fine for .mov files.

Expected behavior

To Reproduce

  private val imageLoader = ImageLoader.Builder(binding.root.context)
        .componentRegistry {
            add(VideoFrameFileFetcher(binding.root.context))
            add(VideoFrameUriFetcher(binding.root.context))
            add(VideoFrameDecoder(binding.root.context))
        }
        .logger(DebugLogger(Log.VERBOSE))
        .build()

imageView.load("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4", imageLoader = imageLoader)

Logs/Screenshots

Failed - http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4 - java.lang.IllegalArgumentException
E/RealImageLoader: java.lang.IllegalArgumentException
        at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:173)
        at coil.fetch.VideoFrameUriFetcher.setDataSource(VideoFrameFetcher.kt:50)
        at coil.fetch.VideoFrameUriFetcher.setDataSource(VideoFrameFetcher.kt:35)
        at coil.fetch.VideoFrameFetcher.fetch$suspendImpl(VideoFrameFetcher.kt:72)
        at coil.fetch.VideoFrameFetcher.fetch(Unknown Source:0)
        at coil.intercept.EngineInterceptor$intercept$2.invokeSuspend(EngineInterceptor.kt:403)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

Version 1.2.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
colinrtwhitecommented, Apr 22, 2021

@alcere Figured out the issue. You can work-around it by removing VideoFrameUriFetcher like this (it’s safe to do so):

private val imageLoader = ImageLoader.Builder(binding.root.context)
        .componentRegistry {
            add(VideoFrameFileFetcher(binding.root.context))
            add(VideoFrameDecoder(binding.root.context))
        }
        .logger(DebugLogger(Log.VERBOSE))
        .build()

The issue will be fixed in an upcoming patch release.

0reactions
alcerecommented, Apr 22, 2021

Thanks for the quick reply!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Video frame ended with Exception · Issue #1236 · coil-kt/coil
Factory()) add(VideoFrameDecoder. ... Often this means BitmapFactory could not decode the image data read from the input source (e.g. ...
Read more >
Unable to decode mp4 video using A… - Apple Developer
It happens specifically on iPhone 11 Pro and iPhone XR. Have 1 second mp4 video. use copyNextSampleBuffer. check the status of assetReader; it...
Read more >
Decoding mp4/mkv using FFMPEG fails - Stack Overflow
I realize that I can probably fix this by converting files into a raw format first, but I would like to be able...
Read more >
VideoFrameDecoder
A Decoder that uses MediaMetadataRetriever to fetch and decode a frame from a video. Types Constructors Functions. Constructors.
Read more >
video decoding failed! : mp4, m4v, mp4 - krpano HTML5 Viewer
video decoding failed! had a video created and converted flv and DRM CONVERTER, also in flv, mp4 and m4v but still gives the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found