Android MediaMuxer failed to stop

后端 未结 1 359
无人共我
无人共我 2021-01-20 17:23

I am trying to use MediaCodec,MediaExtractor and MediaMuxer to generate mp4 file. EveryThing seems to work properly but when i call MediaMuxer.stop i\'m having an error . Th

相关标签:
1条回答
  • 2021-01-20 17:46

    Note the error:

    E/MPEG4Writer(11768): There are no sync frames for video track
    

    The muxed video output must begin with a sync frame (a/k/a key frame, a/k/a I-frame). If you start with a prediction frame, but nothing to predict from, the decoder won't have any idea what to do.

    Make sure you are passing all of the MediaCodec.BufferInfo values through to the MediaMuxer -- that's where the flags are. The sync frames will have the BUFFER_FLAG_SYNC_FRAME flag set.

    (Update: as of API 21, BUFFER_FLAG_SYNC_FRAME is deprecated in favor of BUFFER_FLAG_KEY_FRAME. Both symbols have the same integer value and same meaning; the change is just part of an effort to adopt consistent terminology in the API.)

    0 讨论(0)
提交回复
热议问题