Skip to content

Commit

Permalink
fftools/ffmpeg: Restore DTS correction for VP9 copies
Browse files Browse the repository at this point in the history
Fixes ticket 9086.

Since early 2021, some of YouTube's VP9 encodes have non-monotonous DTS.
This makes ffmpeg fatally fail when trying to copy or encode the V9 video.

ffmpeg already includes functionality to correct this, however it was
disabled without explanation for VP9 stream copies in
2e6636a

This patch restores the DTS correction logic, and allows ffmpeg to correctly
encode (invalid) videos produced by youtube.com. I have verified that frames
are NOT being cut (so it does not re-introduce 4313).

Reviwed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
  • Loading branch information
lailaiem authored and jamrial committed Feb 13, 2022
1 parent 2233ef1 commit 68595b4
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion fftools/ffmpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,6 @@ static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int u
}
if ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO || st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) &&
pkt->dts != AV_NOPTS_VALUE &&
!(st->codecpar->codec_id == AV_CODEC_ID_VP9 && ost->stream_copy) &&
ost->last_mux_dts != AV_NOPTS_VALUE) {
int64_t max = ost->last_mux_dts + !(s->oformat->flags & AVFMT_TS_NONSTRICT);
if (pkt->dts < max) {
Expand Down

0 comments on commit 68595b4

Please sign in to comment.