Commit ce1f4c78d1 for ffmpeg
commit ce1f4c78d1c3642049a01f9d8f24263cc1782fcd
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Thu Sep 24 00:16:33 2026 +0200
avformat: document that muxers require padded packet data
Muxers read packet data the same way decoders do, with reads that may
extend a few bytes past the end of the data, so a packet handed to
av_write_frame() or av_interleaved_write_frame() needs the same
AV_INPUT_BUFFER_PADDING_SIZE bytes after it that decoder input needs.
Packets from libavcodec and from demuxers have them.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index d8c1478b5f..07ed2764cd 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2710,6 +2710,10 @@ int avformat_init_output(AVFormatContext *s, AVDictionary **options);
* set to the index of the corresponding stream in @ref
* AVFormatContext.streams "s->streams".
* <br>
+ * The packet data must be followed by AV_INPUT_BUFFER_PADDING_SIZE
+ * bytes, as for decoder input; packets from libavcodec and from
+ * demuxers are.
+ * <br>
* The timestamps (@ref AVPacket.pts "pts", @ref AVPacket.dts "dts")
* must be set to correct values in the stream's timebase (unless the
* output format is flagged with the AVFMT_NOTIMESTAMPS flag, then
@@ -2754,6 +2758,10 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt);
* set to the index of the corresponding stream in @ref
* AVFormatContext.streams "s->streams".
* <br>
+ * The packet data must be followed by AV_INPUT_BUFFER_PADDING_SIZE
+ * bytes, as for decoder input; packets from libavcodec and from
+ * demuxers are.
+ * <br>
* The timestamps (@ref AVPacket.pts "pts", @ref AVPacket.dts "dts")
* must be set to correct values in the stream's timebase (unless the
* output format is flagged with the AVFMT_NOTIMESTAMPS flag, then