[FFmpeg-cvslog] avconv: try to match codecs by codec descriptor name as a last resort.

Anton Khirnov git at videolan.org
Mon Aug 20 15:51:40 CEST 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Aug 11 15:40:12 2012 +0200| [db4766ad1b8389fc7f7213e435037cc883500077] | committer: Anton Khirnov

avconv: try to match codecs by codec descriptor name as a last resort.

This allows e.g. -c:v h264 to select the libx264 encoder.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=db4766ad1b8389fc7f7213e435037cc883500077
---

 avconv_opt.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/avconv_opt.c b/avconv_opt.c
index 97ae0a4..5c6fc87 100644
--- a/avconv_opt.c
+++ b/avconv_opt.c
@@ -381,12 +381,22 @@ static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFor
 
 static AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder)
 {
+    const AVCodecDescriptor *desc;
     const char *codec_string = encoder ? "encoder" : "decoder";
     AVCodec *codec;
 
     codec = encoder ?
         avcodec_find_encoder_by_name(name) :
         avcodec_find_decoder_by_name(name);
+
+    if (!codec && (desc = avcodec_descriptor_get_by_name(name))) {
+        codec = encoder ? avcodec_find_encoder(desc->id) :
+                          avcodec_find_decoder(desc->id);
+        if (codec)
+            av_log(NULL, AV_LOG_VERBOSE, "Matched %s '%s' for codec '%s'.\n",
+                   codec_string, codec->name, desc->name);
+    }
+
     if (!codec) {
         av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name);
         exit_program(1);



More information about the ffmpeg-cvslog mailing list