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.
This commit is contained in:
parent
f617135bc9
commit
db4766ad1b
10
avconv_opt.c
10
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);
|
||||
|
Loading…
Reference in New Issue
Block a user