PR #24659 opened by michaelni URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24659 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24659.patch
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 <[email protected]> >From ea75841d5ab20c2477785e6736dda1ae15bed6f9 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer <[email protected]> Date: Thu, 24 Sep 2026 00:16:33 +0200 Subject: [PATCH] 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 <[email protected]> --- libavformat/avformat.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 4682e105e8..ca015dd58e 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -2708,6 +2708,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 @@ -2752,6 +2756,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 -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
