mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-23 04:24:35 +02:00
avconv: stop using setpts for input framerate forced with -r
The setpts filter does not signal to the rest of the filtergraph that the stream is CFR. Just generate the timestamps manually instead.
This commit is contained in:
parent
9064777dbb
commit
b0f36a0043
2
avconv.c
2
avconv.c
@ -1392,6 +1392,8 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output)
|
|||||||
|
|
||||||
decoded_frame->pts = guess_correct_pts(&ist->pts_ctx, decoded_frame->pts,
|
decoded_frame->pts = guess_correct_pts(&ist->pts_ctx, decoded_frame->pts,
|
||||||
decoded_frame->pkt_dts);
|
decoded_frame->pkt_dts);
|
||||||
|
if (ist->framerate.num)
|
||||||
|
decoded_frame->pts = ist->cfr_next_pts++;
|
||||||
|
|
||||||
if (ist->st->sample_aspect_ratio.num)
|
if (ist->st->sample_aspect_ratio.num)
|
||||||
decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio;
|
decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio;
|
||||||
|
5
avconv.h
5
avconv.h
@ -269,6 +269,11 @@ typedef struct InputStream {
|
|||||||
int64_t last_dts;
|
int64_t last_dts;
|
||||||
int64_t min_pts; /* pts with the smallest value in a current stream */
|
int64_t min_pts; /* pts with the smallest value in a current stream */
|
||||||
int64_t max_pts; /* pts with the higher value in a current stream */
|
int64_t max_pts; /* pts with the higher value in a current stream */
|
||||||
|
|
||||||
|
// when forcing constant input framerate through -r,
|
||||||
|
// this contains the pts that will be given to the next decoded frame
|
||||||
|
int64_t cfr_next_pts;
|
||||||
|
|
||||||
int64_t nb_samples; /* number of samples in the last decoded audio frame before looping */
|
int64_t nb_samples; /* number of samples in the last decoded audio frame before looping */
|
||||||
PtsCorrectionContext pts_ctx;
|
PtsCorrectionContext pts_ctx;
|
||||||
double ts_scale;
|
double ts_scale;
|
||||||
|
@ -519,6 +519,8 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
|
|||||||
par->height = ifilter->height;
|
par->height = ifilter->height;
|
||||||
par->format = ifilter->format;
|
par->format = ifilter->format;
|
||||||
par->time_base = tb;
|
par->time_base = tb;
|
||||||
|
if (ist->framerate.num)
|
||||||
|
par->frame_rate = ist->framerate;
|
||||||
par->hw_frames_ctx = ifilter->hw_frames_ctx;
|
par->hw_frames_ctx = ifilter->hw_frames_ctx;
|
||||||
|
|
||||||
ret = av_buffersrc_parameters_set(ifilter->filter, par);
|
ret = av_buffersrc_parameters_set(ifilter->filter, par);
|
||||||
@ -552,23 +554,6 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ist->framerate.num) {
|
|
||||||
AVFilterContext *setpts;
|
|
||||||
|
|
||||||
snprintf(name, sizeof(name), "force CFR for input from stream %d:%d",
|
|
||||||
ist->file_index, ist->st->index);
|
|
||||||
if ((ret = avfilter_graph_create_filter(&setpts,
|
|
||||||
avfilter_get_by_name("setpts"),
|
|
||||||
name, "N", NULL,
|
|
||||||
fg->graph)) < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
if ((ret = avfilter_link(last_filter, 0, setpts, 0)) < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
last_filter = setpts;
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(name, sizeof(name), "trim for input stream %d:%d",
|
snprintf(name, sizeof(name), "trim for input stream %d:%d",
|
||||||
ist->file_index, ist->st->index);
|
ist->file_index, ist->st->index);
|
||||||
ret = insert_trim(((f->start_time == AV_NOPTS_VALUE) || !f->accurate_seek) ?
|
ret = insert_trim(((f->start_time == AV_NOPTS_VALUE) || !f->accurate_seek) ?
|
||||||
|
2
configure
vendored
2
configure
vendored
@ -2436,7 +2436,7 @@ swscale_deps="avutil"
|
|||||||
avconv_deps="avcodec avfilter avformat avresample swscale"
|
avconv_deps="avcodec avfilter avformat avresample swscale"
|
||||||
avconv_select="aformat_filter anull_filter asyncts_filter atrim_filter format_filter
|
avconv_select="aformat_filter anull_filter asyncts_filter atrim_filter format_filter
|
||||||
fps_filter null_filter resample_filter scale_filter
|
fps_filter null_filter resample_filter scale_filter
|
||||||
setpts_filter trim_filter"
|
trim_filter"
|
||||||
avplay_deps="avcodec avfilter avformat avresample sdl"
|
avplay_deps="avcodec avfilter avformat avresample sdl"
|
||||||
avplay_libs='$sdl_libs'
|
avplay_libs='$sdl_libs'
|
||||||
avplay_select="rdft format_filter transpose_filter hflip_filter vflip_filter"
|
avplay_select="rdft format_filter transpose_filter hflip_filter vflip_filter"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user