Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-04-2008, 04:28 AM   #1
coolclu3
Registered User
 
Join Date: Jun 2008
Posts: 6
Default How to jump to a non-keyframe in a flv player

Hi all,
First off, I am almost a newbie in Flash

I am writing an flv player. In this player, I want to be able to jump a specific frame (specified by time). There are a few constraints:
1. The .flv file is external and I have no control whatsoever over its creation (key frames, cuepoints..).
2. The frames I'm jumping to can be non-keyframes

I've tried to use NetStream.seek() and FLVPlayback component's seek method. Both of them only try to jump to the nearest keyframe to the specified time.

I've done lots and lots of googling on this and the general answer I found is: "No, you cannot jump to a non-keyframe, because it's the way flv is". Or something like that.

I almost gave up, and I just recently thought about this: If netstream or FLVPlayback can pause at any frame and start again precisely from that point, then obviously it can start playing from that non-keyframe. This makes me think that there must be a way to jump to that non-keyframe either by:
+) Jumping to it directly (somehow..)
+) Jumping to the previous keyframe and make it play on the background to the specified frame and pause there.

I think Flash engine should be able to do this. However , i hvae very little experience with Flash & actionscript.

Guys, please help me find a solution here, or otherwise someone pls explain to me why this is not possible to achieve? Thanks for reading. Cheers

Last edited by coolclu3; 06-04-2008 at 04:31 AM.
coolclu3 is offline   Reply With Quote
Old 06-05-2008, 04:01 AM   #2
asf8
Senior Member
 
Join Date: Apr 2007
Posts: 4,772
Default

Quote:
Originally Posted by coolclu3 View Post

How to jump to a non-keyframe in a flv player

I am writing an flv player. In this player, I want to be able to jump a specific frame (specified by time). There are a few constraints:
1. The .flv file is external and I have no control whatsoever over its creation (key frames, cuepoints..).
2. The frames I'm jumping to can be non-keyframes

I've tried to use NetStream.seek() and FLVPlayback component's seek method. Both of them only try to jump to the nearest keyframe to the specified time.
Not sure if these will help, but here goes some random thoughts.

goto specific time index in FLV using mediaComponent
http://www.actionscript.org/forums/s...d.php3?t=68279

FLVPlayback.playheadTime
http://board.flashkit.com/board/showthread.php?t=763257
http://livedocs.adobe.com/flash/8/ma...=00003573.html

Inject MetaData into FLVs
http://www.devx.com/webdev/Article/31420/1954

Keep us posted.
asf8 is offline   Reply With Quote
Old 06-06-2008, 09:16 AM   #3
coolclu3
Registered User
 
Join Date: Jun 2008
Posts: 6
Default

Thanks asf8 for your replies
I've studied the links, as well as learning&searching more on Flash. The answer is still a no:
Suppose my sample.flv's first keyframe is at the 10th second.

MediaComponent: Also jumps to the next key frame. Something like this
myMedia.setMedia("sample.flv", "flv");
myMedia.play(1);
will jump to the 10th second to play.

FLVPlayback component: The adobe document says: "First, for a progressive download, you can seek only to a keyframe, so a seek takes you to the time of the first keyframe after the specified time"
I've tried something like this to convince myself the doc is right. And it is.
myFLVPlayback.contentPath = "http://path.to/sample.flv";
myFLVPlayback.playheadTime = 1;
myFLVPlayback.play();

Inject metadata to the .flv: This approach requires the client machine to download the .flv, inject some metadata and play it. This is not so convenient. But I'll nonetheless try it out later...

Right now, I am thinking of writing my own Media component because I think FLVPlayback and NetStream or whatever... must be written based on some lower level classes. I can start working with those classes, rather than FLVPlayback....

However, I don't know where to start. I haven't found the needed classes' names, interface, (I'm not hoping for source code).
I haven't been able to find the class diagram of the whole Flash "thing".

Please tell me, is this possible? Or is it a crazy idea? Does Adobe document its low-level (well, low enough) classes interface somewhere? Again, I must say that I'm just beginning to explore Flash...
coolclu3 is offline   Reply With Quote
Old 06-06-2008, 12:27 PM   #4
asf8
Senior Member
 
