[Libav-user] FFmpeg + OpenAL - playback streaming sound from video won't work

Jan Drabner jan at jdrabner.eu
Tue Jan 28 11:11:21 CET 2014

I made some further progress by setting the OpenAL format to 
AL_FORMAT_STEREO_FLOAT32 instead of STEREO16. Makes sense, as the 
decoded frames are in FLTP format.
Also, I went back to not use swr_convert. It simply won't work and only 
crashes without any indication why. And FLTP seems to be the correct 
format already when openAL uses STEREO_FLOAT32.

At least now, the sound is played at the correct speed.
However, it is still very high pitched, so something is still very much 

Am 27.01.2014 22:09, schrieb Jan Drabner:
> Okay, I tried using swr_convert, but it always crashes when trying to 
> divide by 0.
> Basically, I have the same problem as those two guys:
> http://stackoverflow.com/questions/14448413/why-am-i-getting-fpe-when-using-swresample-1-1
> and
> https://ffmpeg.org/trac/ffmpeg/ticket/1834
> However, I DO call swr_init() and there is no error whatsoever.
> And it never reaches the point in swr_init() where context->postin 
> would be set so it HAS to crash there.
> Here is the code I use to init and to the swr_convert:
> // Init context
> SwrContext* swrContext = swr_alloc_set_opts(NULL,
>                 audioCodecContext->channel_layout, AV_SAMPLE_FMT_S16P, 
> audioCodecContext->sample_rate,
>                 audioCodecContext->channel_layout, 
> audioCodecContext->sample_fmt, audioCodecContext->sample_rate,
>                 0, NULL);
> int result = swr_init(swrContext);
> // Conversion
> int outputSamples = swr_convert(swrContext,
>                                         &p_destBuffer, 2048,
>                                         (const 
> uint8_t**)p_frame->extended_data, p_frame->nb_samples);
> As I said, I receive no errors, but the crash when FFmpeg tries to 
> divide by 0 inside |swri_realloc_audio|.
> What am I doing wrong?
> Am 27.01.2014 20:46, schrieb Jan Drabner:
>> Well. I don't.
>> I was assuming that decode_audio4(...) was already giving output in 
>> that format. I mean, after decoding, the data has to be in SOME 
>> format, so I assumed it was a standard format. Possibly a bit naive 
>> on my part.
>> But then again, not a single sample with FFmpeg & OpenAL I found was 
>> using aresample, so this is the first time I actually hear of it.
>> I will try using it now and see how well that goes.
>> Am 27.01.2014 20:36, schrieb Carl Eugen Hoyos:
>>> Jan Drabner <jan at ...> writes:
>>>> However, I cannot get the sound to play at all with OpenAL.
>>> Where do you call libswresample or aresample to convert
>>> Carl Eugen
>>> _______________________________________________
>>> Libav-user mailing list
>>> Libav-user at ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/libav-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20140128/9c8b4cab/attachment.html>

More information about the Libav-user mailing list