[Libav-user] Grab audio samples with ffmpeg and C, error with official example code

Paul B Mahol onemda at gmail.com
Sun Aug 30 19:17:56 EEST 2020


On 8/29/20, nji9 at arcor.de <nji9 at arcor.de> wrote:
> For dev I'm using v. 4.3.1. and also the latest Git version of ffmpeg
> (Zeranoe's Windows 64 builds).
>
> I get "strange" problems when running the official example code for decoding
> audio
>
> https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/decode_audio.c
>
> MP3DirectCut(Lib-bass).mp3
>
> http://www.mediafire.com/file/ozmjjcpwyhhdnr7/MP3DirectCut(Lib-bass).mp3/file
>
> Generates pcm, but outputs:
>
> "Warning: the sample format the decoder produced is planar (s16p).
> This example will output the first channel only."
>
> But the output pcm has both channels!??
>
> When recoding the above mp3 to wav with ffmpeg (4.1.4, no error message)
>
> http://www.mediafire.com/file/gcq7ryg43pd57q5/ffmpeg4.1.4.wav/file
>
> and also when recoding the latter to mp3 again
>
> http://www.mediafire.com/file/ij865dkrprn2lta/ffmpeg4.1.4_recode.mp3/file
>
> the example code breaks and produces these error messages ("mp2 @ ..." also
> for the wav file):
>
> avcodec_send_packet ()
> from within:
> "[mp2 @ <someAddress>] Header missing"
> and returns error code -1094995529
> (= "Invalid data found when processing input")
>
> It produces that error message for literally all other formats I tried, and
> also when written with another editor (Audition 3.0).
> But all the files play and show fine on all programs I have.
>
> I'm at a lost at this point. What is going on and wrong here?

Just because decode_audio does not skip ID3 metadata from start of
later mp3 file.
That is reasonably as program is just demonstration and not full blown solution.

>
> _______________________________________________
> 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".


More information about the Libav-user mailing list