Join Date: Apr 2007
Posts: 4,772
Default

Quote:
Originally Posted by coolclu3 View Post
I am writing an flv player. In this player, I want to be able to jump a specific frame (specified by time). There are a few constraints:
1. The .flv file is external and I have no control whatsoever over its creation (key frames, cuepoints..).
2. The frames I'm jumping to can be non-keyframes

I've tried to use NetStream.seek() and FLVPlayback component's seek method. Both of them only try to jump to the nearest keyframe to the specified time.
Quote:
Originally Posted by coolclu3 View Post
Thanks asf8 for your replies I've studied the links, as well as learning&searching more on Flash. The answer is still a no:
Suppose my sample.flv's first keyframe is at the 10th second.
Maybe I dont understand what you want but when I test this I can jump all around when using FLVPlayback.

All I did was drag an instance of the FLVPlayback component onto the stage, and gave it an instance name of myFLVPlayback. I then entered this code in my actions layer.

ActionScript Code:
// FLVPlayback instance name = myFLVPlayback // External FLV file is named = video.flv stop(); myFLVPlayback.contentPath = "video.flv"; myFLVPlayback.playheadTime = 5 // Where to start playing from myFLVPlayback.play(); // Simple example using onRollOver/onRollOut // Could be buttons with onRelease also to // go to certain point in your video like cuepoints myFLVPlayback.onRollOver = function(){     this.playheadTime = 35 // Where to play from onRollOver }; myFLVPlayback.onRollOut = function(){     this.playheadTime = 5 // Where to play from onRollOut };

Is that not what you want? With something like that you can bounce around to any point/time in the FLV. I just grabbed a random flv file, but it works for me. Again perhaps I am misunderstanding ?
asf8 is offline   Reply With Quote
Old 06-08-2008, 04:40 AM   #5
coolclu3
Registered User
 
Join Date: Jun 2008
Posts: 6
Default

asf8,
That's exactly what i wanna do. But perhaps you've chosen a video that has too many keyframes so that you couldnt see the jumping precisely. I bet it didn't jump right to the '5' or '35' seconds that you wanted. It just instead jumped to the nearest keyframe.
Please try out this flv, which has the first keyframe at around 20th second. You will see when you jump to second number, say 5.
http://ndvol.com/tmp/guitar.flv (sorry it's 11Mb but that's the one I'm using to test )
Thanks & cheers

Last edited by coolclu3; 06-10-2008 at 11:59 PM. Reason: up
coolclu3 is offline   Reply With Quote
Old 06-19-2008, 11:31 PM   #6
mille562
Registered User
 
Join Date: Jun 2008
Posts: 1
Default Can you re-encode?

I would like to be able to do the same thing you are doing. If you find some way to write a lower level video player, please let me know. I would be very interested in helping out.

How I am handling the situation now is to re-encode the video with key-frames every .4 seconds. It get's it close, but it's not perfect.

I do it using FFMPEG.
mille562 is offline   Reply With Quote
Old 09-14-2008, 06:50 AM   #7
jsy
Registered User
 
Join Date: Sep 2008
Posts: 1
Default

Here's a thought borrowed from ripping flvs, why not copy the video frames of the video using the bitmap class(http://livedocs.adobe.com/flash/9.0/.../Bitmap.html)? So you have to take a bitmap snapshot of the flv at a certain interval, say 15 times a seconds. When you scrub, you are just going through the bitmaps.

The big downside is that your player would have to play through the entire video uninterrupted to take the snapshots and hold the bitmaps in memory (at least until flash 10 comes out). The longer the video, the longer to process and the more memory it will take.
jsy is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem loading FLV Player in Full Screen bdq172 ActionScript 3.0 3 08-19-2011 08:55 AM
WWD FLV Player version 2.0 woostermike Widgets 1 01-29-2010 01:40 PM
FLV player stepping single frame forwards Halflife ActionScript 3.0 1 02-26-2008 10:55 AM
FLV Player Rewind Button mxcnstr02 ActionScript 2.0 0 03-09-2007 04:02 AM


All times are GMT. The time now is 11:38 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.