libavformat/mov.c: Fix seek in fragmented mp4 files where the audio and video streams are written to seperate fragments

This commit is contained in:
Romain Beauxis
2026-01-02 14:09:54 -06:00
parent c1263a3dd9
commit e5e8efae5c
3 changed files with 14 additions and 0 deletions

View File

@@ -1729,6 +1729,8 @@ static int64_t get_frag_time(AVFormatContext *s, AVStream *dst_st,
}
for (i = 0; i < frag_index->item[index].nb_stream_info; i++) {
if (dst_st->id != frag_index->item[index].stream_info[i].id)
continue;
AVStream *frag_stream = NULL;
frag_stream_info = &frag_index->item[index].stream_info[i];
for (j = 0; j < s->nb_streams; j++) {

View File

@@ -21,5 +21,11 @@ fate-m4v: CMD = framecrc -flags +bitexact -idct simple -i $(TARGET_SAMPLES)/
FATE_MPEG4-$(call FRAMECRC, M4V, MPEG4, MPEG4VIDEO_PARSER FPS_FILTER) += fate-m4v-cfr
fate-m4v-cfr: CMD = framecrc -flags +bitexact -idct simple -i $(TARGET_SAMPLES)/mpeg4/demo.m4v -vf fps=5
# Test seeking in fragmented MP4 with separate audio/video fragments
# Seeks to 1.04s and extracts 1 frame - should land on I-frame at 1.0s with fix,
# lands at start (0s) without fix due to get_frag_time() bug
FATE_MPEG4-$(call FRAMECRC, MOV, H264, AAC_DECODER) += fate-mpeg4-fragmented-seek
fate-mpeg4-fragmented-seek: CMD = framecrc -use_mfra_for pts -ss 1.04 -copyts -noaccurate_seek -i $(TARGET_SAMPLES)/mpeg4/fragmented.mp4 -frames:v 1 -an
FATE_SAMPLES_AVCONV += $(FATE_MPEG4-yes)
fate-mpeg4: $(FATE_MPEG4-yes)

View File

@@ -0,0 +1,6 @@
#tb 0: 1/25
#media_type 0: video
#codec_id 0: rawvideo
#dimensions 0: 320x240
#sar 0: 1/1
0, 25, 25, 1, 115200, 0x19fdc3e8