[Libav-user] resampling audio and then encoding

Przemysław Sobala przemyslaw.sobala at gmail.com
Fri Apr 29 14:29:12 CEST 2016


W dniu 28.04.2016 o 19:44, Andrey Utkin pisze:
> On Thu, Apr 28, 2016 at 02:09:21PM +0000, JULIAN GARDNER wrote:
>> Ok added the code from filtering_audio.c to create a filterchain, changed my code to take the decoded frames and push into the filter.
>> filt_frame is returned and this is pushed into the avcodec_encode_audio2 and guess what error i get
>>
>> [mp2 @ xxxxxxxxxxx] nb_samples (1024) != frame_size (1152) (avencode_encoder_audio2)
>> So question one, How do i fix this
> Append this filter to your filtering string, with proper parameter.
> http://ffmpeg.org/ffmpeg-filters.html#asetnsamples
>

You can also use a buffersink method av_buffersink_set_frame_size and 
pass AVCodecContext->frame_size as a second parameter (be aware that 
this field is set in avcodec_open2 method so you have to invoke this 
earlier).
--
Regards
Przemysław Sobala


More information about the Libav-user mailing list