Solved

Get MPG, AVI, MOV,... properties

Posted on 2000-02-24
6
991 Views
Last Modified: 2012-08-14
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
Comment
Question by:jaumeg
6 Comments
 
LVL 12

Expert Comment

by:pjknibbs
ID: 2557096
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
 
LVL 14

Expert Comment

by:mcrider
ID: 2557146
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
 

Author Comment

by:jaumeg
ID: 2557592
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 12

Expert Comment

by:pjknibbs
ID: 2557672
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
 
LVL 14

Accepted Solution

by:
mcrider earned 150 total points
ID: 2557679
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
 

Expert Comment

by:jbouwh
ID: 22442467
The URL mentioned is dead.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now