Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the dimensions of a video?

Status
Not open for further replies.

Skute

Programmer
Jul 21, 2003
272
0
0
GB
Hi,

i can add several videos to a timeline and play them, but im trying to size the movies into a specific area on screen keeping their aspect ratio. For this to happen successfully, i need to know the size (width and height) of the clip playing in the timeline (or just the timeline if all items are stretched).


Anyone help?
Thanks

Skute

"There are 10 types of people in this World, those that understand binary, and those that don't!"
 
Timeline of what? Do you mean something like Windows Movie Maker? A DirectShow filter graph?
 
yes, i have an app which is like windows movie maker.

im using a directshow timeline to compose videos etc.
i need to know about the different sizes of the videos on there

Skute

"There are 10 types of people in this World, those that understand binary, and those that don't!"
 
In DirectShow, the video size is part of the media type negotiated when your filters connect. Look in the format type, the VIDEOINFOHEADER or VIDEOINFOHEADER2 structure, depending on the media subtype. Both these have a field of type BITMAPINFOHEADER called "bmiHeader". In this structure, the video size is stored as the width/height fields, "biWidth" and "biHeight".

Also in VIDEOINFOHEADER/VIDEOINFOHEADER2 are source/target rectangles ("rcSource" and "rcTarget"). If these have non-zero values, they specify stretching/clipping rectangles.

This web page talks all about this stuff.
 
yeah ive got that much, i was just wondering what you would do if you have 2 videos of different sizes on the same timeline, ie, a video of 400x100 and a video of 100x200. what size should the resulting video be in? at the moment im resorting to playing in any 4:3 size and stretching all the videos to fit.
ta

Skute

"There are 10 types of people in this World, those that understand binary, and those that don't!"
 
It depends on what is mixing the videos together. You can either stretch the videos like you're doing now (probably your best bet), or blt the smaller one into a rectangular sub-area inside the larger one. I think it's up to you, what kind of effect you want.
 
ok, cheers, will have a think about the 2nd option too!

Skute

"There are 10 types of people in this World, those that understand binary, and those that don't!"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top