[FFmpeg-cvslog] avformat/mxfenc: add h264_mp4toannexb bitstream filter if needed when muxing h264
Marton Balint
git at videolan.org
Fri Mar 8 21:53:07 EET 2024
ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Fri Feb 23 01:08:00 2024 +0100| [64634e809f2e7b6c1a1ea3f6952a17c5915c3f22] | committer: Marton Balint
avformat/mxfenc: add h264_mp4toannexb bitstream filter if needed when muxing h264
Partially fixes ticket #10395.
Signed-off-by: Marton Balint <cus at passwd.hu>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=64634e809f2e7b6c1a1ea3f6952a17c5915c3f22
---
libavformat/mxfenc.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 61ed6fc3db..adc31c1cf4 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -3542,6 +3542,16 @@ static int mxf_interleave(AVFormatContext *s, AVPacket *pkt,
return mxf_interleave_get_packet(s, pkt, flush);
}
+static int mxf_check_bitstream(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
+{
+ if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
+ if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x0000001 &&
+ AV_RB24(pkt->data) != 0x000001)
+ return ff_stream_add_bitstream_filter(st, "h264_mp4toannexb", NULL);
+ }
+ return 1;
+}
+
#define MXF_COMMON_OPTIONS \
{ "signal_standard", "Force/set Signal Standard",\
offsetof(MXFContext, signal_standard), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 7, AV_OPT_FLAG_ENCODING_PARAM, .unit = "signal_standard"},\
@@ -3623,6 +3633,7 @@ const FFOutputFormat ff_mxf_muxer = {
.p.flags = AVFMT_NOTIMESTAMPS,
.interleave_packet = mxf_interleave,
.p.priv_class = &mxf_muxer_class,
+ .check_bitstream = mxf_check_bitstream,
};
const FFOutputFormat ff_mxf_d10_muxer = {
@@ -3656,4 +3667,5 @@ const FFOutputFormat ff_mxf_opatom_muxer = {
.p.flags = AVFMT_NOTIMESTAMPS,
.interleave_packet = mxf_interleave,
.p.priv_class = &mxf_opatom_muxer_class,
+ .check_bitstream = mxf_check_bitstream,
};
More information about the ffmpeg-cvslog
mailing list