avconv: set AVFormatContext.duration from '-t'
authorAndrey Utkin <andrey.krieger.utkin@gmail.com>
Sun, 5 Feb 2012 14:49:14 +0000 (16:49 +0200)
committerAnton Khirnov <anton@khirnov.net>
Sun, 12 Feb 2012 16:15:41 +0000 (17:15 +0100)
Set output files duration to recording_time option, if given.
Rationale: to save duration into metadata for file that is written to
non-seekable output, for formats like FLV (with metadata at beginning).

Signed-off-by: Anton Khirnov <anton@khirnov.net>
avconv.c

index 418e1fd..92ffd0f 100644 (file)
--- a/avconv.c
+++ b/avconv.c
@@ -3955,6 +3955,8 @@ static void opt_output_file(void *optctx, const char *filename)
     output_files[nb_output_files - 1].ctx       = oc;
     output_files[nb_output_files - 1].ost_index = nb_output_streams - oc->nb_streams;
     output_files[nb_output_files - 1].recording_time = o->recording_time;
+    if (o->recording_time != INT64_MAX)
+        oc->duration = o->recording_time;
     output_files[nb_output_files - 1].start_time     = o->start_time;
     output_files[nb_output_files - 1].limit_filesize = o->limit_filesize;
     av_dict_copy(&output_files[nb_output_files - 1].opts, format_opts, 0);