[Libav-user] Can't read audio from file
mark at kitfox.com
Sat May 11 17:25:47 EEST 2019
Nevermind. The audio data is being read correctly - I was confused by
how my program was handling the
SUBJECT: [Libav-user] Can't read
audio from file
DATE: Sat, 11 May 2019 08:00:25 -0400
FROM: Mark McKay
TO: "This list is about using libavcodec, libavformat, libavutil,
libavdevice and libavfilter."
REPLY-TO: "This list is about using
libavcodec, libavformat, libavutil, libavdevice and libavfilter."
trying to decode the audio track from an mp4 file that can play audio in
other media players. However, when I look at the audio in the frame that
I decode, it's all set to 0 (or sometimes -0. The format type is
I've been using decode_audio.c to help guild me in
writing the code. My packet decoding looks like:
int err =
if (err < 0)
err = avcodec_receive_frame(aCodecCtx, aFrame);
if (err ==
AVERROR(EAGAIN) || err == AVERROR_EOF)
if (err < 0)
qDebug() nb_samples; i++)
for (int ch = 0; ch < aCodecCtx->channels;
float val = 0;
uint8_t *byteBuffer =
float* buffer = (float *)byteBuffer;
_audioBuffer.write((const char *)&val,
Basically I'm trying to write the audio data as a
series of floats to an output file. I'm not getting any error codes, but
the data is all 0 or values with small exponents.
The nm_samples is
1024, the data format is AV_SAMPLE_FMT_FLTP and there are 2 channels. Is
there something I'm doing wrong here?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libav-user