Re: How to identify QPel and GMC flags in an .avi file?

Christoph Lampert <[email protected]> Thu, 4 Nov 2004 12:28:39 +0100 (CET)
Newsgroups gmane.comp.video.xvid.user
Message-ID <[email protected]>
On Thu, 4 Nov 2004, VJ wrote:
>     Is there a command line program for linux or some tip on how to write
> such a program to get qpel/gmc flags in an avi file? I need to separate my
> collection of 300 avi files so that I may find the ones which can be played
> on my Divx/DVD Player. The player does not support qpel/gmc.

You can use mplayer with libavcodec's debug-output, like

mplayer test.avi -lavdopts debug=1 -vo null

you'll get lot's of line, some looking like this

[mpeg4 @ 0x868ff00]qp:5 fc:2,1 P size:1040 pro:1 alt:0 top:0 hpel ...
[mpeg4 @ 0x868ff00]qp:7 fc:3,3 B size:80 pro:1 alt:0 top:0 hpel ... 
[mpeg4 @ 0x868ff00]qp:5 fc:2,1 P size:1024 pro:1 alt:0 top:0 hpel ... 
[mpeg4 @ 0x868ff00]qp:7 fc:3,3 B size:80 pro:1 alt:0 top:0 hpel ...

If there's a "hpel" in there, then the frame is halfpel, if it's a "qpel", 
it's quarterpel. This is not allowed to change between frames, so 
you can rely on the values from the first frame for the whole 
sequence. 
However, there might be some (incompatible) streams out there which are 
Qpel in one part and Hpel in another. XviD was able to create such beasts 
for a while... 

For GMC, it's less clear. If there are any 'S' entries before 
the "size:", then it's clearly a GMC-sequence, because S-VOPs are only 
used for GMC. If there are only 'I', 'P' or 'B', then no GMC is used.
However, GMC usually is rather rare, and it could very well be that there 
are a couple of thousand IPBs before an S pops up. I don't know of any way 
to check this in advance, since the MPEG-4 header only specifies the 
profile, and most files are in Advanced Simple Profile by now, which 
does allow GMC. 

chl