[FFmpeg-cvslog] ffmpeg_opt: Add -start_at_zero option.

Rodger Combs git at videolan.org
Tue Oct 21 03:43:13 CEST 2014


ffmpeg | branch: master | Rodger Combs <rodger.combs at gmail.com> | Mon Oct 20 18:50:12 2014 -0500| [315f9e929dc00d6df65b1b2bc278191832f63b96] | committer: Michael Niedermayer

ffmpeg_opt: Add -start_at_zero option.

This automatically shifts input timestamps to start at 0 instead of the file's
starting timestamp when using -copyts.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=315f9e929dc00d6df65b1b2bc278191832f63b96
---

 ffmpeg_opt.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index c518ae1..13152d0 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -91,6 +91,7 @@ int do_benchmark_all  = 0;
 int do_hex_dump       = 0;
 int do_pkt_dump       = 0;
 int copy_ts           = 0;
+int start_at_zero     = 0;
 int copy_tb           = -1;
 int debug_ts          = 0;
 int exit_on_error     = 0;
@@ -921,7 +922,7 @@ static int open_input_file(OptionsContext *o, const char *filename)
     f->start_time = o->start_time;
     f->recording_time = o->recording_time;
     f->input_ts_offset = o->input_ts_offset;
-    f->ts_offset  = o->input_ts_offset - (copy_ts ? 0 : timestamp);
+    f->ts_offset  = o->input_ts_offset - (copy_ts ? (start_at_zero && ic->start_time != AV_NOPTS_VALUE ? ic->start_time : 0) : timestamp);
     f->nb_streams = ic->nb_streams;
     f->rate_emu   = o->rate_emu;
     f->accurate_seek = o->accurate_seek;
@@ -2840,6 +2841,8 @@ const OptionDef options[] = {
         "audio drift threshold", "threshold" },
     { "copyts",         OPT_BOOL | OPT_EXPERT,                       { &copy_ts },
         "copy timestamps" },
+    { "start_at_zero",  OPT_BOOL | OPT_EXPERT,                       { &start_at_zero },
+        "shift input timestamps to start at 0 when using copyts" },
     { "copytb",         HAS_ARG | OPT_INT | OPT_EXPERT,              { &copy_tb },
         "copy input stream time base when stream copying", "mode" },
     { "shortest",       OPT_BOOL | OPT_EXPERT | OPT_OFFSET |



More information about the ffmpeg-cvslog mailing list