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?

+1


a source to share


1 answer


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.

0


a source







All Articles