diff --git a/doc/fftools-common-opts.texi b/doc/fftools-common-opts.texi index dcfe9b5a35..6bc6852d92 100644 --- a/doc/fftools-common-opts.texi +++ b/doc/fftools-common-opts.texi @@ -44,8 +44,8 @@ streams of this type. If @var{stream_index} is given, then it matches the stream with number @var{stream_index} in the program with the id @var{program_id}. Otherwise, it matches all streams in the program. -@item #@var{stream_id} -Matches the stream by a format-specific ID. +@item #@var{stream_id} or i:@var{stream_id} +Match the stream by stream id (e.g. PID in MPEG-TS container). @end table @section Generic options diff --git a/libavformat/utils.c b/libavformat/utils.c index 4065a790d6..8067567d6a 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4468,12 +4468,14 @@ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, return 1; } return 0; - } else if (*spec == '#') { - int sid; + } else if (*spec == '#' || + (*spec == 'i' && *(spec + 1) == ':')) { + int stream_id; char *endptr; - sid = strtol(spec + 1, &endptr, 0); + spec += 1 + (*spec == 'i'); + stream_id = strtol(spec, &endptr, 0); if (!*endptr) - return st->id == sid; + return stream_id == st->id; } else if (!*spec) /* empty specifier, matches everything */ return 1;