[Libav-user] How to correctly split AVFrame with audio samples on encoding
nicolas.george at normalesup.org
Thu Nov 15 13:18:17 CET 2012
Le quintidi 25 brumaire, an CCXXI, hatred a écrit :
> It provides AVFrame's with nb_samples = 1152, but when I open output codec
> it have frame_size = 576 and when I encode audio frame I take error message:
> more samples than frame size (avcodec_encode_audio2)
> I think that I must split one AVFrame into two or more and encode this
> resulting frames. Is it valid way? Do I must do it manualy with
Yes. This is clumsy but currently unavoidable. A simpler API was suggested
at some point, but no one did anything for it.
You could use a filter to do the work, but it would probably be overkill.
> How I can recalculate PTS for resulting frames?
A simple extrapolation based on the sample rate versus time base, using
av_rescale_q. If the time base is the same as the sample rate, it is even
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: Digital signature
More information about the Libav-user