[Libav-user] Extracting samples from audio file
philippe.gorley at savoirfairelinux.com
Tue Aug 15 22:58:23 EEST 2017
On 2017-08-10 01:17 PM, salsaman wrote:
> Correct, you would first create the swr_context then use it to convert
> the data.
> Libav-user mailing list
> Libav-user at ffmpeg.org
I'm still struggling with getting this to work. My code is here:
The commented out code at the bottom is the old Sndfile code, which I'd
like to replace using FFmpeg. What it does is read all the audio samples
into an array of int16_t. NB: Sndfile calls them frames, while FFmpeg
calls them samples.
Right now, my code gives me low volume static.
I'm setting up the decoding pipeline, it (seems to, at least) works. I'm
getting the same number of samples as Sndfile does. I'm guessing the
problem lies with the resampling code.
I'm calling swr_config_frame and swr_convert_frame for each decoded
frame, loop through the output frame's extended_data and append those
samples to an std::vector.
AudioSample is an alias for int16_t.
AudioBuffer is a container with an std::vector<std::vector<AudioSample>>
(one for each channel).
AudioFormat is a POD struct with the sample rate and number of channels.
Can anyone look at this and tell me what I'm doing wrong?
Free Software Consultant | Montréal, Qc
Confidentiality Message: This communication (including any files
transmitted with it) is intended solely for the person or entity to
whom it is addressed, and may contain confidential or privileged
The disclosure, distribution or copying of this message is strictly
forbidden. Should you have received this communication in error,
kindly contact the sender promptly, destroy any copies and delete
this message from your computer system.
More information about the Libav-user