diff options
author | Gyan Doshi <ffmpeg@gyani.pro> | 2018-06-22 22:02:16 +0530 |
---|---|---|
committer | Gyan Doshi <ffmpeg@gyani.pro> | 2018-06-26 09:47:32 +0530 |
commit | 4ac88ba5487e026bf81da565f97cfcf8f920657d (patch) | |
tree | a06010d0272da343e64ca8953c60c232320bd499 | |
parent | 52e8a0d96da7e056e0818b622b55d01435760cd7 (diff) | |
download | ffmpeg-4ac88ba5487e026bf81da565f97cfcf8f920657d.tar.gz |
fftools/ffmpeg: check sseof value and clash with ss
Prioritize -ss
-rw-r--r-- | fftools/ffmpeg_opt.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index a2ecddae71..58ec13e5a8 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -1103,9 +1103,22 @@ static int open_input_file(OptionsContext *o, const char *filename) } } + if (o->start_time != AV_NOPTS_VALUE && o->start_time_eof != AV_NOPTS_VALUE) { + av_log(NULL, AV_LOG_WARNING, "Cannot use -ss and -sseof both, using -ss for %s\n", filename); + o->start_time_eof = AV_NOPTS_VALUE; + } + if (o->start_time_eof != AV_NOPTS_VALUE) { - if (ic->duration>0) { + if (o->start_time_eof >= 0) { + av_log(NULL, AV_LOG_ERROR, "-sseof value must be negative; aborting\n"); + exit_program(1); + } + if (ic->duration > 0) { o->start_time = o->start_time_eof + ic->duration; + if (o->start_time < 0) { + av_log(NULL, AV_LOG_WARNING, "-sseof value seeks to before start of file %s; ignored\n", filename); + o->start_time = AV_NOPTS_VALUE; + } } else av_log(NULL, AV_LOG_WARNING, "Cannot use -sseof, duration of %s not known\n", filename); } |