How to easily tell if a stream is a video or an image [ffmpeg library]
Given an AVStream object, how am I supposed to reliably distinguish if it is a video or an image stream?
I tried to use duration. If it is 0, we have an image (system limitations allow for this assumption). But it turns out that duration is of particular importance for images - the number of images stored in the file.
Are there any tricks for more reliable image flow detection?
a source to share
First, let's say I would suggest looking into the enum AVStream->codec->pix_fmt
(see enum PixelFormat
link for more information). You have to trim the values ββthat are for images and videos. Most videos (MPEG-2/4, MOV) usually store their frames in PIX_FMT_YUV420P
.
I will find an answer for you tomorrow when I return to my development system.
a source to share