[FFmpeg-devel] Devel question : how to calculate frame_size in audio encoder (adpcm_encode_init)
Wed Oct 3 22:42:03 CEST 2007
2007/10/4, Tom Van Braeckel <tomvanbraeckel at gmail.com>:
> 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.
I (as member of thosse project) want to add several words to info below.
> 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 =
> But this doesn't work because avctx->time_base = 1/22050 instead of 1/16 (if
> the video is 16 fps).
Actually, exact working (but, imho, hackish) string (in our
amv_write_header routine) is:
Audio and video frames in AMV files should be interleaved on-by-one.
We can archive this only by setting audio frame_size using video frame
(along with proper interleaving routine) to ensure that each video
frame will corresponds
one audio frame.
> - Second question is how we should correctly access the frame rate from
> adpcm.c (in libavcodec) ?
Video frame rate from audio codec or more clean solution exists except
setting audio frame_size in audio encoder init routine?
Vladimir Voroshilov mailto:voroshil at gmail.com
JID: voroshil at gmail.com, voroshil at jabber.ru
More information about the ffmpeg-devel