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
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.)