本文介绍了使用mediacodec和mediamuxer同步音频和视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,如何同时提供音频数据和视频数据发送到MediaMux ,它说,要同步音频和视频,您必须计算每个视频帧应播放的音频样本的数量",公式将如何?你能给我一些例子吗?如果我从视频汲取编码器功能上的AudioRecord读取音频数据怎么办?谢谢

Hi in How to provide both audio data and video data to MediaMux it says that in order to sync audio and video you have to "calculate the number of audio samples that should play for each frame of video", how would be the formula? could you give me some examples? What if I read audio data from AudioRecord on video drainEncoder function?thanks

推荐答案

我找到了答案.

这取决于采样率和帧频:

It depends on the sample rate and the frame rate:

24fps和48000Hz时每帧很长(48000hz/24fps)= 2000个样本

at 24fps and 48000Hz every frame is long (48000hz/24fps)= 2000 sample

在25 fps和48000Hz时:(48000hz/25fps)= 1920采样

at 25 fps and 48000Hz: (48000hz/25fps)= 1920 sample

希望有帮助.

这篇关于使用mediacodec和mediamuxer同步音频和视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-18 23:33