Author Topic: New cutscene player (more supported formats, better performance)  (Read 22285 times)

0 Members and 1 Guest are viewing this topic.

Offline m!m

  • 211
New cutscene player (more supported formats, better performance)
Quote from: February 2015 Interview
Mjn.Mixael: H264 for cutscenes, music seek-to-time SEXPs, and model translation animation support
Hmm, H264 support, that doesn't sound like it's too difficult to implement.
After a few weeks of looking through documentation and cursing those who wrote it I arrived at an acceptable solution: http://www.mediafire.com/download/2dovsb3t83w5d2d/FSO-FFmpeg.7z
Source code: https://github.com/asarium/fs2open.github.com/tree/feature/ffmpeg

What does this do?
The changes in those builds add support for decoding a wide range of video and audio formats, notably H.264. It also improves the performance of cutscene playback by using a separate thread for video and audio decoding.
It uses the ffmpeg libraries which do all the hard work. The currently version is capable of smoothly playing a 1080p Theora (Ogg) or H.264 encoded cutscene (I tried playing the amazing end cutscene of ST:R with RC5, it was horrible :shaking:).

Known issues
The build is based on the Antipodes branch which is a bit out of date so you should only use these build with retail data or mods that support older versions of FSO. The easiest way to test these build is to put the movie you want to see in data/movies and renaming it intro.ogg or intro.mp4 (depending on what format you are using).
« Last Edit: May 04, 2015, 12:48:02 pm by m!m »

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: New cutscene player (more supporte, better performance)
Well well.... I know what I'm doing later.
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: New cutscene player (more supporte, better performance)
We have to jump through quite a few hoops to legally use FFmpeg.  For this example, was #1 followed?

FWIW, OpenH264 is BSD-licensed, hasn't been out too long so it might have not been around the last time people were thinking about video codecs.
« Last Edit: March 26, 2015, 09:58:54 am by chief1983 »
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline m!m

  • 211
Re: New cutscene player (more supporte, better performance)
Well, looks like I have to compile ffmpeg myself (seriously, **** GPL. Who thought such a piece of crap would be a good software license? :hopping:).
I am currently using precompiled binaries that were compiled with --enable-gpl so I have to compile ffmpeg myself without that flag so I can link those libraries dynamically to FSO (I hope it will still have the necessary features...).

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: New cutscene player (more supporte, better performance)
We have to jump through quite a few hoops to legally use FFmpeg.  For this example, was #1 followed?

FWIW, OpenH264 is BSD-licensed, hasn't been out too long so it might have not been around the last time people were thinking about video codecs.

I'm wary of trying/using yet another generally untested video thing...
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: New cutscene player (more supporte, better performance)
There may be other options, it's just the first one I found that's not LGPL/GPL.  Not saying we can't do LGPL, but in the FFmpeg case we definitely have to disable the GPL and non-free parts, and we also have to meet all the other LGPL license requirements to the best of our ability.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline m!m

  • 211
Re: New cutscene player (more supporte, better performance)
I compiled my own FFmpeg binaries without "--enable-gpl" and it looks like all the needed features are still there. Link in the first post has been updated.
For anyone curious, here are the resulting binaries: http://www.mediafire.com/download/irvgy2ry51r8z3l/FFmpeg-lgpl-shared.7z

 

Offline Cyborg17

  • 29
  • Life? Don't talk to me about life....
Re: New cutscene player (more supporte, better performance)
It also improves the performance of cutscene playback by using a separate thread for video and audio decoding.
 


Multi-threading in mai freespace???

 

Offline m!m

  • 211
Re: New cutscene player (more supporte, better performance)
Multi-threading in mai freespace???
Don't worry, it's just one additional thread :P

 

Offline m!m

  • 211
Re: New cutscene player (more supporte, better performance)
ngld kindly checked and fixed the code for linux so this should also compile and run on linux.

 

Offline Flaser

  • 210
  • man/fish warsie
Re: New cutscene player (more supporte, better performance)
First thing first: AWESOME job, this feature should make adding cutscenes to games/mods a lot easier! (Since devs can use more or less "standard" tools for creating video files instead having to deal with the vagaries of Theora).

IIRC, FFMpeg supports a bunch of codecs, are all these features available for developers or should they only stick with h264? If features are available, what codecs (at what specs, e.g. hi10 vs 8-bit encoding) are recommended for use?
"I was going to become a speed dealer. If one stupid fairytale turns out to be total nonsense, what does the young man do? If you answered, “Wake up and face reality,” you don’t remember what it was like being a young man. You just go to the next entry in the catalogue of lies you can use to destroy your life." - John Dolan

 

Offline m!m

  • 211
Re: New cutscene player (more supporte, better performance)
The list of supported formats depends on how the libraries were compiled. I needed to disable a few features because we can't use the GPL version but here is a list of what the current libraries support:
Once FFmpeg is merged into trunk/master we probably will create some kind of list of formats that must be supported by "official" builds.
The current build still checks all available extensions but I have already changed that to only check ogg, mp4 and webm. Those formats will always be supported.

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: New cutscene player (more supported formats, better performance)
As I said on IRC. I approve of this build.

It plays 1080p cutscenes (while scaling them for my current monitor) like they were nothing. I suspect I could stick to releasing just 1080p cutscenes and not multiple resolutions when this gets into the master branch.
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline m!m

  • 211
Re: New cutscene player (more supported formats, better performance)
I uploaded new builds that should be more in sync with the current master branch.

 
Re: New cutscene player (more supported formats, better performance)
I'm looking forward to this. I remember that when I tried to play the 1080 version of the FS1 endgame cuscene when it first came out, I could only play it well in a dedicated media player. In game it froze and stuttered. This is gonna be awesome.
There are only 10 kinds of people in the world;
those who understand binary and those who don't.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: New cutscene player (more supported formats, better performance)
Just out of interest, has anyone tried using this code to see what performance is like when the movie is in a VP file? Cause originally Diaspora VP'd all our movies but eventually put them loose in the data/movies folder due to performance issues.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline jr2

  • The Mail Man
  • 212
  • It's prounounced jayartoo 0x6A7232
    • Steam
Re: New cutscene player (more supported formats, better performance)
Hmm.  I thought .vp was uncompressed?  How would that cause a difference (besides for a split second to open the .vp)?  :confused:

 

Offline m!m

  • 211
Re: New cutscene player (more supported formats, better performance)
There is a bit of overhead from reading in a VP file as the read pointer has to be moved to the right position in the file. For optimal performance cutscenes should not be stored in a VP but I can't confirm or deny that VPs cause a performance hit (it would need to be very serious hit as the decoder thread is idle for quite a long time even when reading a 1080p video).

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: New cutscene player (more supported formats, better performance)
I'll test it out this evening
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: New cutscene player (more supported formats, better performance)
Playing from a VP seems just as fast. I tested a 1080p .ogg video file. (STR's Endgame)
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.