To get the FLV Video dimension

Can anybody help me how to get the FLV video files height and width,resizing swf player size?
LVL 12
Who is Participating?
Aneesh ChopraCommented:
I suggest just download the following:

FLV metaData injector:


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


Import it into a blank flash document.  Drag it onto the stage and you can see the dimensions in the properties inspector.

str_kaniAuthor Commented:
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...
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Howdy...  :)

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

str_kaniAuthor Commented:
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 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();
var nStream:NetStream = new NetStream(netConn);
nStream.setBufferTime(0);"http:\\\video\video.flv    \\ this is working"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
Aneesh ChopraCommented:
I agree with CyanBlue,

Not every FLV have metaData by default...

although you can inject metaData into FLV using following free tool

Aneesh ChopraCommented:
If you have created the FLV using Flash then for sure Flash does not store height/width meta data
str_kaniAuthor Commented:
Nope, i usually create the flvs using FFMPEG
Aneesh ChopraCommented:
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:

str_kaniAuthor Commented:
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?
Aneesh ChopraCommented:
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.
str_kaniAuthor Commented:
ok, i will give it a try
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...

str_kaniAuthor Commented:
i think there must be a way in Flash 8 to do this?
Aneesh ChopraCommented:
FLash does not store correct MetaData info during FLV conversion.

The suggested solution (using FLVMDI) work perfectly.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.