else
pkt.pts += 90 * sub->end_display_time;
}
+ pkt.dts = pkt.pts;
write_frame(s, &pkt, ost);
}
}
fprintf(vstats_file,"f_size= %6d ", frame_size);
/* compute pts value */
- ti1 = ost->st->pts.val * av_q2d(enc->time_base);
+ ti1 = av_stream_get_end_pts(ost->st) * av_q2d(ost->st->time_base);
if (ti1 < 0.01)
ti1 = 0.01;
vid = 1;
}
/* compute min output value */
- if (ost->st->pts.val != AV_NOPTS_VALUE)
- pts = FFMAX(pts, av_rescale_q(ost->st->pts.val,
+ if (av_stream_get_end_pts(ost->st) != AV_NOPTS_VALUE)
+ pts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st),
ost->st->time_base, AV_TIME_BASE_Q));
}
file->nb_streams_warn = pkt->stream_index + 1;
}
+static void set_encoder_id(OutputFile *of, OutputStream *ost)
+{
+ AVDictionaryEntry *e;
+
+ uint8_t *encoder_string;
+ int encoder_string_len;
+ int format_flags = 0;
+ int codec_flags = 0;
+
+ if (av_dict_get(ost->st->metadata, "encoder", NULL, 0))
+ return;
+
+ 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);
+ }
+ e = av_dict_get(ost->encoder_opts, "flags", NULL, 0);
+ if (e) {
+ const AVOption *o = av_opt_find(ost->st->codec, "flags", NULL, 0, 0);
+ if (!o)
+ return;
+ av_opt_eval_flags(ost->st->codec, o, e->value, &codec_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) && !(codec_flags & CODEC_FLAG_BITEXACT))
+ av_strlcpy(encoder_string, LIBAVCODEC_IDENT " ", encoder_string_len);
+ else
+ av_strlcpy(encoder_string, "Lavc ", 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;
InputFile *ifile = input_files[i];
if (ifile->rate_emu)
for (j = 0; j < ifile->nb_streams; j++)
- input_streams[j + ifile->ist_index]->start = av_gettime();
+ input_streams[j + ifile->ist_index]->start = av_gettime_relative();
}
/* output stream init */
ist->decoding_needed++;
ost->encoding_needed = 1;
+ set_encoder_id(output_files[ost->file_index], ost);
+
if (!ost->filter &&
(enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO ||
enc_ctx->codec_type == AVMEDIA_TYPE_AUDIO)) {
av_get_pix_fmt_name(ost->filter->filter->inputs[0]->format));
enc_ctx->pix_fmt = ost->filter->filter->inputs[0]->format;
+ ost->st->avg_frame_rate = ost->frame_rate;
+
if (!dec_ctx ||
enc_ctx->width != dec_ctx->width ||
enc_ctx->height != dec_ctx->height ||
for (i = 0; i < nb_input_files; i++) {
InputFile *f = input_files[i];
- if (!(f->fifo = av_fifo_alloc(8*sizeof(AVPacket))))
+ if (!(f->fifo = av_fifo_alloc_array(8, sizeof(AVPacket))))
return AVERROR(ENOMEM);
if (f->ctx->pb ? !f->ctx->pb->seekable :
for (i = 0; i < f->nb_streams; i++) {
InputStream *ist = input_streams[f->ist_index + i];
int64_t pts = av_rescale(ist->dts, 1000000, AV_TIME_BASE);
- int64_t now = av_gettime() - ist->start;
+ int64_t now = av_gettime_relative() - ist->start;
if (pts > now)
return AVERROR(EAGAIN);
}
av_log(NULL, AV_LOG_INFO, "Press [q] to stop, [?] for help\n");
}
- timer_start = av_gettime();
+ timer_start = av_gettime_relative();
#if HAVE_PTHREADS
if ((ret = init_input_threads()) < 0)
#endif
while (!received_sigterm) {
- int64_t cur_time= av_gettime();
+ int64_t cur_time= av_gettime_relative();
/* if 'q' pressed, exits */
if (stdin_interaction)
}
/* dump report by using the first video and audio streams */
- print_report(1, timer_start, av_gettime());
+ print_report(1, timer_start, av_gettime_relative());
/* close each encoder */
for (i = 0; i < nb_output_streams; i++) {