diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-08-11 15:40:12 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-08-19 19:08:48 +0200 |
commit | db4766ad1b8389fc7f7213e435037cc883500077 (patch) | |
tree | df5098e1160eb6637118ea5c863465724d6ce0e0 /avconv_opt.c | |
parent | f617135bc94df0eff6bc5228f6a6430ce160162a (diff) | |
download | ffmpeg-db4766ad1b8389fc7f7213e435037cc883500077.tar.gz |
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.
Diffstat (limited to 'avconv_opt.c')
-rw-r--r-- | avconv_opt.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/avconv_opt.c b/avconv_opt.c index 97ae0a4bf9..5c6fc8741f 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); |