Solved

To get the FLV Video dimension

Posted on 2006-07-12
15
2,074 Views
Last Modified: 2008-01-09
Can anybody help me how to get the FLV video files height and width,resizing swf player size?
0
Comment
Question by:str_kani
  • 6
  • 6
  • 2
  • +1
15 Comments
 
LVL 16

Assisted Solution

by:sam85281
sam85281 earned 100 total points
Comment Utility
Import it into a blank flash document.  Drag it onto the stage and you can see the dimensions in the properties inspector.

-Sam
0
 
LVL 12

Author Comment

by:str_kani
Comment Utility
no, that's not I wanted.

I need to find the actual width and height of the video, i will load videos into the player dynamically...
0
 
LVL 37

Expert Comment

by:CyanBlue
Comment Utility
Howdy...  :)

Check on the metadata...  It normally contains the dimension information but not all FLV file contains that data though...

CyanBlue
0
 
LVL 12

Author Comment

by:str_kani
Comment Utility
Thanks for your reply, I tried the following. But it is only working when i set the content path to some video on the internet, (i.e it gives me the width and height if i set a fully quailified URL like http://mysite.com/sample.flv) but it doesn't return anything if i set something like  c:\samplevideo.flv

Here is the code i tried with...

var netConn:NetConnection = new NetConnection();
netConn.connect(null);
var nStream:NetStream = new NetStream(netConn);
my_video.attachVideo(nStream);
nStream.setBufferTime(0);
nStream.play("http:\\www.video.com\video\video.flv    \\ this is working
nStream.play("d:\test.flv");  \\ this is not working
nStream.onMetaData = function(myMeta) {
     trace("FLV Width: "+myMeta.width);
     trace("FLV Height: "+myMeta.height);
     my_video.width = myMeta.width;
     my_video.height = myMeta.h
};
0
 
LVL 34

Assisted Solution

by:Aneesh Chopra
Aneesh Chopra earned 350 total points
Comment Utility
I agree with CyanBlue,

Not every FLV have metaData by default...

although you can inject metaData into FLV using following free tool
http://www.buraks.com/flvmdi/

0
 
LVL 34

Expert Comment

by:Aneesh Chopra
Comment Utility
If you have created the FLV using Flash then for sure Flash does not store height/width meta data
0
 
LVL 12

Author Comment

by:str_kani
Comment Utility
Nope, i usually create the flvs using FFMPEG
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 34

Accepted Solution

by:
Aneesh Chopra earned 350 total points
Comment Utility
I suggest just download the following:

FLV metaData injector:
http://www.buraks.com/flvmdi/flvmdi28_beta.zip

GUI:
http://www.buraks.com/flvmdi/flvmdigui101.zip

unzip both in same folder..

Run the "flvmdigui.exe" and browse for ur FLV

click  "Run FLVMDI"

and you are done, all metaData issue will be fixed.

now check once again, you will be getting the width and height properly

Rgds
Aneesh

0
 
LVL 34

Assisted Solution

by:Aneesh Chopra
Aneesh Chopra earned 350 total points
Comment Utility
Another point, use relative path instead of absolute path

in simple words, keep swf and FLV in same folder and add the path as following:
---------
nStream.play("test.flv");  
----------

Rgds
Aneesh
0
 
LVL 12

Author Comment

by:str_kani
Comment Utility
Actually I am trying to achive a flv player (desktop application), that will be using the physical path (i think you know this)

Do i need to download both the dos and GUI version of the application, what exactly this will do?
0
 
LVL 34

Assisted Solution

by:Aneesh Chopra
Aneesh Chopra earned 350 total points
Comment Utility
yes, you should download both and do it as suggested step by step
both together are hardly 700 kb in size

this will update the all of the following metaData info in FLV automatically,

-----------
'lastkeyframetimestamp: (Number) TimeStamp of the last video tag which is a key frame. This info might be needed because seeking a frame after this time usually does not work.
width: (Number) Width of the video in pixels. (Flash exporter 1.1 sets this to 0).
height: (Number) Height of the video in pixels. (Flash exporter 1.1 sets this to 0).
videodatarate: (Number) FLVMDI does not compute this value and imports it if present. (Defaults to 0).
audiodatarate: (Number) FLVMDI does not compute this value and imports it if present. (Defaults to 0).
framerate: (Number) FLVMDI computes this value, but uses imported value if not 0.
creationdate: (String) FLVMDI cannot compute this value and imports it if present. (Defaults to 'unknown').
filesize: (Number) Filesize in bytes (including the injected data).
videosize: (Number) Total size of video tags in the file in bytes.
audiosize: (Number) Total size of audio tags in the file in bytes.
datasize: (Number) Total size of data tags in the file in bytes.
metadatacreator: (String) Will be set to 'Manitu Group FLV MetaData Injector 2'.
metadatadate: (Date) Date and time metadata added. (Note that this is not of type string like 'creationdate').
xtradata: (string) Additional string data if specified.
videocodecid: (Number) Video codec ID number used in the FLV. (Sorenson H.263 =2, Screen Video =3, On2 VP6 = 4 and 5, Screen Video V2 = 6).
audiocodecid: (Number) Audio codec ID number used in the FLV. (Uncompressed = 0, ADPCM = 1, MP3 = 2, NellyMoser = 5 and 6).
audiodelay: (Number) Audio delay in seconds. Flash 8 encoder delays the video for better synch with audio (Audio and video does not start both at time 0, Video starts a bit later). This value is also important for Flash 8 Video Encoder injected Cue Points, because logical time of the cue points does not correspond to physical time they are inserted in the FLV. (Cue points are injected before encoding, when the video is shifted by 'audio delay' seconds, cue points are also shifted and their physical time in the FLV changes).
canSeekToEnd: (Boolean) True if the last video tag is a key frame and hence can be 'seek'ed.
keyframes: (Object) This object is added only if you specify the /k switch. 'keyframes' is known to FLVMDI and if /k switch is not specified, 'keyframes' object will be deleted.
'keyframes' object has 2 arrays: 'filepositions' and 'times'. Both arrays have the same number of elements, which is equal to the number of key frames in the FLV. Values in times array are in 'seconds'. Each correspond to the timestamp of the n'th key frame. Values in filepositions array are in 'bytes'. Each correspond to the fileposition of the nth key frame video tag (which starts with byte tag type 9).
FLVMDI 2.x also injects onLastSecond event. It is inserted at 1 second minus the last timestamp value. You can add the event to NetSTream just like onMetaData event.
---------------------
0
 
LVL 12

Author Comment

by:str_kani
Comment Utility
ok, i will give it a try
0
 
LVL 37

Assisted Solution

by:CyanBlue
CyanBlue earned 50 total points
Comment Utility
I had used FFMPEG to convert the MPEG file to FLV and it did NOT save the required metadata for me to utilize in the FLV player, so I ended up using the FLVMDI(check the link from Aneesh's post) and it works fine after I did that...

CyanBlue
0
 
LVL 12

Author Comment

by:str_kani
Comment Utility
i think there must be a way in Flash 8 to do this?
0
 
LVL 34

Assisted Solution

by:Aneesh Chopra
Aneesh Chopra earned 350 total points
Comment Utility
No,
FLash does not store correct MetaData info during FLV conversion.

The suggested solution (using FLVMDI) work perfectly.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

771 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

10 Experts available now in Live!

Get 1:1 Help Now