diff mbox

[FFmpeg-devel] fftools/ffmpeg: check sseof value and clash with ss

Message ID ea6f8a48-fbf8-52ab-137b-163c55d5d286@gmail.com
State Accepted
Commit 4ac88ba5487e026bf81da565f97cfcf8f920657d
Headers show

Commit Message

Gyan June 25, 2018, 4:37 a.m. UTC
On 25-06-2018 06:39 AM, Michael Niedermayer wrote:

> arguments types are wrong

>>       }
>> +
>>       timestamp = (o->start_time == AV_NOPTS_VALUE) ? 0 : o->start_time;
> 
> unrelated, this should not be in this patch

Revised. Will push soon.

Thanks,
Gyan
From ca9d51bca4cb303897bf32ff3900fa36f3cf7074 Mon Sep 17 00:00:00 2001
From: Gyan Doshi <ffmpeg@gyani.pro>
Date: Fri, 22 Jun 2018 22:02:16 +0530
Subject: [PATCH v2] fftools/ffmpeg: check sseof value and clash with ss

Prioritize -ss
---
 fftools/ffmpeg_opt.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

Comments

Gyan June 26, 2018, 4:21 a.m. UTC | #1
On 25-06-2018 10:07 AM, Gyan Doshi wrote:

> 
> Revised. Will push soon.
> 
> Thanks,
> Gyan

Pushed in a0ac49e38ee1d1011c394d7be67d0f08b2281526
morten.with@gmail.com June 28, 2018, 8:28 p.m. UTC | #2
Hi, currently on the -toeof patch, and while working on it I noticed that
maybe

>av_log(NULL, AV_LOG_WARNING, "-sseof value seeks to before start of file
%s; ignored\n", filename);

should be an AV_LOG_ERROR and an exit_program(1) afterwards. The warning is
very high up and on a file with lots of info you will probably miss it and
wonder what's going on. Throwing an error will instantly clear it up.

Thoughts?

Regards,
Morten

2018-06-26 6:21 GMT+02:00 Gyan Doshi <gyandoshi@gmail.com>:

>
>
> On 25-06-2018 10:07 AM, Gyan Doshi wrote:
>
>
>> Revised. Will push soon.
>>
>> Thanks,
>> Gyan
>>
>
> Pushed in a0ac49e38ee1d1011c394d7be67d0f08b2281526
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
Gyan June 29, 2018, 5:23 a.m. UTC | #3
On 29-06-2018 01:58 AM, Morten With wrote:

>> av_log(NULL, AV_LOG_WARNING, "-sseof value seeks to before start of file
> %s; ignored\n", filename);
> 
> should be an AV_LOG_ERROR and an exit_program(1) afterwards. The warning is
> very high up and on a file with lots of info you will probably miss it and
> wonder what's going on. Throwing an error will instantly clear it up.

The user can't do anything about it. If one is seeking to *before* start 
of file, then at most one can start from start of file, which is what 
ffmpeg falls back on.

Regards,
Gyan
diff mbox

Patch

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);
     }