The behavior of MediaCodec
encoders was changed in Android 4.3 to accommodate the introduction of the MediaMuxer
class. In Android 4.3, you will always receive INFO_OUTPUT_FORMAT_CHANGED
from the encoder. In previous releases, you will not. (I've updated the relevant FAQ entry.)
There is no way to query the encoder for the MediaFormat
.
I haven't used an ffmpeg-based muxer, so I'm not sure what information it needs. If it's looking for the csd-0 / csd-1 keys, you can extract those from the CODEC_CONFIG
packet (I think you have to parse the SPS / PPS values out and place them in the separate keys). Examining the contents of the MediaFormat
on a 4.3 device will show you which fields you're lacking.