--- a/libavformat/avformat.h 2025-05-08 15:58:37.933172640 -0600 +++ b/libavformat/avformat.h 2025-05-08 15:57:46.964410825 -0600 @@ -496,6 +496,9 @@ The user or muxer can override this through AVFormatContext.avoid_negative_ts */ +#define AVFMT_SEEK_NOSTREAMS 0x80000 /**< Stream index ignored by seek, + or some streams fail to seek + */ #define AVFMT_SEEK_TO_PTS 0x4000000 /**< Seeking is based on PTS */ @@ -559,7 +562,8 @@ /** * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS, * AVFMT_NOTIMESTAMPS, AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH, - * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEEK_TO_PTS. + * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEEK_TO_PTS, + * AVFMT_SEEK_NOSTREAMS */ int flags; --- a/libavformat/dv.c 2025-05-08 15:59:26.143851727 -0600 +++ b/libavformat/dv.c 2025-05-08 15:59:01.103509955 -0600 @@ -714,6 +714,7 @@ const FFInputFormat ff_dv_demuxer = { .p.name = "dv", .p.long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"), + .p.flags = AVFMT_SEEK_NOSTREAMS, .p.extensions = "dv,dif", .priv_data_size = sizeof(RawDVContext), .read_probe = dv_probe, --- a/libavformat/matroskadec.c 2025-05-08 16:00:34.406740107 -0600 +++ b/libavformat/matroskadec.c 2025-05-08 15:59:37.777003123 -0600 @@ -4832,6 +4832,7 @@ const FFInputFormat ff_webm_dash_manifest_demuxer = { .p.name = "webm_dash_manifest", .p.long_name = NULL_IF_CONFIG_SMALL("WebM DASH Manifest"), + .p.flags = AVFMT_SEEK_NOSTREAMS, .p.priv_class = &webm_dash_class, .priv_data_size = sizeof(MatroskaDemuxContext), .flags_internal = FF_INFMT_FLAG_INIT_CLEANUP, @@ -4844,6 +4845,7 @@ const FFInputFormat ff_matroska_demuxer = { .p.name = "matroska,webm", .p.long_name = NULL_IF_CONFIG_SMALL("Matroska / WebM"), + .p.flags = AVFMT_SEEK_NOSTREAMS, .p.extensions = "mkv,mk3d,mka,mks,webm", .p.mime_type = "audio/webm,audio/x-matroska,video/webm,video/x-matroska", .priv_data_size = sizeof(MatroskaDemuxContext), --- a/libavformat/seek.c 2025-05-08 16:01:47.828700137 -0600 +++ b/libavformat/seek.c 2025-05-08 16:00:44.845875964 -0600 @@ -607,6 +607,13 @@ return seek_frame_byte(s, stream_index, timestamp, flags); } + if (stream_index != -1 && (s->iformat->flags & AVFMT_SEEK_NOSTREAMS)) { + timestamp = av_rescale_q(timestamp, + s->streams[stream_index]->time_base, + AV_TIME_BASE_Q); + stream_index = -1; + } + if (stream_index < 0) { stream_index = av_find_default_stream_index(s); if (stream_index < 0)