Let's talk about in-game Videos!

Hey folks!
Let’s talk about how you can play videos in the UI. And maybe you can help me with something too. :slight_smile:

(This is a little ahead of schedule to talk about these, but hey!)

One of the first things we did was switch from Divx video playback to WebM. (WebM is a fantastic free format that google release awhile back.) This allowed us to encode the animatics and other videos at a great compression ratio and high quality.

In the UI you can have a video play in any user interface element. Just add this:

BackgroundVideo = {
    filenameV = "data:animatics/mainmenu.webm",
    loop = 1,
}

You can also add this line to have audio play as the video plays (if it’s not already embedded in the video):

filenameA = "data:Sound/Music/ANIMATIC/credits","

The video will stretch to fill the element it is in. Also keep in mind that playing videos in-game can affect performance. Also, this is a very unsupported feature outside of where we used it in the game.


The tool I used to create the Webm files was ffmpeg. Using that tool an example cmd line I used was:

ffmpeg  -i "logo.avi" -c:v libvpx -vpre 1080p -c:a libvorbis -q:a 10 "logo.webm"

A more complex example specifically for animatics. (As a .bat file)

set video_out_args_BW=-vf format=gray -c:v libvpx -vpre 1080p   
set audio_out_args=-c:a libvorbis -q:a 10 
set mappings=-map 0:0 -map 1:0 

ffmpeg -i "HW - 01.avi" -i "Ani_00_01_to_ogg.wav" %mappings% %video_out_args_BW% %audio_out_args% "A00_01.webm"

So to my issue:

  • I’m needing to recompress some of the animatics to fix a few bugs. These puppies are big even with the solid compression WebM offers.
  • I don’t want to have everyone download a giant patch due to some video fixes. (but it’s important everyone gets these fixes.)
  • The majority of the animatics are very still. Not a lot of movement.

For those of you who have used WebM or ffmpeg:

  • Are there better ffmpeg options I could use to get the webm filesize down to as little as possible without hurting the quality?
2 Likes

cool wasn’t too hard to replace the main menu with a random video and the version text box, I remember this being an often requested feature for the main menu background

It does look like it right justifies videos by default when fitscreen=1 is on

any UI element? can we get a random container sample ? I can definitely imagine starcraft style unit portraits then

sorry not a lot of experience with ffmeg

1 Like

My mind went straight to Starcraft style unit videos as well. This is going to be fun!

That is a good idea with the unit portraits! :smile:

I wouldn’t use fitscreen unless it’s a fullscreen video. It has more issues than not.

There should be a mainmenu.webm in there that we made for the HW2 RM main menu. A high quality video playing in fullscreen behind everything made the interface not very snappy on low end hardware, so we switched to a static image. If you want to resurrect it for a mod, have at!

The correct way to fullscreen a video (without stretching or clipping is:

Layout = {
	pos_XY = { x = 0.5, y = 0.5, xr = "par", yr = "par" },	
	pivot_XY = { 0.5, 0.5 },
	lockAspect=1920/1080,			
	size_WH = {	w = 100000, h = 1, wr = "px", hr = "par" },   -- 100000 is to force the layout to the correct aspect
	max_WH = {	w = 1.0 , h = 1.0, wr = "par", hr = "par" },			
},		

I’m considering fixing all the animatic layouts with this snippet, but I think I’m going to switch back to the other UI stuff now. :slight_smile:

1 Like

Will performance be better if we don’t use compression?

I mentioned in another thread that I’m running with a 5760 X 1080 resolution and currently the clipping is pretty severe on all the animatics. how would that snippet effect my viewing ? better or worse

It would fix it 100%. I ran a few using my crazy setup and I might just go ahead and fix them.

What it does is makes it always fit in the screen and if the screen is too big in any direction, it adds black bars, vertically or horizontally.

2 Likes

Performance would probably be way worse without compression.

The bigger optimization is to not use a 1920x1080 video. Using little videos, like little 256x256s seems to not be a performance issue as far as I’ve tested. That said, not supported. Except that I just added the ability to set their translucency in the next patch. But yea. Not supported. :smile:

Do something with them and I might support them!

1 Like

:open_mouth: Don’t just sit there talking about it !! get it nailed in you tease :slight_smile:

Haha, I found your old mainmenu.webm. Nice job with that HW2 style background, although I greatly prefer the static image of Hiigara <3

Looking forward to this! What kind of bugs you fixed? :smiley:

I agree. Totally love the two planet backgrounds.

I’m trying to fix as many UI bugs as I can that affect the most number of people. That said, these multi-monitor folks are really demanding!

@jim1 : Fixed! If QA approves the change it’ll be in the next patch.

2 Likes

What’s the best way using a script to turn off the UI temporarily in order to take screenshots?

Gotta love folks who love these wacky aspect ratios.

2 Likes

@Mikali
ToggleNoCursorOnOutside()

Yea, no idea why it’s named that. Also ctrl+shift+n might toggle it. (I’m on a dev build and have all kinds of wacky binds that I can’t test on a shipped build.)

That is worse than designing a mobile-friendly website.

Homeworld Responsive Remastered.

I had nightmares with css code attacking me.

I meant a gametype function. HW2_Letterbox() is okay except for the black bars…

Not sure what you are trying to do, but for screenshots ToggleNoCursorOnOutside should work.

I tried calling the function in a gametype script and I got an error:

parameter: attempt to call global ToggleNoCursorOnOutside' (a nil value) stack traceback: 1: functionOnInit’ at line 93 [string “”]
SCAR ERROR: could not find OnInit function in rule file (data:LevelData\Multiplayer\PIEPLATETEST.LUA)-- FATAL EXIT --scar/254:!–stack trace–

Also, another stupid question. Is there a way to change the name of a screenshot to the name of the level that is loaded?

What I am trying to do is take screenshots of maps. I have 1500 of them, and am trying to automate the process as much as possible.

I don’t suppose you could just press backspace a few times till the UI is hidden then use the gametype script to change the map? Or would that bring back the UI when it changes?

There’s also the “-ssNoLogo” (“Take screenshots without logo”) command line switch.

You can’t change the map using a gametype script unless you read/write to disk, which is tricky. I’ll have to think about it.