[Libav-user] How do you encode raw pcm_f32le audio to AAC encoded audio with FFmpeg (C/C++)?

Suhail Doshi suhail at mightyapp.com
Tue Jan 21 18:16:15 EET 2020


On Tue, Jan 21 2020 at 5:28 AM, < ceffmpeg at gmail.com > wrote:

> 
> 
> 
> Am Di., 21. Jan. 2020 um 04:25 Uhr schrieb Suhail Doshi
> <suhail at mightyapp.com>:
> >
> 
> 
>> 
>> 
>> On Sun, Jan 19, 2020 at 4:28 PM Carl Eugen Hoyos <ceffmpeg at gmail.com>
>> wrote:
>> 
>> 
> 
> 
> 
> >>
> 
> 
>> 
>>> 
>>> 
>>> Am Mo., 20. Jan. 2020 um 01:22 Uhr schrieb Suhail Doshi
>>> <suhail at mightyapp.com>:
>>> 
>>> 
>> 
>> 
> 
> 
> 
> >>
> 
> 
>> 
>>> 
>>> 
>>> > Sure, do you know why ffmpeg cli seems to be able to encode interleaved
>>> > raw audio but the C API only allows FLTP then?
>>> 
>>> 
>> 
>> 
> 
> 
> 
> >>
> 
> 
>> 
>>> 
>>> 
>>> It (automatically) inserts the aresample filter into the filter chain.
>>> 
>>> 
>> 
>> 
> 
> 
> 
> >>
> 
> 
>> 
>>> 
>>> 
>>> Please find out what top-posting means and avoid it here, Carl Eugen
>>> 
>>> 
>> 
>> 
> 
> 
> 
> >
> >
> 
> 
>> 
>> 
>> Got it. So, I tried to resample my FLT audio into FLTP audio as well. I
>> got a bit stuck.
>> 
>> 
> 
> 
> 
> >
> 
> 
>> 
>> 
>> Here's my code:
>> https://gist.github.com/Suhail/151e41f3eb226504c7cbd3b46c15729c
>> (I didn't want to paste it here since it's long where I referenced this
>> code heavily.
>> 
>> 
> 
> 
> 
> >
> 
> 
>> 
>> 
>> What I do, as a test, is I read an entire PCM raw audio file into a buffer
>> and then send that to the encoder.
>> 
>> 
> 
> 
> 
> Why don't you use a wav file and read that with libavformat / did you test
> reading the pcm raw file with ffmpeg?
> 
> 
> 

Yes, I did this with the same file and it works as expected: ffmpeg -f f32le -ar 48000 -ac 2 -c:a pcm_f32le -i out.raw out.m4a -y

This is essentially what I am trying to write in C/C++ and then plan to make it work on streaming data.

> 
> 
> 
> 
> 
> 
> 
> Carl Eugen
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/libav-user
> 
> 
> 
> To unsubscribe, visit link above, or email
> libav-user-request at ffmpeg.org with subject "unsubscribe".
> 
> 
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20200121/5329522b/attachment.html>


More information about the Libav-user mailing list