LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-31-2005, 11:46 PM   #1
shanenin
Member
 
Registered: Aug 2003
Location: Rochester, MN, U.S.A
Distribution: Gentoo
Posts: 987

Rep: Reputation: 30
program or python module to get video demensions


I am trying to write a small script to automatically make an mplayer.conf file for individual avi files. I want the conf file to mailnly contain the line 'vf=crop=something:something'. the options giving to crop will very by the original dimensions of the avi file.

I need a program that will get the video dimensions and save that data to a file, or better yet a python module that will do this. Once I have the dimensions, I can use that info to decide hwo I would like to crop it(if at all).

My only possible solution is using mplayer, then redirecting the output to a file. then then parsing the file for the needed info. This is not working how I would like it to.

Any suggestions would be appreciated. Thanks
 
Old 08-01-2005, 10:54 AM   #2
shanenin
Member
 
Registered: Aug 2003
Location: Rochester, MN, U.S.A
Distribution: Gentoo
Posts: 987

Original Poster
Rep: Reputation: 30
The program avitype seems to do this well.
Code:
shane@mainbox shane $ avitype movies/collateral2/collateral.avi | grep WxH
 InitialFrames=0 Streams=2 SuggestedBufferSize=0 WxH=650x366
I was looking for the info 650x366
 
Old 08-01-2005, 12:35 PM   #3
shanenin
Member
 
Registered: Aug 2003
Location: Rochester, MN, U.S.A
Distribution: Gentoo
Posts: 987

Original Poster
Rep: Reputation: 30
I wrote a python function that uses the avitype
Code:
# 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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
no python module base.g? hcgernhardt Linux - Software 2 04-24-2018 09:03 AM
using distutils to install a python module shanenin Programming 2 11-29-2005 09:44 PM
Installing python module on webserver... = p Eleaf Linux - General 11 10-23-2005 07:07 PM
Help me (python and MySQLdb module) Dark Carnival Programming 2 04-22-2004 07:31 AM
python email module extracting headers artur Programming 3 02-06-2004 01:59 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration