简体   繁体   中英

Can't play video H.264 on Android with Android Exoplayer react-native-video

The error code when video load error

{"error": {"errorException": "com.google.android.exoplayer2.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(1, null, null, video/avc, avc1.640034, -1, null, [2160, 3840, 24.000002], [-1, -1]), format_supported=NO_EXCEEDS_CAPABILITIES", "errorString": "ExoPlaybackException type : 1"}}

Currently I'm using this version and building on real Android device

react-native: 0.64

react-native-video: ^5.2.0-alpha1

This is h.264 video example: https://lifebeligum.s3.ap-southeast-1.amazonaws.com/documents/2021-10-04/ef07eb88-1e53-4800-b7cb-64e908a264c3.mp4

Does anyone have any idea for it?

The video linked is using the H.264 High profile - this is not one of the standard Android supported formats, although some devices may support it.

Currently Baseline and Main profile are listed as supported as standard. You can see the list here:

You can check the encoding profile using a tool like ffprobe:

ffprobe version N-95216-ge6625ca41f-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2007-2019 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.8)
  configuration: ......
  libavutil      56. 35.100 / 56. 35.100
  libavcodec     58. 59.101 / 58. 59.101
  libavformat    58. 33.100 / 58. 33.100
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 61.100 /  7. 61.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Desktop/ef07eb88-1e53-4800-b7cb-64e908a264c3.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41isomavc1
    creation_time   : 2020-07-07T20:03:53.000000Z
  Duration: 00:00:16.50, start: 0.000000, bitrate: 13565 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 2160x3840, 13562 kb/s, 24 fps, 24 tbr, 24 tbn, 48 tbc (default)
    Metadata:
      creation_time   : 2020-07-07T20:03:53.000000Z
      handler_name    : L-SMASH Video Handler
      encoder         : AVC Coding

You can re-encode your video with Main or Baseline and test to confirm or test with a video which you know meets the recommendation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM