[FFmpeg-trac] #10822(avformat:new): av_stream_find_info fails for aac file if aac decoder is not enabled

FFmpeg trac at avcodec.org
Thu Jan 25 15:42:10 EET 2024


#10822: av_stream_find_info fails for aac file if aac decoder is not enabled
-------------------------------------+-------------------------------------
             Reporter:  gamlegaz     |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  avformat     |                  Version:
             Keywords:  demuxer      |  unspecified
  Audio                              |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:

 If aac demuxing doesn't work without enabling an aac decoder please feel
 free to close this!

 Building FFmpeg at tot (0a5813fc6814bba2326e4f172151b2ca1f24a830) with
 --disable-decoders or --disable-decoder=aac and trying to demux doesn't
 work.

 avformat_find_stream_info on the AVFormatContext yields
 {{{
 [aac @ 0x134204a10] Could not find codec parameters for stream 0 (Audio:
 aac, 0 channels): unspecified sample rate
 Consider increasing the value for the 'analyzeduration' (0) and
 'probesize' (5000000) options
 }}}

 Changing the analyzeduration and probesize to (way) larger values doesn't
 help, I've also tried a few different aac files.

 Compiling with the aac decoder enabled this works fine.


 I build using
 {{{
 ffmpeg:
         cd ../dependencies/ffmpeg && \
         git reset --hard && make -k clean && \
         ./configure \
                 --prefix="$(BUILD_PATH)" \
                 $(FFMPEG_COMMON_ARGS) \
                 --disable-all \
                 --enable-avcodec \
                 --enable-avformat \
                 --enable-avutil \
                 --disable-decoders \
                 --disable-demuxers \
                 --disable-encoders \
                 --disable-muxers \
                 --disable-iconv \
                 --disable-zlib \
                 --enable-protocol=file \
                 --enable-demuxer=aac \
                 && \
         make -j8 && \
         make install
 }}}

 and with the minimal reproduction:
 {{{
 #include <libavformat/avformat.h>
 #include <libavutil/opt.h>

 int main()
 {
     int ret = 0;
     AVFormatContext *fmt_ctx = avformat_alloc_context();
     if (!fmt_ctx)
     {
         printf("Failed to allocate fmt_ctx\n");
         return 1;
     }
     const char *filename = "file:home_short.aac";
     ret = avformat_open_input(&fmt_ctx, filename, NULL, NULL);
     if (ret < 0) {
         printf("Failed to open input %s\n", av_err2str(ret));
         return 1;
     }

     ret = avformat_find_stream_info(fmt_ctx, NULL);
     if (ret < 0) {
         printf("Failed to find stream information: %s\n",
 av_err2str(ret));
         return 1;
     }

     int audio_stream_idx = av_find_best_stream(fmt_ctx,
 AVMEDIA_TYPE_AUDIO, -1, -1, NULL, 0);
     printf("File read, audio stream: %d %s\n", audio_stream_idx,
 av_err2str(audio_stream_idx));
     return 0;
 }
 }}}

 mediainfo for sample audio;

 {{{
 Complete name                            : videos/sample4.aac
 Format                                   : ADTS
 Format/Info                              : Audio Data Transport Stream
 File size                                : 3.87 MiB
 Overall bit rate mode                    : Variable

 Audio
 Format                                   : AAC LC
 Format/Info                              : Advanced Audio Codec Low
 Complexity
 Format version                           : Version 4
 Codec ID                                 : 2
 Bit rate mode                            : Variable
 Channel(s)                               : 2 channels
 Channel layout                           : L R
 Sampling rate                            : 44.1 kHz
 Frame rate                               : 43.066 FPS (1024 SPF)
 Compression mode                         : Lossy
 Stream size                              : 3.87 MiB (100%)
 }}}
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/10822>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list