Commit 6656370b authored by Anton Khirnov's avatar Anton Khirnov

avconv: set the "encoder" tag when transcoding

parent d246231e
......@@ -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
......
753261b6299d2ef36cfba70f6e6fa848 *./tests/data/lavf/lavf.mkv
320275 ./tests/data/lavf/lavf.mkv
48237728e90d74a12d0fe9ae51d23759 *./tests/data/lavf/lavf.mkv
320389 ./tests/data/lavf/lavf.mkv
./tests/data/lavf/lavf.mkv CRC=0xbe7d3cda
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 525 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 639 size: 208
ret: 0 st:-1 flags:0 ts:-1.000000
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 525 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 639 size: 208
ret: 0 st:-1 flags:1 ts: 1.894167
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292163 size: 27834
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292277 size: 27834
ret: 0 st: 0 flags:0 ts: 0.788000
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292163 size: 27834
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292277 size: 27834
ret: 0 st: 0 flags:1 ts:-0.317000
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 525 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 639 size: 208
ret: 0 st: 1 flags:0 ts: 2.577000
ret:-EOF
ret: 0 st: 1 flags:1 ts: 1.471000
ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320004 size: 209
ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320118 size: 209
ret: 0 st:-1 flags:0 ts: 0.365002
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146716 size: 27925
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146830 size: 27925
ret: 0 st:-1 flags:1 ts:-0.740831
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 525 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 639 size: 208
ret: 0 st: 0 flags:0 ts: 2.153000
ret:-EOF
ret: 0 st: 0 flags:1 ts: 1.048000
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292163 size: 27834
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292277 size: 27834
ret: 0 st: 1 flags:0 ts:-0.058000
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 525 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 639 size: 208
ret: 0 st: 1 flags:1 ts: 2.836000
ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320004 size: 209
ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320118 size: 209
ret: 0 st:-1 flags:0 ts: 1.730004
ret:-EOF
ret: 0 st:-1 flags:1 ts: 0.624171
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146716 size: 27925
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146830 size: 27925
ret: 0 st: 0 flags:0 ts:-0.482000
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 525 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 639 size: 208
ret: 0 st: 0 flags:1 ts: 2.413000
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292163 size: 27834
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292277 size: 27834
ret: 0 st: 1 flags:0 ts: 1.307000
ret:-EOF
ret: 0 st: 1 flags:1 ts: 0.201000
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 525 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 639 size: 208
ret: 0 st:-1 flags:0 ts:-0.904994
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 525 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 639 size: 208
ret: 0 st:-1 flags:1 ts: 1.989173
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292163 size: 27834
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292277 size: 27834
ret: 0 st: 0 flags:0 ts: 0.883000
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292163 size: 27834
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292277 size: 27834
ret: 0 st: 0 flags:1 ts:-0.222000
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 525 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 639 size: 208
ret: 0 st: 1 flags:0 ts: 2.672000
ret:-EOF
ret: 0 st: 1 flags:1 ts: 1.566000
ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320004 size: 209
ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320118 size: 209
ret: 0 st:-1 flags:0 ts: 0.460008
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146716 size: 27925
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146830 size: 27925
ret: 0 st:-1 flags:1 ts:-0.645825
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 525 size: 208
ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 639 size: 208
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment