The demuxer reads the frame count from the 36-byte footer, but keeps reading packets until physical EOF. It consequently exposes the footer as one or more video packets when the frame size is small enough.
Stop reading once the computed frame index reaches the declared frame count. Add a generated 2x2 Filmstrip test that makes the footer packets visible. Signed-off-by: Tuna Kılıç <[email protected]> --- libavformat/filmstripdec.c | 2 ++ tests/fate/lavf-container.mak | 11 +++++++++++ tests/ref/fate/filmstrip-footer | 3 +++ 3 files changed, 16 insertions(+) create mode 100644 tests/ref/fate/filmstrip-footer diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c index 1a3f45f61c..f6c4cb515d 100644 --- a/libavformat/filmstripdec.c +++ b/libavformat/filmstripdec.c @@ -89,6 +89,8 @@ static int read_packet(AVFormatContext *s, if (avio_feof(s->pb)) return AVERROR_EOF; pkt->dts = avio_tell(s->pb) / (st->codecpar->width * (int64_t)(st->codecpar->height + film->leading) * 4); + if (pkt->dts >= st->nb_frames) + return AVERROR_EOF; pkt->size = av_get_packet(s->pb, pkt, st->codecpar->width * st->codecpar->height * 4); avio_skip(s->pb, st->codecpar->width * (int64_t) film->leading * 4); if (pkt->size < 0) diff --git a/tests/fate/lavf-container.mak b/tests/fate/lavf-container.mak index c9bb9732e7..6d86b41f16 100644 --- a/tests/fate/lavf-container.mak +++ b/tests/fate/lavf-container.mak @@ -71,6 +71,17 @@ fate-lavf-wtv: CMD = lavf_container "" "-c:a mp2 -threads 1" FATE_AVCONV += $(FATE_LAVF_CONTAINER) fate-lavf-container fate-lavf: $(FATE_LAVF_CONTAINER) +FATE_FILMSTRIP-$(call FILTERDEMDECENCMUX, TESTSRC2 SCALE, FILMSTRIP, , \ + RAWVIDEO, FILMSTRIP, LAVFI_INDEV) += fate-filmstrip-footer +fate-filmstrip-footer: CMD = run_with_temp \ + "$(FFMPEG) -nostdin -hide_banner -loglevel error -f lavfi \ + -i testsrc2=size=2x2:rate=1:duration=3 -c:v rawvideo -pix_fmt rgba -f filmstrip -y" \ + "ffprobe$(PROGSSUF)$(EXESUF) -v 0 -bitexact -show_packets \ + -show_entries packet=pts,dts,size,pos -of compact=p=0" flm + +FATE_FFMPEG_FFPROBE += $(FATE_FILMSTRIP-yes) +fate-filmstrip fate-lavf: $(FATE_FILMSTRIP-yes) + FATE_LAVF_CONTAINER_FATE-$(call CRC, APV MOV,, APV_PARSER MP4_MUXER) += apv.mp4 FATE_LAVF_CONTAINER_FATE-$(call CRC, IVF MOV, AV1, AV1_PARSER EXTRACT_EXTRADATA_BSF MP4_MUXER) += av1.mp4 FATE_LAVF_CONTAINER_FATE-$(call CRC, IVF MATROSKA, AV1, AV1_PARSER EXTRACT_EXTRADATA_BSF MATROSKA_MUXER) += av1.mkv diff --git a/tests/ref/fate/filmstrip-footer b/tests/ref/fate/filmstrip-footer new file mode 100644 index 0000000000..cef4343d94 --- /dev/null +++ b/tests/ref/fate/filmstrip-footer @@ -0,0 +1,3 @@ +pts=0|dts=0|size=16|pos=0 +pts=1|dts=1|size=16|pos=16 +pts=2|dts=2|size=16|pos=32 -- 2.55.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
