943,997 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Unsolved
  • Views: 5823
  • Python RSS
Jul 31st, 2005
0

module to get video file dimensions

Expand Post »
Is their a python module that can get the dimensions of a video file?
Similar Threads
Reputation Points: 10
Solved Threads: 17
Posting Whiz in Training
shanenin is offline Offline
217 posts
since May 2005
Aug 1st, 2005
0

Re: module to get video file dimensions

What video file format are you talking about?
Moderator
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004
Aug 1st, 2005
0

Re: module to get video file dimensions

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
Python Syntax (Toggle Plain Text)
  1. shane@mainbox shane $ avitype movies/collateral2/collateral.avi | grep WxH
  2. InitialFrames=0 Streams=2 SuggestedBufferSize=0 WxH=650x366
I am specifiacally looking for this data 650,366
Reputation Points: 10
Solved Threads: 17
Posting Whiz in Training
shanenin is offline Offline
217 posts
since May 2005
Aug 1st, 2005
0

Re: module to get video file dimensions

using the linux program avitype, I have written this function. It still would be nice to find an all python way of doing it
Python Syntax (Toggle Plain Text)
  1. # this python function gets the dimensions of a video file and returns them as a tuple (width,height)
  2. # it uses the linux video program avitype (I think this is part of the transcode package)
  3.  
  4. # getdimensions.py
  5.  
  6. def getdimensions(video_file):
  7.  
  8. import commands
  9. avitype_command= "/usr/bin/avitype %s | grep WxH" % video_file
  10. dimensions = commands.getoutput(avitype_command)
  11. width = dimensions[-7:-4]
  12. height = dimensions[-3:]
  13. WxH = (width,height)
  14. return WxH
Reputation Points: 10
Solved Threads: 17
Posting Whiz in Training
shanenin is offline Offline
217 posts
since May 2005
Aug 5th, 2005
0

Re: module to get video file dimensions

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.
Moderator
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: class based on Tk() . example
Next Thread in Python Forum Timeline: Processing two Lists (Python)





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC