[FFmpeg-cvslog] avformat/matroskaenc: Use common function for H.2645 annex B->mp4

Andreas Rheinhardt git at videolan.org
Wed Jan 19 13:54:46 EET 2022


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Jan 16 00:23:50 2022 +0100| [f9b8b89b75fa0afa06ed6be1579b80cd73086c33] | committer: Andreas Rheinhardt

avformat/matroskaenc: Use common function for H.2645 annex B->mp4

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>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f9b8b89b75fa0afa06ed6be1579b80cd73086c33
---

 libavformat/matroskaenc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index a71fd9c6e5..5b0ee32ec0 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) {



More information about the ffmpeg-cvslog mailing list