views:

170

answers:

1

Having an AVStream object how should I reliably distinguish whether this is video or image stream?

I've tried to use duration. If it's 0 - we are having image (system constraints allows for such assumption). But it turns out that duration have special meaning for images - the number of images stored in file.

Is there any tricks to detect image stream more reliably?

A: 

At first guess, I would suggest examining the AVStream->codec->pix_fmt enumeration (see enum PixelFormat link for more information). You should be able to trim down the values that are for images and videos. Most videos (MPEG-2/4, MOV) typically store their frames in PIX_FMT_YUV420P format.

I'll find you the answer tomorrow when I'm back on my development system.

Brian