[FFmpeg-devel] Devel question : how to calculate frame_size in audio encoder (adpcm_encode_init)

Tom Van Braeckel tomvanbraeckel
Wed Oct 3 22:26:06 CEST 2007


Hi guys, we (at amv-codec-tools) are working on the adpcm_ima_amv encoder
for the AMV format but have a question on how to access the video frame rate
from the audio encoder.. or how to set the frame_size correctly.

We should calculate the audio frame_size by calculating sample_rate /
frame_rate right ?

- First of all, is adpcm_encode_init the right place to calculate the number
of samples (frame_size) ?
Our code looks like this:
case CODEC_ID_ADPCM_IMA_AMV:
avctx->frame_size =
av_rescale(avctx->sample_rate,avctx->time_base.num,avctx->time_base.den);
break;

But this doesn't work because avctx->time_base = 1/22050 instead of 1/16 (if
the video is 16 fps).

- Second question is how we should correctly  access the frame rate from
adpcm.c (in libavcodec) ?

Thx,

Tom.




More information about the ffmpeg-devel mailing list