diff options
author | Anton Khirnov <anton@khirnov.net> | 2013-04-10 15:02:01 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2013-04-30 12:00:55 +0200 |
commit | 8cd472d3f947a6233e7dc628f0dc71c74e62413a (patch) | |
tree | 773631b217b23469445ea644c859afb7e282fc0b /avconv_filter.c | |
parent | a83c0da539fb07260310bc3b34056239d2b138b2 (diff) | |
download | ffmpeg-8cd472d3f947a6233e7dc628f0dc71c74e62413a.tar.gz |
avconv: make output -ss insert trim/atrim filters.
This makes output -ss sample-accurate for audio and will allow further
simplication in the future.
Diffstat (limited to 'avconv_filter.c')
-rw-r--r-- | avconv_filter.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/avconv_filter.c b/avconv_filter.c index 0a47c95191..1d8044d70b 100644 --- a/avconv_filter.c +++ b/avconv_filter.c @@ -183,7 +183,7 @@ static int insert_trim(OutputStream *ost, AVFilterContext **last_filter, int *pa char filter_name[128]; int ret = 0; - if (of->recording_time == INT64_MAX) + if (of->recording_time == INT64_MAX && !of->start_time) return 0; trim = avfilter_get_by_name(name); @@ -199,8 +199,14 @@ static int insert_trim(OutputStream *ost, AVFilterContext **last_filter, int *pa if (!ctx) return AVERROR(ENOMEM); - ret = av_opt_set_double(ctx, "duration", (double)of->recording_time / 1e6, - AV_OPT_SEARCH_CHILDREN); + if (of->recording_time != INT64_MAX) { + ret = av_opt_set_double(ctx, "duration", (double)of->recording_time / 1e6, + AV_OPT_SEARCH_CHILDREN); + } + if (ret >= 0 && of->start_time) { + ret = av_opt_set_double(ctx, "start", (double)of->start_time / 1e6, + AV_OPT_SEARCH_CHILDREN); + } if (ret < 0) { av_log(ctx, AV_LOG_ERROR, "Error configuring the %s filter", name); return ret; |