diff options
author | Vishwanath Dixit <vdixit@akamai.com> | 2018-05-06 22:38:59 +0530 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2018-06-04 22:26:55 +0200 |
commit | 146cdf7e4bb029c9e457742d82d00d3b396b9ff4 (patch) | |
tree | f5712781b0ddfe22e8c1d39c252166416d110fbe /fftools/ffmpeg.c | |
parent | f56a0b02cdbf8d5820de400e584a72b002cd461a (diff) | |
download | ffmpeg-146cdf7e4bb029c9e457742d82d00d3b396b9ff4.tar.gz |
fftools/ffmpeg: fix for all forced key frames when 'copyts' is enabled
Forced key frames generation functionality was assuming the first PTS
value as zero, but, when 'copyts' is enabled, the first PTS can be any
big number. This was eventually forcing all the frames as key frames.
To resolve this issue, update has been made to use first input pts as
reference pts.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'fftools/ffmpeg.c')
-rw-r--r-- | fftools/ffmpeg.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 5a19a09d9a..10f3012cdc 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1236,8 +1236,12 @@ static void do_video_out(OutputFile *of, in_picture->quality = enc->global_quality; in_picture->pict_type = 0; + if (ost->forced_kf_ref_pts == AV_NOPTS_VALUE && + in_picture->pts != AV_NOPTS_VALUE) + ost->forced_kf_ref_pts = in_picture->pts; + pts_time = in_picture->pts != AV_NOPTS_VALUE ? - in_picture->pts * av_q2d(enc->time_base) : NAN; + (in_picture->pts - ost->forced_kf_ref_pts) * av_q2d(enc->time_base) : NAN; if (ost->forced_kf_index < ost->forced_kf_count && in_picture->pts >= ost->forced_kf_pts[ost->forced_kf_index]) { ost->forced_kf_index++; |