[Libav-user] avcodec_open2 changed audio format in AVCodecContext
Allan Fox
afox at live.it
Mon May 16 03:06:36 CEST 2016
Hi,
I have a mkv file with DTS stream.
I need the input audio format to pass to swr_convert for target format
AV_SAMPLE_FMT_S16.
However, after calling avcodec_open2, AVCodecContext->sample_fmt changed
(incorrectly?)
Is this a bug?
----------------------------------------------------------------------------
---------------------
AVCodecContext* avAudioCodecCtx =
avFormatCtx->streams[audioStreamIndex]->codec;
AVSampleFormat f = avAudioCodecCtx->sample_fmt; // AV_SAMPLE_FMT_FLTP
avcodec_open2(avAudioCodecCtx, avAudioCodec, NULL);
AVSampleFormat f2 = avAudioCodecCtx->sample_fmt; // AV_SAMPLE_FMT_S32P
----------------------------------------------------------------------------
---------------------
avcodec_decode_audio4(avAudioCodecCtx, frame, &frameComplete, avPacket);
frame->format // contains AV_SAMPLE_FMT_FLTP
----------------------------------------------------------------------------
---------------------
ffprobe version N-79143-g8ff0f6a Copyright (c) 2007-2016 the FFmpeg
developers
built with gcc 5.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype
--enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug
--enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus
--enable-librtmp --enable-libschroedinger --enable-libsnappy
--enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg
--enable-lzma --enable-decklink --enable-zlib
libavutil 55. 19.100 / 55. 19.100
libavcodec 57. 30.100 / 57. 30.100
libavformat 57. 29.101 / 57. 29.101
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 40.102 / 6. 40.102
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Stream #0:1(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 768 kb/s
(default)
More information about the Libav-user
mailing list