Ajay
Ajay

Reputation: 113

MediaCodec Encoding camera surface presentationTime not uniform

I am encoding raw video (1080p) from the camera preview using the MediaCodec class in asynchronous mode. I read the presentation time using the MediaCodec.BufferInfo.presentationTimeUs parameter.

void onOutputBufferAvailable (MediaCodec codec, int index, MediaCodec.BufferInfo info)

I have set the target FPS as 30, so I am expecting a frame every 33 millisecs. However, the presentation time is never uniform and jumps up and down. Has anyone faced similar issue?

See the graph below. It is a graph of time between two consecutive video frames' presentation time as received (Y-Axis) in micro seconds. X-Axis is samples.

Graph plot of video presentation time

Thank you,

Ajay

Upvotes: 1

Views: 421

Answers (1)

Ajay
Ajay

Reputation: 113

OpenGL rendering using the Graphika sample app from Google as reference gave much more smoother presentation timestamps.

Upvotes: 1

Related Questions