user1592546
user1592546

Reputation: 1480

Determine video framerate and audio samplerate with mediacodec

I need to figure the following information about some videos I'm decoding with MediaCodec on android: - for audio: sample rate and number of channels; - for video: frame rate. I'm usually decoding h264+aac, but the solution should be extendable to other formats. How can this be achieved?

Upvotes: 1

Views: 1715

Answers (1)

darja
darja

Reputation: 5025

This can be done not with MediaCodec, but with MediaFormat instance:

format.getInteger(MediaFormat.KEY_SAMPLE_RATE);
format.getInteger(MediaFormat.KEY_CHANNEL_COUNT);

(see other keys in documentation)

Upvotes: 4

Related Questions