Commit 4818388e authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '8cd472d3'

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

Conflicts:
	Changelog
	ffmpeg.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 76c1f920 8cd472d3
...@@ -35,7 +35,8 @@ version <next>: ...@@ -35,7 +35,8 @@ version <next>:
the vid.stab library the vid.stab library
- astats filter - astats filter
- trim and atrim filters - trim and atrim filters
- ffmpeg -t option is now sample-accurate when transcoding audio - ffmpeg -t and -ss (output-only) options are now sample-accurate when
transcoding audio
version 1.2: version 1.2:
......
...@@ -1059,11 +1059,6 @@ static int reap_filters(void) ...@@ -1059,11 +1059,6 @@ static int reap_filters(void)
av_rescale_q(of->start_time, av_rescale_q(of->start_time,
AV_TIME_BASE_Q, AV_TIME_BASE_Q,
ost->st->codec->time_base); ost->st->codec->time_base);
if (of->start_time && filtered_frame->pts < 0) {
av_frame_unref(filtered_frame);
continue;
}
} }
//if (ost->source_index >= 0) //if (ost->source_index >= 0)
// *filtered_frame= *input_streams[ost->source_index]->decoded_frame; //for me_threshold // *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,10 +286,12 @@ static int insert_trim(OutputStream *ost, AVFilterContext **last_filter, int *pa
char filter_name[128]; char filter_name[128];
int ret = 0; int ret = 0;
if (of->recording_time == INT64_MAX) if (of->recording_time == INT64_MAX && !of->start_time)
return 0; return 0;
return 0; // Use with duration and without output starttime is buggy with trim filters
if (!of->start_time)
return 0;
trim = avfilter_get_by_name(name); trim = avfilter_get_by_name(name);
if (!trim) { if (!trim) {
...@@ -304,8 +306,14 @@ static int insert_trim(OutputStream *ost, AVFilterContext **last_filter, int *pa ...@@ -304,8 +306,14 @@ static int insert_trim(OutputStream *ost, AVFilterContext **last_filter, int *pa
if (!ctx) if (!ctx)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
ret = av_opt_set_double(ctx, "duration", (double)of->recording_time / 1e6, if (of->recording_time != INT64_MAX) {
AV_OPT_SEARCH_CHILDREN); 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) { if (ret < 0) {
av_log(ctx, AV_LOG_ERROR, "Error configuring the %s filter", name); av_log(ctx, AV_LOG_ERROR, "Error configuring the %s filter", name);
return ret; return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment