Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: mjn.mixael on May 05, 2010, 08:37:09 am

Title: Video Processing
Post by: mjn.mixael on May 05, 2010, 08:37:09 am
I wasn't really sure where this topic belonged but here it is anyway...

So I've been playing through FS1 with my Ancients cutscenes installed. All fine and dandy except that in-game my computer often has issues running the 1080p versions. I've got a pretty good rig here that can easily handle these scenes out of the game, but in-game there is often lag in the video and skipping in the audio.

I'm no programmer, so I probably don't understand what I'm talking about here. (Feel free to correct me or tell me I'm an idiot  :D)

But what is it about the game and how it plays cutscenes that causes so much lag in the playback? Is it the lack of multi-thread support or something along those lines? Is there a way this could be improved?

With that said, the 720p version run smoothly as far as I can tell. I guess the 1080s hit the limit as far as data processing goes?
Title: Re: Video Processing
Post by: The E on May 05, 2010, 08:42:39 am
My guess would be that the theora decoder we're using cannot handle the bitrates due to it being single-threaded. Getting it multithreaded probably needs another change of the libogg code we're using right now.
Title: Re: Video Processing
Post by: mjn.mixael on July 21, 2010, 02:57:30 pm
Hate to be *that* guy.. but I just gotta bring this up again... I'm trying to optimize the new FS1 endgame to run in FSO. Unfortunately, even at 720p it has to take a very significant quality cut to be able to run. I'm not programmer, so like I said before I don't know what can be done. But surely we can do *something* about it.
Title: Re: Video Processing
Post by: Fury on July 22, 2010, 03:50:11 am
IMO 480p is quite enough for FS cutscenes. Even at 480p (848x480) resolutions, they're still significant improvement over originals. What I would suggest to do, is to create 480p and 720p renders of all cutscenes. 480p would be used in projects, possibly swapping later to 720p when it becomes technically viable.
Title: Re: Video Processing
Post by: Lt.Cannonfodder on July 22, 2010, 05:09:59 am
Keep in mind the playback problem is not an issue faced only by the reworked FS cutscenes. We ran into the same problem with Diaspora cutscenes playing at 720p, though only with somewhat dated computers. It would be nice indeed to be able to use the full 1080p versions.
Title: Re: Video Processing
Post by: mjn.mixael on July 22, 2010, 10:04:19 am
IMO 480p is quite enough for FS cutscenes. Even at 480p (848x480) resolutions, they're still significant improvement over originals. What I would suggest to do, is to create 480p and 720p renders of all cutscenes. 480p would be used in projects, possibly swapping later to 720p when it becomes technically viable.

When you stretch 480p out to current screen sizes.. things look bad... The original as 640x320.. you are saying to only add 160 pixels then scale it up from 853x480 to (in some cases as high as 1920x1080). Have you ever watched like a VHS on an HDTV. That's about the effect you will get and it's the problem with the original FS cutscenes. They are just too small. If you watch them without stretching the look pretty good.

Sorry, I'm kind of ranting a little bit and I don't need to be.

I'm just thinking that being limited to 480p video or 720p (highly compressed) shouldn't be an issue. I'm just gonna guess (because I don't know) that other current games aren't limited to 480p. Why do we need to be? With everything the SCP guys have done, I'm sure we have the talent to deal with this.
Title: Re: Video Processing
Post by: DaBrain on July 22, 2010, 03:18:05 pm
720p is the current cutscene standard in games. At least this should run well on a fairly decent system.

480p is very outdated... It would be a shame to scale well made videos down to 480p.

A change of the libogg code doesn't sound like something impossible.


mjn.mixael has spent a lot of time working on the cutscenes. I think we should support him any way we can.

Title: Re: Video Processing
Post by: The E on July 22, 2010, 08:13:25 pm
Yes, but the question is, what change do we have to make? Where's the bottleneck that hampers performance? That's something we gotta find out, and I sort of fear that that will take some time.
Title: Re: Video Processing
Post by: sigtau on July 22, 2010, 10:23:07 pm
Yes, but the question is, what change do we have to make? Where's the bottleneck that hampers performance? That's something we gotta find out, and I sort of fear that that will take some time.

