aboutsummaryrefslogtreecommitdiffstats
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-11-14 01:21:20 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-11-16 14:27:29 +0100
commitd7ebeba80c609e160a171168b3434c342a652237 (patch)
tree1807e0aebc5b53f1c167058a82fcf990f9565fea /ffmpeg.c
parentd04b7de786780747878c080ba522405c6f542ccb (diff)
downloadffmpeg-d7ebeba80c609e160a171168b3434c342a652237.tar.gz
ffmpeg: Do not fill gap before the first decodable frame on single stream input files unless the user explicitly requests it.
Fixes different behavior to JM and probably several if not all reference decoders. We cannot just do this unconditionally as it would ruin AV sync in some use cases. Bug-Found-by: BugMaster Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 2a885356b6..732fac0cda 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -823,9 +823,21 @@ static void do_video_out(AVFormatContext *s,
format_video_sync = VSYNC_VFR;
} else
format_video_sync = (s->oformat->flags & AVFMT_VARIABLE_FPS) ? ((s->oformat->flags & AVFMT_NOTIMESTAMPS) ? VSYNC_PASSTHROUGH : VSYNC_VFR) : VSYNC_CFR;
+ if ( ist
+ && format_video_sync == VSYNC_CFR
+ && input_files[ist->file_index]->ctx->nb_streams == 1
+ && input_files[ist->file_index]->input_ts_offset == 0) {
+ format_video_sync = VSYNC_VSCFR;
+ }
}
switch (format_video_sync) {
+ case VSYNC_VSCFR:
+ if (ost->frame_number == 0 && delta - duration >= 0.5) {
+ av_log(NULL, AV_LOG_DEBUG, "Not duplicating %d initial frames\n", (int)lrintf(delta - duration));
+ delta = duration;
+ ost->sync_opts = lrint(sync_ipts);
+ }
case VSYNC_CFR:
// FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c
if (delta < -1.1)
@@ -2365,7 +2377,7 @@ static int transcode_init(void)
if (ost->filter && !(codec->time_base.num && codec->time_base.den))
codec->time_base = ost->filter->filter->inputs[0]->time_base;
if ( av_q2d(codec->time_base) < 0.001 && video_sync_method != VSYNC_PASSTHROUGH
- && (video_sync_method == VSYNC_CFR || (video_sync_method == VSYNC_AUTO && !(oc->oformat->flags & AVFMT_VARIABLE_FPS)))){
+ && (video_sync_method == VSYNC_CFR || video_sync_method == VSYNC_VSCFR || (video_sync_method == VSYNC_AUTO && !(oc->oformat->flags & AVFMT_VARIABLE_FPS)))){
av_log(oc, AV_LOG_WARNING, "Frame rate very high for a muxer not efficiently supporting it.\n"
"Please consider specifying a lower framerate, a different muxer or -vsync 2\n");
}