[Libav-user] Converting from AV_SAMPLE_FMT_FLTP to AV_SAMPLE_FMT_FLT

Alexandru Rosca srosca at bu.edu
Sat Dec 7 22:57:02 CET 2013


Awesome, this is the answer I was looking for. I will try it out and reply
with the result.

Thanks


On Sun, Dec 8, 2013 at 2:52 AM, <fkwatson at aol.com> wrote:

>
> From: Taha Ansari <mtaha.ansari at gmail.com>
> To: This list is about using libavcodec, libavformat, libavutil,
> libavdevice
> and libavfilter. <libav-user at ffmpeg.org>
> Sent: Sat, Dec 7, 2013 6:00 am
> Subject: Re: [Libav-user] Converting from AV_SAMPLE_FMT_FLTP to
> AV_SAMPLE_FMT_FLT
>
>   On Fri, Dec 6, 2013 at 6:21 AM, Alexandru Rosca <srosca at bu.edu> wrote:
>
>> I am decoding audio and trying to convert it from the planar format to
>> just FLT (packed?). I am making a library which when used will return the
>> buffer with the data. I am using swr_convert but if I pass it
>> frame.extended_data, it crashes.
>>
>
>  Yes, swr_convert functions should be able to do this without any problem.
>
>
>>  If I just pass it frame.data[0] I get really crackly audio on the other
>> end. I suspect the problem is converting between these formats? Setting
>> request_sample_fmt to av_sample_flt doesnt work.
>>
>>
>  You might want to share some workable sample code, otherwise it is pure
> guessing.
>
>
>   >>>>>>>
>
>  I do not use sws_convert to do this because there is no real conversion
> necessary, just copying.   Since I have to copy data from frame.data[]
> anyway, I do a simple copy for non planar format. But with planar format,
> channel 1's samples are in frame.data[0] and channel 2's samples are in
> frame.data[1].  You just need to copy the 4-byte samples from the two
> buffers to your single output buffer interleaved, i.e., channel 1 - sample
> 0, channel 2 - sample 0, channel 1 - sample 1, channel 2 - sample 1, ...
>
>  -Felix
>
>
>
>  _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/libav-user
>>
>>
>   _______________________________________________
> Libav-user mailing listLibav-user at ffmpeg.orghttp://ffmpeg.org/mailman/listinfo/libav-user
>
>
> _______________________________________________
> 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/20131208/65723a52/attachment.html>


More information about the Libav-user mailing list