Well, not to be a complete dickhead, but it'll happen sooner if we start sooner.
Title: Re: Video Processing
Post by: mjn.mixael on July 22, 2010, 11:41:11 pm
I dunno if this means anything or helps at all, but the file size seems to be a big source of the cause. The endgame 720p wouldn't play properly until I got it well under 100MB.. Which meant more compression, which meant a big loss in quality. So I would assume that any file regardless of resolution will play if it is less than 100MB.
Title: Re: Video Processing
Post by: [Wolf]Maverick on July 22, 2010, 11:58:18 pm
What if you break the one big 1080p video file into smaller parts all under 100MB. You choose a scene where a cut weren't too bad, and then the next file would be loaded. Of course this is should only be a temporarly solution, until FS2 can handle big video files correctly, which is soon.. i hope.
I think 480p isn't really an option. I'm using an 32'' and 47'' LCD both in Full HD and videos in 480p does not look good, stretched in Full HD.

But of course this is only my opinion.

Mav
Title: Re: Video Processing
Post by: General Battuta on July 22, 2010, 11:59:13 pm
That unfortunately won't work as there's a per-campaign cutscene limit.
Title: Re: Video Processing
Post by: portej05 on July 23, 2010, 01:44:12 am
I'm looking at this one. Code is pretty vicious after a long break :P
Title: Re: Video Processing
Post by: kkmic on July 23, 2010, 03:06:21 am
I'm looking at this one. Code is pretty vicious after a long break :P

Go portej! :D
Title: Re: Video Processing
Post by: Lt.Cannonfodder on July 23, 2010, 03:43:41 am
Beer and hookers if you succeed!
Title: Re: Video Processing
Post by: Kolgena on July 23, 2010, 07:19:53 pm
I dunno if this means anything or helps at all, but the file size seems to be a big source of the cause. The endgame 720p wouldn't play properly until I got it well under 100MB.. Which meant more compression, which meant a big loss in quality. So I would assume that any file regardless of resolution will play if it is less than 100MB.

It might be worth it to figure out if the bottleneck is in bitrate or file size. Perhaps make a 80MB snippet of omgquality 1080p?
Title: Re: Video Processing
Post by: portej05 on July 23, 2010, 07:55:30 pm
The buffering is one thing I'm looking at - looks like it does 4K reads at a time... (assume worst case latency of 500ms each time...)

I'm not totally sure about that though - I'm still trying to figure out whether the colour conversion really needs to be done that way (it's applied to every pixel, so faster == muchmuch better).
Title: Re: Video Processing
Post by: chief1983 on July 24, 2010, 05:27:08 pm
I just read today that the ffmpeg coders released a free and fast implementation of the VP8 codec.  It's already x86/64 optimized, and should be getting ARM and PPC optimization soon.  If we could implement that codec we might have an alternative for high res cutscenes that we could actually play.  Of course, the bottleneck could be in the FSO side somehow, in which case that wouldn't really help at all.
Title: Re: Video Processing
Post by: mjn.mixael on July 24, 2010, 06:29:05 pm
Hmmm, I don't really know how all the code stuff works out.. but it seems like there are some things that can be tried!

I want to extend my thanks for those looking into the issue.

/optimistic feeling
Title: Re: Video Processing
Post by: Mongoose on July 24, 2010, 06:57:23 pm
I experienced some stuttering with one or two of the 720p versions myself, so I'd be more than happy to help out on the testing side of things if you guys need it.
Title: Re: Video Processing
Post by: FUBAR-BDHR on July 24, 2010, 07:51:44 pm
Wasn't there another video format in the engine awhile back?  If so testing an old build with video in that format might tell if it's an engine issue or with just ogg. 
Title: Re: Video Processing
Post by: chief1983 on July 24, 2010, 10:31:37 pm
There wasn't another format, there was support for wrapping to the Windows-only system codecs in AVI files.  Due to the manner it worked, I doubt it would serve for a useful comparison.
Title: Re: Video Processing
Post by: portej05 on July 25, 2010, 03:17:34 am
There's no easy way to tell given the way that each format is coded in the engine - they're all basically separate video players.
Title: Re: Video Processing
Post by: WMCoolmon on March 22, 2011, 02:58:58 am
Sorry for bumping an old thread, but somebody already mentioned ffmpeg.

Has anyone tried/considered libavcodec? It is (according to Wikipedia) LGPL, which IIRC is compatible with the FS2Open license. In addition it should be able to handle Theora and is cross-platform. The API is not well-documented but streaming video (perhaps audio?) is very doable.