Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2203
  • Last Modified:

To get the FLV Video dimension

Can anybody help me how to get the FLV video files height and width,resizing swf player size?
0
str_kani
Asked:
str_kani
  • 6
  • 6
  • 2
  • +1
7 Solutions
 
sam85281Commented:
Import it into a blank flash document.  Drag it onto the stage and you can see the dimensions in the properties inspector.

-Sam
0
 
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...
0
 
CyanBlueCommented:
Howdy...  :)

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

CyanBlue
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
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 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
 
Aneesh ChopraCommented:
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
 
Aneesh ChopraCommented:
If you have created the FLV using Flash then for sure Flash does not store height/width meta data
0
 
str_kaniAuthor Commented:
Nope, i usually create the flvs using FFMPEG
0
 
Aneesh ChopraCommented:
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
 
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:
---------
nStream.play("test.flv");  
----------

Rgds
Aneesh
0
 
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?
0
 
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.
---------------------
0
 
str_kaniAuthor Commented:
ok, i will give it a try
0
 
CyanBlueCommented:
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
 
str_kaniAuthor Commented:
i think there must be a way in Flash 8 to do this?
0
 
Aneesh ChopraCommented:
No,
FLash does not store correct MetaData info during FLV conversion.

The suggested solution (using FLVMDI) work perfectly.
0
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.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 6
  • 6
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now