[FFmpeg-devel] [PATCH 15/25] avformat/matroskaenc: Use common function for H.2645 annex B->mp4
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Mon Jan 17 01:03:55 EET 2022
Matroska does not have different profiles that allow or disallow
in-band extradata, so one can just use the ordinary H.264 function
for H.265, too. (Both use ff_avc_parse_nal_units() internally anyway.)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
libavformat/matroskaenc.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index d275d6cd6c..0446cd6ca9 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2427,13 +2427,10 @@ static int mkv_write_block(AVFormatContext *s, AVIOContext *pb,
mkv->cluster_pos, track_number, keyframe != 0);
#if CONFIG_MATROSKA_MUXER
- if (par->codec_id == AV_CODEC_ID_H264 && par->extradata_size > 0 &&
+ if ((par->codec_id == AV_CODEC_ID_H264 && par->extradata_size > 0 ||
+ par->codec_id == AV_CODEC_ID_HEVC && par->extradata_size > 6) &&
(AV_RB24(par->extradata) == 1 || AV_RB32(par->extradata) == 1)) {
err = ff_avc_parse_nal_units_buf(pkt->data, &data, &size);
- } else if (par->codec_id == AV_CODEC_ID_HEVC && par->extradata_size > 6 &&
- (AV_RB24(par->extradata) == 1 || AV_RB32(par->extradata) == 1)) {
- /* extradata is Annex B, assume the bitstream is too and convert it */
- err = ff_hevc_annexb2mp4_buf(pkt->data, &data, &size, 0, NULL);
} else
#endif
if (track->reformat) {
--
2.32.0
More information about the ffmpeg-devel
mailing list