mainly mpeg4, this can vary from divx, to xvid, and other mpeg4 formats. I want a simple program to help he write a config file that is passed to mplayer(avi player). To have the config file automatically written, I need the original WxH. I have found a program that runs on linux that would work, but would still be insterested in using a python module

this is the linux command line program called avitype

shane@mainbox shane $ avitype movies/collateral2/collateral.avi | grep WxH
 InitialFrames=0 Streams=2 SuggestedBufferSize=0 WxH=650x366

I am specifiacally looking for this data 650,366

using the linux program avitype, I have written this function. It still would be nice to find an all python way of doing it

# this python function gets the dimensions of a video file and returns them as a tuple (width,height)
# it uses the linux video program avitype (I think this is part of the transcode package)

# getdimensions.py

def getdimensions(video_file):

    import commands
    avitype_command= "/usr/bin/avitype %s | grep WxH" % video_file
    dimensions = commands.getoutput(avitype_command)
    width = dimensions[-7:-4]
    height = dimensions[-3:]
    WxH = (width,height)
    return WxH

I have never managed to get my hands on a linux box, this sounds interesting. I have done some work with the Windows avi player in my C++ days mostly through shared COM.

This question has already been answered. Start a new discussion instead.