Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

To get the FLV Video dimension

Posted on 2006-07-12
15
Medium Priority
?
2,135 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
  • 2
  • +1
15 Comments
 
LVL 16

Assisted Solution

by:sam85281
sam85281 earned 300 total points
ID: 17091970
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
ID: 17092107
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
ID: 17092704
Howdy...  :)

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

CyanBlue
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 12

Author Comment

by:str_kani
ID: 17097200
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 1050 total points
ID: 17098985
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
ID: 17099014
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
ID: 17099069
Nope, i usually create the flvs using FFMPEG
0
 
LVL 34

Accepted Solution

by:
Aneesh Chopra earned 1050 total points
ID: 17099110
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 1050 total points
ID: 17099134
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
ID: 17099290
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 1050 total points
ID: 17099323
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
ID: 17099472
ok, i will give it a try
0
 
LVL 37

Assisted Solution

by:CyanBlue
CyanBlue earned 150 total points
ID: 17099983
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
ID: 17126591
i think there must be a way in Flash 8 to do this?
0
 
LVL 34

Assisted Solution

by:Aneesh Chopra
Aneesh Chopra earned 1050 total points
ID: 17126798
No,
FLash does not store correct MetaData info during FLV conversion.

The suggested solution (using FLVMDI) work perfectly.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
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.

604 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