[FFmpeg-trac] #4706(avformat:new): av_guess_codec ignores short_name, filename, and mime_type

FFmpeg trac at avcodec.org
Thu Jul 9 03:36:48 CEST 2015

#4706: av_guess_codec ignores short_name, filename, and mime_type
             Reporter:  andrewrk  |                     Type:  defect
               Status:  new       |                 Priority:  normal
            Component:  avformat  |                  Version:  git-master
             Keywords:            |               Blocked By:
             Blocking:            |  Reproduced by developer:  0
Analyzed by developer:  0         |
 Tested with current git master: a137e50ee54cd902c436d15463c6e621623cc9ad

 av_guess_codec ignores the short_name, filename, and mime_type parameters.
 Observe this test program:

 #include <stdio.h>
 #include <libavcodec/avcodec.h>
 #include <libavformat/avformat.h>

 int main(int argc, char **argv) {

     AVOutputFormat *oformat = av_guess_format(NULL, "test.ogg", NULL);
     enum AVCodecID codec_id = av_guess_codec(oformat, "flac", "test.flac",
     AVCodec *codec = avcodec_find_encoder(codec_id);
     fprintf(stderr, "%s\n", codec->name);

     return 0;

 It prints "libvorbis" when it should instead print "flac". The OGG
 container is capable of storing FLAC audio, and the "flac" short name
 should override the format name guessed with av_guess_format. I think even
 the filename and mime_type arguments of av_guess_codec, if supplied,
 should override whatever was guessed from av_guess_format.

 The implementation of av_guess_codec is completely ignoring these

Ticket URL: <https://trac.ffmpeg.org/ticket/4706>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list