[FFmpeg-devel] [PATCH 1/8] lavc/avcodec: simplify codec id/type validity checking

Anton Khirnov anton at khirnov.net
Sun Jun 5 10:01:14 EEST 2022


Quoting Soft Works (2022-06-05 07:23:18)
> This is causing a regression in ffprobe. 
> 
> The commit removes the special-case check for AVMEDIA_TYPE_ATTACHMENT which 
> was required for ffprobe and had been added with e83c716e16c52fa56a78274408f7628e5dc719da.
> 
> The demand from the commit message is not yet guaranteed to be fulfilled:
> 
> > On entry to avcodec_open2(), the type and id either have to be
> > UNKNOWN/NONE or have to match the codec to be used.
> 
> I have one verified example (maybe a second will follow), which is an MKV with
> an attachment "stream" of type "text".
> The found codec will be textdec of type 'subtitle' even though the stream type
> is attachment. Without the special condition for attachment streams, this 
> is now causing ffprobe to error out with non-zero exit code and incomplete 
> output.
> 
> 
> ------------------------------------------------------------------------
> Example:
>   
>   [...]
>   Stream #0:9: Attachment: text
>     Metadata:
>       filename        : textfile.text
>       mimetype        : text/plain
> [text @ 000001AC32310340] Codec type or id mismatches
> Could not open codec for input stream 9
> ------------------------------------------------------------------------

This sounds very much like a bug in ffprobe. It makes no sense to call
avcodec_open2() with the AVMEDIA_TYPE_ATTACHMENT type.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list