[Libav-user] problem while using swresample library

Stefano Sabatini stefasab at gmail.com
Tue Dec 4 11:14:59 CET 2012


On date Monday 2012-12-03 17:52:57 +0200, Rafi Fisher encoded:
> hello
> 
>   i'm using *swresample lib*. my code is used to convert mp2 or mp4 into
> wav file.
>   the code fragment :
>     .......
> 
>     SwrContext *swr = swr_alloc();
>     ret = av_opt_set_int(swr, "in_channel_layout",  AV_CH_LAYOUT_STEREO, 0);
>     ret = av_opt_set_int(swr, "out_channel_layout",  AV_CH_LAYOUT_MONO,
>  0);
>     ret = av_opt_set_int(swr, "in_sample_rate",     IN_SAMPLE_RATE,      0);
>     ret = av_opt_set_int(swr, "out_sample_rate",   OUT_SAMPLE_RATE,     0);
>     ret = av_opt_set_int(swr, "in_sample_fmt",      AV_SAMPLE_FMT_S16,   0);
>     ret = av_opt_set_int(swr, "out_sample_fmt",     AV_SAMPLE_FMT_S16,   0);
>     ret = swr_init(swr);
> 
>     .......
> 
>     out_samples = swr_convert(swr, output, out_samples,(const uint8_t **)
> (inframe->data), in_samples);
>     if out_channel_layout = AV_CH_LAYOUT_ STEREO resampling works fine
> 
>     if out_channel_layout = AV_CH_LAYOUT_MONO  & other set options remain
> same it fails that is:
> 

>     the swr_convert fails that is somwhere inside the code of this function
> there is a call to* exit* which is  problematic by itself (exit a program from av. library)
> instead of returning some error code.
> 

There is no call to exit() in libswresample, it seems more likely like
a crash. Make sure that you correctly allocated the samples buffers.

Also check my recently posted resampling example:
http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/155151

>         help will be appreciated thanks rafi
-- 
FFmpeg = Forgiving and Fostering Mega Puristic Explosive Genius


More information about the Libav-user mailing list