Video information

Geoffrey Clements geoffrey.clementsNO at SPAMbaesystems.com
Mon Aug 11 09:21:07 EDT 2008


"Bill McClain" <20071214.20.wmcclain at spamgourmet.com> wrote in message 
news:g7l13401ali at news1.newsguy.com...
> On 2008-08-09, dusans <dusan.smitran at gmail.com> wrote:
>> Is there a py module, which would get me information of a movie file:
>> - resolution
>> - fps
>
> I don't know of one. I use the transcode utilities for this and parse 
> their
> output.
>

Something like:
from subprocess import Popen, PIPE
probe = Popen(("tcprobe", "-i", ip_file), stdout=PIPE, 
stderr=PIPE).communicate()[0]

or
from subprocess import Popen, PIPE
probe = Popen(("mplayer", "-identify", "-frames", "0", "-ao", "null", 
ip_file), stdout=PIPE, stderr=PIPE).communicate()[0]

First one uses transcode the second one uses mplayer. I normally follow 
these with a regexp search on "probe" for the data I want.
I have found mplayer to be more accurate than transcode which seems to have 
a problem with some files notably MPEG program streams although it seems to 
work fine for elementary streams.

-- 
Geoff 





More information about the Python-list mailing list