[FFmpeg-devel] [PATCH] avformat/movenc: don't write PS NALUs in hvcC for codec tag hvc1
James Almer
jamrial at gmail.com
Wed Nov 20 16:46:13 EET 2024
array_completeness shall be 1 for those tracks.
Signed-off-by: James Almer <jamrial at gmail.com>
---
libavformat/movenc.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 7563ff2628..57bf01e17e 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -6656,9 +6656,10 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
} else if (par->codec_id == AV_CODEC_ID_HEVC && trk->vos_len > 6 &&
(AV_RB24(trk->vos_data) == 1 || AV_RB32(trk->vos_data) == 1)) {
/* extradata is Annex B, assume the bitstream is too and convert it */
+ int filter_ps = (trk->tag == MKTAG('h','v','c','1'));
if (trk->hint_track >= 0 && trk->hint_track < mov->nb_tracks) {
ret = ff_hevc_annexb2mp4_buf(pkt->data, &reformatted_data,
- &size, 0, NULL);
+ &size, filter_ps, NULL);
if (ret < 0)
return ret;
avio_write(pb, reformatted_data, size);
@@ -6670,7 +6671,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
goto err;
}
} else {
- size = ff_hevc_annexb2mp4(pb, pkt->data, pkt->size, 0, NULL);
+ size = ff_hevc_annexb2mp4(pb, pkt->data, pkt->size, filter_ps, NULL);
}
}
} else if (par->codec_id == AV_CODEC_ID_VVC && trk->vos_len > 6 &&
--
2.47.0
More information about the ffmpeg-devel
mailing list