Gabriel Bursztyn
Gabriel Bursztyn

Reputation: 666

sync audio and video with mediacodec and mediamuxer

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

Upvotes: 3

Views: 1465

Answers (1)

Gabriel Bursztyn
Gabriel Bursztyn

Reputation: 666

I have found the answer.

It depends on the sample rate and the frame rate:

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

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

hope it helps.

Upvotes: 4

Related Questions