TheWidlarzGroup / react-native-video

A <Video /> component for react-native
https://docs.thewidlarzgroup.com/react-native-video/
MIT License
7.2k stars 2.9k forks source link

[BUG]: Error in mkv videos "errorCode": "24001" #4161

Closed himanshu8443 closed 1 month ago

himanshu8443 commented 2 months ago

Version

6.5.0

What platforms are you having the problem on?

Android

System Version

14

On what device are you experiencing the issue?

Real device

Architecture

Old architecture

What happened?

Getting error in some mkv files

{"errorCode": "24001", "errorException": "androidx.media3.exoplayer.ExoPlaybackException: MediaCodecAudioRenderer error, index=1, format=Format(2, Hindi - NimitMak SilverRG, null, audio/mpeg-L2, null, -1, hi, [-1, -1, -1.0, null], [2, 48000]), format_supported=NO_UNSUPPORTED_TYPE", "errorStackTrace": "androidx.media3.exoplayer.ExoPlaybackException: MediaCodecAudioRenderer error, index=1, format=Format(2, Hindi - NimitMak SilverRG, null, audio/mpeg-L2, null, -1, hi, [-1, -1, -1.0, null], [2, 48000]), format_supported=NO_UNSUPPORTED_TYPE
        at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:623)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loopOnce(Looper.java:224)
        at android.os.Looper.loop(Looper.java:318)
        at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: androidx.media3.exoplayer.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: [-49999], Format(2, Hindi - NimitMak SilverRG, null, audio/mpeg-L2, null, -1, hi, [-1, -1, -1.0, null], [2, 48000])
        at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:1079)
        at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(MediaCodecRenderer.java:551)
        at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:1560)
        at androidx.media3.exoplayer.audio.MediaCodecAudioRenderer.onInputFormatChanged(MediaCodecAudioRenderer.java:517)
        at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.readSourceOmittingSampleData(MediaCodecRenderer.java:994)
        at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:814)
        at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1112)
        at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:544)
        ... 4 more
", "errorString": "ExoPlaybackException: ERROR_CODE_DECODER_INIT_FAILED"}

showing audio is unsupported but I tried in various other native players that use Exoplayer and the video is playing fine

Reproduction Link

No response

Reproduction

Try playing the sample URL and the player shows error

here is a sample video URL = https://pixeldra.in/api/file/bQb6RKk3?download,

github-actions[bot] commented 2 months ago

Thank you for your bug report. We will review it and get back to you if we need more information.

There is a newer version of the library available. You are using version 6.4.5, while the latest stable version is 6.5.0. Please update to the latest version and check if the issue still exists.

Note: If the issue still exists, please update the issue report with the latest information.

github-actions[bot] commented 2 months ago

Thank you for your bug report. We will review it and get back to you if we need more information.

seyedmostafahasani commented 1 month ago

@himanshu8443 I tested it with your URL, but I didn't see any errors in logcat. Could you please give me some clues about it?

himanshu8443 commented 1 month ago

@himanshu8443 I tested it with your URL, but I didn't see any errors in logcat. Could you please give me some clues about it?

Whenever I play this URL player closes and logs the above error. I don't know if it is a device-specific issue but I am also getting the same error in android emulator. Have you tried it in emulator? And also try changing the audio track

Properties
avd.ini.displayname      Pixel_3a_API_34_extension_level_7_x86_64
avd.ini.encoding         UTF-8
AvdId                    Pixel_3a_API_34_extension_level_7_x86_64
disk.dataPartition.size  6442450944
hw.accelerometer         yes
hw.arc                   false
hw.audioInput            yes
hw.battery               yes
hw.camera.back           emulated
hw.camera.front          emulated
hw.cpu.ncore             2
hw.device.hash2          MD5:0e6953ebf01bdc6b33a2f54746629c50
hw.device.manufacturer   Google
hw.device.name           pixel_3a
hw.dPad                  no
hw.gps                   yes
hw.gpu.enabled           yes
hw.gpu.mode              auto
hw.keyboard              yes
hw.lcd.density           440
hw.lcd.height            2220
hw.lcd.width             1080
hw.mainKeys              no
hw.ramSize               1536
hw.sdCard                yes
hw.sensors.orientation   yes
hw.sensors.proximity     yes
hw.trackBall             no
image.androidVersion.api 34
image.sysdir.1           system-images\android-34\google_apis\x86_64\
PlayStore.enabled        false
runtime.network.latency  none
runtime.network.speed    full
snapshot.present         no
tag.display              Google APIs
tag.id                   google_apis
vm.heapSize              256
seyedmostafahasani commented 1 month ago

I tested it on the emulator, and it works correctly.

freeboub commented 1 month ago

The answer is here : https://github.com/google/ExoPlayer/issues/6525 The mime type is audio/mpeg-L2 which is not mandatory on android device integration. The solution should be to build with ffmpeg (I never try)

himanshu8443 commented 1 month ago

ok, I can confirm when I tried playing it without using selectedAudioTrack property video played fine. The error only occurs on using onAudioTracks property and changing the audio track using selectedAudioTrack by default audio selected is index 1 (audio/mp4a-latm) changing to 'audio/mpeg-L2' causes error so just adding selectedAudioTrack={{ type: SelectedTrackType.INDEX, value: 0, }} in player properties should reproduce the issue

I tested in some other player that also claims to uses Exo Player it was playing fine that's why I thought its not Exo Player issue may be it is

freeboub commented 1 month ago

I reproduce the issue on an exoplayer sample (without ffmpeg). In fact in the sample, the track is grey because it is not supported. Here user cannot identify the track as unsupported. I will add a new flag to be able to track unsupported tracks. I really think the solution is to enable ffmpeg in exoplayer to be able to play this track...

mkbhdana commented 1 month ago

I reproduce the issue on an exoplayer sample (without ffmpeg). In fact in the sample, the track is grey because it is not supported. Here user cannot identify the track as unsupported. I will add a new flag to be able to track unsupported tracks. I really think the solution is to enable ffmpeg in exoplayer to be able to play this track...

yes ffmpeg is really needed to provide support on various devices. this is the only blocker i am facing currently.

freeboub commented 1 month ago

Let's follow up in: https://github.com/TheWidlarzGroup/react-native-video/issues/3106