1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avformat/movenc: fix VVC encoding with leading pictures

The default behavior for VVenC (since v1.10.0) is to create an IDR with
leading pictures for the first picture in decoding order (POC 32). This
leads to FFmpeg generating an edit list with an empty entry, skipping
the leading pictures.

This patch fixes the calculation for the start_pts, while the DTS is
negative (as produced by vvenc).

Signed-off-by: Gabriel Hege <g+ffmpeg@hege.cc>
This commit is contained in:
Gabriel Hege
2025-04-16 13:51:06 +02:00
committed by Nuo Mi
parent a02e880e35
commit 6c291232cf

View File

@ -3966,7 +3966,7 @@ static int mov_write_edts_tag(AVIOContext *pb, MOVMuxContext *mov,
int flags = 0; int flags = 0;
if (track->entry) { if (track->entry) {
if (start_dts != track->cluster[0].dts || start_ct != track->cluster[0].cts) { if (start_dts != track->cluster[0].dts || (start_ct != track->cluster[0].cts && track->cluster[0].dts >= 0)) {
av_log(mov->fc, AV_LOG_DEBUG, av_log(mov->fc, AV_LOG_DEBUG,
"EDTS using dts:%"PRId64" cts:%d instead of dts:%"PRId64" cts:%"PRId64" tid:%d\n", "EDTS using dts:%"PRId64" cts:%d instead of dts:%"PRId64" cts:%"PRId64" tid:%d\n",
@ -6928,7 +6928,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
trk->flags |= MOV_TRACK_CTTS; trk->flags |= MOV_TRACK_CTTS;
trk->cluster[trk->entry].cts = pkt->pts - pkt->dts; trk->cluster[trk->entry].cts = pkt->pts - pkt->dts;
trk->cluster[trk->entry].flags = 0; trk->cluster[trk->entry].flags = 0;
if (trk->start_cts == AV_NOPTS_VALUE) if (trk->start_cts == AV_NOPTS_VALUE || (pkt->dts <= 0 && trk->start_cts > pkt->pts - pkt->dts))
trk->start_cts = pkt->pts - pkt->dts; trk->start_cts = pkt->pts - pkt->dts;
if (trk->end_pts == AV_NOPTS_VALUE) if (trk->end_pts == AV_NOPTS_VALUE)
trk->end_pts = trk->cluster[trk->entry].dts + trk->end_pts = trk->cluster[trk->entry].dts +