[FFmpeg-devel] [PATCH] ffmpeg: remove obsolete workaround in trim insertion.

Paul B Mahol onemda at gmail.com
Mon Aug 12 11:29:39 CEST 2013


On 8/10/13, Nicolas George <nicolas.george at normalesup.org> wrote:
> Le duodi 22 thermidor, an CCXXI, Paul B Mahol a ecrit :
>> But arguments for trim filters given by ffmpeg are in doubles,
>> original time is expressed in integers so I fail to see why just
>> replacing
>> doubles with ints and removing division and using 'durationi' & 'starti'
>> instead of 'duration' & 'start' is not correct.
>
> I agree, it should be exactly equivalent. There must be some simple mistake
> somewhere that causes a different behaviour. Can you post your current
> patch?


---
 ffmpeg_filter.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
index e17c4a5..4f1e572 100644
--- a/ffmpeg_filter.c
+++ b/ffmpeg_filter.c
@@ -302,11 +302,11 @@ static int insert_trim(int64_t start_time,
int64_t duration,
         return AVERROR(ENOMEM);

     if (duration != INT64_MAX) {
-        ret = av_opt_set_double(ctx, "duration", (double)duration / 1e6,
+        ret = av_opt_set_int(ctx, "durationi", duration,
                                 AV_OPT_SEARCH_CHILDREN);
     }
     if (ret >= 0 && start_time != AV_NOPTS_VALUE) {
-        ret = av_opt_set_double(ctx, "start", (double)start_time / 1e6,
+        ret = av_opt_set_int(ctx, "starti", start_time,
                                 AV_OPT_SEARCH_CHILDREN);
     }
     if (ret < 0) {
-- 
1.7.11.2


More information about the ffmpeg-devel mailing list