?
Solved

Setting frames per second (fps) using FLVPlayback

Posted on 2006-05-28
9
Medium Priority
?
772 Views
Last Modified: 2012-05-05
Hi,

I'm using the FLVPlayback component in Flash 8 to play an instruction video.
The video plays at 25fps (PAL std), but I'm looking to add a feature where the user can watch the video a half that speed to inspect all the details and movements at slow speed.

I was kind of hoping that there would be a .fps property in the component, but there doesn't seem to be any.

Does anyone know of a way to slow down the video speed?
I know that slowing down the video would also mean distorted sound, but that's not a problem. I'll be muting the sound when the video plays at half speed anyway.

best
Terje
0
Comment
Question by:Epiktet
  • 3
  • 3
  • 3
9 Comments
 
LVL 30

Expert Comment

by:Irwin Santos
ID: 16780678
the most efficient way is to output your source video to 12fps and offer 2 flash movies one at full frame rate, the other at 12fps
0
 

Author Comment

by:Epiktet
ID: 16780746
yes, I've thought about that as a last resort.
However, this is a demo for a system holding over 200 instruction videos, so making 12fps versions would double that amount to 400...

Waiting in agony for another solution :-)
0
 
LVL 30

Expert Comment

by:Irwin Santos
ID: 16780774
what happens if you change the stage to 12fps?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:Epiktet
ID: 16780896
The flvPlayback component plays the video at the FLV's fps rate independent of the stage fps.
Besides, that would slow down all the other animation (buttons, fades etc) as well, which is not really what I want.
0
 
LVL 30

Expert Comment

by:Irwin Santos
ID: 16780907
...prepare for agony... :-(
0
 
LVL 2

Expert Comment

by:rythmik1
ID: 16784786

if i had to do it, i'd make a function using setinterval() to update the playhead's position using the seek() command.. ie:

_global.seekSpeed = 1000; // (number of milliseconds to pass before going advancing flv frame)
i=0; // starting second
function doSloMo() {
i+=1; // increment second
myVideo.seek(i); // seek to i
}
sloMo = setInterval("doSloMo", _global.seekSpeed); // set an interval to call the above function.

////////////////////////

then, you could make some buttons that change the _global.seekSpeed to slow it down or speed it up:

on(release) { global.seekSpeed = 2000; }
on(release) { global.seekSpeed = 3000; }

etc.

0
 
LVL 2

Accepted Solution

by:
rythmik1 earned 2000 total points
ID: 16784853
here's the full code to connect to an flv and then make it do slow motion, tested and working. notice i pause it immediately after starting the video so that it won't run off on its own. then the setInterval function tells it to advance to the next second at whatever interval _global.seekSpeed is set to. all you have to do is change the 'YOURVIDEO.flv' in the code below to the path to your flv.


////////////////////////////////////////////////////////////////////////////
// CREATE CONNECTION TO FLV ////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
var myConnection;
var myVideo;
my_video._alpha = 100;
playVideo = function () {
      myConnection = new NetConnection();
      myConnection.connect(null);
      myVideo = new NetStream(myConnection);
      myVideo.setBufferTime(5);
      my_video.attachVideo(myVideo);
      this.createEmptyMovieClip("movFLVAudio", this.getNextHighestDepth());
      movFLVAudio.attachAudio(myVideo);
      var snd1:Sound = new Sound(movFLVAudio);
      snd1.setVolume(50);
      myVideo.onMetaData = function(obj) {
            _global.bufTime = obj.duration;
            totalPlayTime = obj.duration;
            trace(_global.bufTime);
      };
      myVideo.play("YOURFLV.flv");
      myVideo.pause();
};
playVideo();

//////////////////////////////////////////////////////////////////////////////
// SLOW MOTION CODE
//////////////////////////////////////////////////////////////////////////////
_global.seekSpeed = 1000;
// (number of milliseconds to pass before going advancing flv frame)
i = 0;
// starting second
function doSloMo() {
      i += 1;
      // increment second
      trace(i);
      myVideo.seek(i);
      // seek to i
}
sloMo = setInterval(doSloMo, _global.seekSpeed);
// set an interval to call the above function.
0
 

Author Comment

by:Epiktet
ID: 16784887
Fantastic!
That's exactly what I wanted, and it's working like a charm.

Thanks alot!

best
Terje
0
 
LVL 2

Expert Comment

by:rythmik1
ID: 16784909
Glad it worked.. and glad you asked.. it gave me some good ideas for using it myself!

:)

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to how to record live broadcast.
Suggested Courses

839 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