Browse code

Merge commit '8cd472d3f947a6233e7dc628f0dc71c74e62413a'

* commit '8cd472d3f947a6233e7dc628f0dc71c74e62413a':
avconv: make output -ss insert trim/atrim filters.

Conflicts:
Changelog
ffmpeg.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2013/05/01 21:35:02
Showing 3 changed files
... ...
@@ -35,7 +35,8 @@ version <next>:
35 35
   the vid.stab library
36 36
 - astats filter
37 37
 - trim and atrim filters
38
-- ffmpeg -t option is now sample-accurate when transcoding audio
38
+- ffmpeg -t and -ss (output-only) options are now sample-accurate when
39
+  transcoding audio
39 40
 
40 41
 
41 42
 version 1.2:
... ...
@@ -1059,11 +1059,6 @@ static int reap_filters(void)
1059 1059
                                     av_rescale_q(of->start_time,
1060 1060
                                                 AV_TIME_BASE_Q,
1061 1061
                                                 ost->st->codec->time_base);
1062
-
1063
-                if (of->start_time && filtered_frame->pts < 0) {
1064
-                    av_frame_unref(filtered_frame);
1065
-                    continue;
1066
-                }
1067 1062
             }
1068 1063
             //if (ost->source_index >= 0)
1069 1064
             //    *filtered_frame= *input_streams[ost->source_index]->decoded_frame; //for me_threshold
... ...
@@ -286,10 +286,12 @@ static int insert_trim(OutputStream *ost, AVFilterContext **last_filter, int *pa
286 286
     char filter_name[128];
287 287
     int ret = 0;
288 288
 
289
-    if (of->recording_time == INT64_MAX)
289
+    if (of->recording_time == INT64_MAX && !of->start_time)
290 290
         return 0;
291 291
 
292
-    return 0;
292
+    // Use with duration and without output starttime is buggy with trim filters
293
+    if (!of->start_time)
294
+        return 0;
293 295
 
294 296
     trim = avfilter_get_by_name(name);
295 297
     if (!trim) {
... ...
@@ -304,8 +306,14 @@ static int insert_trim(OutputStream *ost, AVFilterContext **last_filter, int *pa
304 304
     if (!ctx)
305 305
         return AVERROR(ENOMEM);
306 306
 
307
-    ret = av_opt_set_double(ctx, "duration", (double)of->recording_time / 1e6,
308
-                            AV_OPT_SEARCH_CHILDREN);
307
+    if (of->recording_time != INT64_MAX) {
308
+        ret = av_opt_set_double(ctx, "duration", (double)of->recording_time / 1e6,
309
+                                AV_OPT_SEARCH_CHILDREN);
310
+    }
311
+    if (ret >= 0 && of->start_time) {
312
+        ret = av_opt_set_double(ctx, "start", (double)of->start_time / 1e6,
313
+                                AV_OPT_SEARCH_CHILDREN);
314
+    }
309 315
     if (ret < 0) {
310 316
         av_log(ctx, AV_LOG_ERROR, "Error configuring the %s filter", name);
311 317
         return ret;