[Libav-user] Trying to decode, filter and resample audio, but I get more samples than expected

Nicholas Stafie nstafie at protonmail.com
Mon Jun 27 23:31:30 CEST 2016


As the subject line says, I'm trying to decode, filter and resample audio. The resampled s16le output would then be used later on.

My problem is: the output I get contains the full song, correctly resampled, but it doesn't stop there and keeps outputting about a minute or so of extra frames. Those extra frames, when played back, sound like a sped up version of the song played in reverse.

Attached is a file with my code, and there will be a direct link to download an audio file for convenience, but this happened with any file I tried no matter the format: http://freepd.com/Electronic/Fall%20Falling.mp3

Compile the file with "gcc main.c -lavformat -lavcodec -lavutil -lavfilter -lswresample -o decoder" and run it like so "./decoder input-file.mp3 > output.bin", as it'll output the PCM frames it decodes to stdout.

This code is written with version 2.8.6 in mind, because that is what's available where I have to host this, but I've tried it on my machine with git version N-80780-gd693392 and I get the same result.

I've tried everything I could think of, but I'm not sure what I did wrong. Thanks in advance for any help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160627/f7f0d43a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.c
Type: text/x-csrc
Size: 9524 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160627/f7f0d43a/attachment.c>


More information about the Libav-user mailing list