[Libav-user] How to correctly split AVFrame with audio samples on encoding

hatred adrozdoff at gmail.com
Thu Nov 15 05:51:09 CET 2012


Hi List,

I write live transcoder for our IP-cameras, in some cases audio straem also
need to transcoder.
But I have a problem with non-equal frame_size in input codec context and
output codec context:
1. I read audio packet
2. I decode it with avcodec_decode_audio4()
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
av_samples_copy? How I can recalculate PTS for resulting frames?

Thanks for answers.

PS output format is FLV with default video and audio codecs.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20121115/2a22c4a9/attachment.html>


More information about the Libav-user mailing list