FIFE forums

Please login or register.

Login with username, password and session length
Advanced search  

News:

FIFE 0.4.0 has been released on 15th of January, 2017!

Author Topic: Playing movies alongside content  (Read 2906 times)

Joshdan

  • Developer
  • Newbie
  • *
  • Posts: 46
    • View Profile
Playing movies alongside content
« on: February 13, 2008, 02:12:52 am »

I am working on re-integrating ffmpeg into FIFE, and would like a little feedback in order to proceed intelligently.

I've gotten the basic decoding and playing handled.  It's probably suitable for cut-scene usage if we shut everything else down, but it can't currently play while the rest of the framework is chugging along. There are two major concerns which I would like to hear opinions on:

#1) Can the movie playback be asynchronous to the rest of the screen refresh?  This would probably allow for both a higher and smoother frame rate (otherwise frames would be unequal in duration, making it look jumpy).  The major issue with this would probably be:

#2) Can we avoid overwriting the movie frames?  If we draw on top the movie, the movie would have to immediately re-write itself to avoid flickering with whatever is writing on it.  This wouldn't be too big a deal, but would make things a little more complicated.
Logged

mvBarracuda

  • Administrator
  • Sr. Member
  • *
  • Posts: 411
    • View Profile
Re: Playing movies alongside content
« Reply #1 on: February 17, 2008, 01:15:58 pm »

Just wanted to reply to say that your work on FFmpeg integration is really appreciated.

Sleek is our view code expert on the team and he might be the only one who can comment on your questions in detail. Unfortunately he's attending a vocational training at the moment and might be busy for about the next 1-2 weeks. I'm sure he'll take a look into your questions as soon as he's back :-)
« Last Edit: February 17, 2008, 02:49:18 pm by mvBarracuda »
Logged

jasoka

  • Developer
  • Jr. Member
  • *
  • Posts: 51
    • View Profile
Re: Playing movies alongside content
« Reply #2 on: February 17, 2008, 04:37:01 pm »

 I would say its reasonable to refresh synchronously, just like with other graphics. We certainly strive to keep framerates over 25fps even on modest system (according to current standards), so video should be smooth enough. Also, it might look even more funny video being smooth while its otherwise slow.

Logged

Joshdan

  • Developer
  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Playing movies alongside content
« Reply #3 on: February 19, 2008, 01:52:52 am »

The thing is, even if we can maintain a 25fps rate or higher, the timing will still be an issue.  The frames will likely be of varying lengths, depending on the processor time needed, etc., and they will be out of sync with the movie anyway. 

To illustrate the sync problem, consider a 24fps video being shown with the game running at 40fps. 

Code: [Select]
+-------+------+-------+
| Time  | Game | Video |
+-------+------+-------+
|     0 |    0 |     0 |
| 0.025 |    1 |     0 |
| 0.050 |    2 |     1 |
| 0.075 |    3 |     1 |
| 0.100 |    4 |     2 |  *
| 0.125 |    5 |     3 |
| 0.150 |    6 |     3 |
| 0.175 |    7 |     4 |
| 0.200 |    8 |     4 |
| 0.225 |    9 |     5 |  *
| 0.250 |   10 |     6 |
| 0.300 |   11 |     6 |
+-------+------+-------+

I've starred the two places where a frame is only shown for half the time of the other frames.  So in this example we always have two frames being shown for too long followed by one frame shown too briefly.  I'm not sure how large an impact this will have, but I think it would be noticeable, if only in a vague manner.  Uneven game frames would of course make this worse.
Logged