• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1015
  • Last Modified:

Get MPG, AVI, MOV,... properties

Hi!
I need a function to get the properties of a Video file: MPG, AVI, MOV,...
The properties I need to get are:
  - duration of the video,
  - dimensions (width x height),
  - sound / no sound
  - ...
Thanks in advance!
0
Jaume Gelabert
Asked:
Jaume Gelabert
1 Solution
 
pjknibbsCommented:
If you load the relevant movie into an ActiveMovie control, I think you can get at these properties via properties of the ActiveMovie control...certainly it has properties Duration, ImageSourceHeight and ImageSourceWidth.
0
 
mcriderCommented:
Add the Windows Media Player to your project by right-clicking the toolbox and selecting "Components..." then select "Windows Media Player" (MSDXM.OCX) from the list.

Add the media Player to your form.

Then set the following properties:

   MediaPlayer1.AutoStart = False
   MediaPlayer1.FileName = "whatever_your_movie_is.mpg"


Then, you can do the following:

    Dim lDuration As Double
    Dim lHeight As Long
    Dim lWidth As Long
    Dim lStreams As Long
   
    'GET MOVIE DURATION IN SECONDS
    lDuration = MediaPlayer1.Duration
    'GET MOVIE HEIGHT
    lHeight = MediaPlayer1.ImageSourceHeight
    'GET MOVIE WIDTH
    lWidth = MediaPlayer1.ImageSourceWidth
    'GET NUMBER OF STREAMS IN MOVIE, IF 0, NO AUDIO
    lStreams = MediaPlayer1.StreamCount


Make sure you're using the latest MediaPlayer... You can download version 6.4 from here:  http://www.microsoft.com/windows/mediaplayer/en/default.asp?RLD=58


Cheers!


0
 
Jaume GelabertAuthor Commented:
Well! The Media Player OCX is a possible solution, but I don't want to depend of a OCX. For the moment I've found the way to get the info or an AVI file, using API functions. I'm interested in the same but for the MPG, MOV,... files.
thanks!
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
pjknibbsCommented:
The problem is, there's no support in Windows for MPG or MOV movies other than through the Windows Media Player, so you can't get the information you want using APIs.
0
 
mcriderCommented:
Well, if you don't want to use an OCX (I don't know why... It's a resource, just like an API is.), You are going to have to open the file and READ it yourself to get the information.

Go to this site: http://wotsit.org/ and do a search on MPG and MOV.  The file formats for each of these file types are there...


Cheers!
0
 
jbouwhCommented:
The URL mentioned is dead.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now