简体   繁体   English

Android MediaCodec编码丢帧

[英]android mediacodec encode drop frame

hi,I try to use Android MediaCodec to encode. 您好,我尝试使用Android MediaCodec进行编码。 I follow the code of "grafika", but I find the encode video drop some frames. 我遵循“ grafika”的代码,但是我发现编码视频掉了一些帧。 I check my input, every frame is different from each other, but in my encode output video, for example, frame 71 is same to frame 72, frame 99 is same to frame 100. the other frame is same to the input sequence. 我检查我的输入,每个帧都互不相同,但是在我编码的输出视频中,例如,帧71与帧72相同,帧99与帧100相同,其他帧与输入序列相同。

I use OpenGL ES, and use surface in encode. 我使用OpenGL ES,并在编码中使用Surface。 My frame rate is 30, bitrate is 1920*1080*30, and Iframe intervel is 1s. 我的帧速率是30,比特率是1920 * 1080 * 30,而iframe间隔是1s。

Anything wrong with mediacodec encode? Mediacodec编码有什么问题吗?

If you are sending your frames to the encoder via a Surface, you may need to pass along (separately) the correct presentation times for each frame as the encoder may not get the right presentation times. 如果要通过Surface将帧发送到编码器,则可能需要(分别)传递每个帧的正确显示时间,因为编码器可能无法获得正确的显示时间。 In other words, after you pull an output buffer from the MediaCodec, you may want to correct the value of presentationTimeUs for the output buffer info. 换句话说,从MediaCodec中提取输出缓冲区后,您可能需要更正输出缓冲区信息的presentationTimeUs的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM