diff options
author | Anton Khirnov <anton@khirnov.net> | 2014-04-29 17:23:49 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2014-05-18 20:33:46 +0200 |
commit | 6656370b858329ca07a60a2de954d5e90daa0206 (patch) | |
tree | f192c986f558afd36d42dc7b5b46f24fd429bbf9 /avconv.c | |
parent | d246231e4714119faac6c7acd881d3b687bb8b11 (diff) | |
download | ffmpeg-6656370b858329ca07a60a2de954d5e90daa0206.tar.gz |
avconv: set the "encoder" tag when transcoding
Diffstat (limited to 'avconv.c')
-rw-r--r-- | avconv.c | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -1638,6 +1638,34 @@ static void parse_forced_key_frames(char *kf, OutputStream *ost, } } +static void set_encoder_id(OutputFile *of, OutputStream *ost) +{ + AVDictionaryEntry *e; + + uint8_t *encoder_string; + int encoder_string_len; + int format_flags = 0; + + e = av_dict_get(of->opts, "fflags", NULL, 0); + if (e) { + const AVOption *o = av_opt_find(of->ctx, "fflags", NULL, 0, 0); + if (!o) + return; + av_opt_eval_flags(of->ctx, o, e->value, &format_flags); + } + + encoder_string_len = sizeof(LIBAVCODEC_IDENT) + strlen(ost->enc->name) + 2; + encoder_string = av_mallocz(encoder_string_len); + if (!encoder_string) + exit_program(1); + + if (!(format_flags & AVFMT_FLAG_BITEXACT)) + av_strlcpy(encoder_string, LIBAVCODEC_IDENT " ", encoder_string_len); + av_strlcat(encoder_string, ost->enc->name, encoder_string_len); + av_dict_set(&ost->st->metadata, "encoder", encoder_string, + AV_DICT_DONT_STRDUP_VAL | AV_DICT_DONT_OVERWRITE); +} + static int transcode_init(void) { int ret = 0, i, j, k; @@ -1786,6 +1814,8 @@ static int transcode_init(void) ist->decoding_needed = 1; ost->encoding_needed = 1; + set_encoder_id(output_files[ost->file_index], ost); + /* * We want CFR output if and only if one of those is true: * 1) user specified output framerate with -r |