[FFmpeg-user] converting AV_SAMPLE_FMT_S16 to AV_SAMPLE_FMT_S16P

Sean sean at ispyconnect.com
Sat Oct 20 10:39:27 CEST 2012


Hello, would appreciate any help with this, not getting anywhere fast.

I'm updating my code from the older version of ffmpeg (53) to the newer
(54/55). Code that did work has now been deprecated or removed so i'm having
problems updating it.
Previously I could create a stereo MP3 file using a sample format called:

SAMPLE_FMT_S16

That matched up perfectly with my source stream. This has now been replaced
with

AV_SAMPLE_FMT_S16

Which works fine for mono recordings but when I try to create a stereo MP3
file it bugs out at avcodec_open2 with:

"Specified sample_fmt is not supported."

Through trial and error I've found that using

AV_SAMPLE_FMT_S16P

...is accepted by avcodec_open2 but when I get through and create the MP3
file the sound is very distorted - it sounds about 2 octaves lower than
usual with a massive hum in the background - here's an example recording:

http://hosting.ispyconnect.com/example.mp3

I've been that this is because I now need to manually deinterleave my byte
stream before calling:

avcodec_fill_audio_frame

How do I do that? I've tried using the swrescale library without success and
i've tried manually feeding in L/R data into avcodec_fill_audio_frame but
the results i'm getting are sounding exactly the same as without
interleaving.

I've posted a question to stack overflow with my attempts at coding if
anyone wants to answer through there:

http://stackoverflow.com/questions/12967730/how-do-i-create-a-stereo-mp3-fil
e-with-latest-version-of-ffmpeg

Thanks! Would really appreciate any help.

Sean




More information about the ffmpeg-user mailing list