Animation Menu

From ETC Public Wiki
Jump to: navigation, search

(Instructions written by Jen Gilbert [jgilbert])

Overview

The animation menu is a piece of content on the Bridge's second Station.

This is meant to be a place where students' project animations can continue to live on. The hard thing with the animation projects, is that the only deliverable is one piece of animation, and it currently has no where to continue to live on in the ETC. So rather than let the work disappear, it can live on here.

How to Add to the Menu

When adding another video into this player, there are several steps that must be done for it to be added to the player.

What you need

An avi movie that is 2048x2048 with audio that matches the level of audio as the other movies Your original movie file(s) A thumbnail that is 256x256 A copy of the files in the etc-studio space and in the bridge sync space

Movie Parameters

In the end your video must be a 2048x2048 .avi with mpeg4 compression.

This does not mean that your video must be a square, but that your video must be sized to that, with padding on the top and bottom, or left and right side. Either the width or the height should fit the 2048 parameter, not both. We do not want to change the intended ratio of the video and stretch or squash it.

All videos must have an audio file in the video.

Converting your Movie

Even if you have a .avi file type, it is probably not the needed mp4 compression (if there is some software (after effects, premiere, etc) that creates this, let Jen know!!!)

So we've been using a converter called ffmpeg. It's free and has quite a large following, so there are a lot of posts about it, so you can typically find the answers to your questions just by looking around.

ffmpeg was introduced to me by Bryan Maher, so I often will turn to him for help.

Inside of here you will find ffmpeg that we've been using.

\\etc-studio\files\Bridge\Screen_Content\main\animation_menu\animations

There is a folder called ffmpeg, grab that entire folder and drag it to your desktop.

Once on your desktop open the ffmpeg folder. Open the bin folder. Double click the cmd

Commonly Used Code for FFMPEG

To convert an existing movie into the correct movie type and size using ffmpeg use this code base:

ffmpeg -y -i \\etc-studio\files\Bridge\Screen_Content\main\animation_menu\animations\Cultural_Awareness\cultural_awareness.avi -vf "scale=2048:1366,pad=2048:2048:0:341:blue" -aspect 1:1 -vcodec msmpeg4 -qmin 4 -b 8000k ca_final.avi

So you just have to change what/where the source movie file is that is to be converted.

The scale and pad part needs a little definition though.

Let's say your original movie is 720x480, and the new file size needs to be 2048x2048.

Since most movies should be wider than they are tall, you can assume that the width will be able to be scaled to 2048. But you can't just make the height 2048, because it will get stretched out. So you have to cross multiply to find the new height size, that is still relatively in it's correct aspect ratio.

Cross multiply: 720/480 = 2048/x

You get your x = 1365.33333333

You need to round this number to the nearest EVEN number. So 1366 is where that 1366 in the code above comes from.


So what's with the pad?

It breaks down to, pad = Final Width: Final Height: Position of x: Position of y: Padding Color

We want this video to be centered in between black bars on the top and bottom of the video. It must be centered, you will NEED those bars, so it NEEDS to be centered.

To do this, you subtract your final height - scale height. So in this instance we subtract 1366 from 2048. The result is 682.

This is the difference, but we need this centered, so divide that number by two. We get 682/2=341. 341 is the y position that the movie should start on.

Other than those couple of things, make sure to change the end movie name. And hit enter.

If that isn't enough:

I previously gave one commonly used piece of text to use in ffmpeg. Every time I've used it there are small changes I've needed to make, other than the previously states ones.

Volume

If your previously rendered movie's audio isn't as loud, or is too loud in comparison with the other movies, you need to adjust it.

You can do this rather easily in ffmpeg.

Somewhere in the code add "-vol #"

The number starts with 256 being the normal volume it currently is. Now gauge that number based on how much louder or quiter your movie needs to be. Use powers of two, the standard numbers for most game engines: 64, 128, 256, 512, 1024, 2048...

Video Codec

Even though the msmpeg4 is creating something that is ok quality and Panda can read, Panda is still having an issue with it. I've made one movie file with a slight alteration to that codec "msmpeg4v2" and we still need to see if that logging error continues with this particular file type or not.

If this solves that problem, then all other movie files will need to be converted accordingly.

Doesn't need Sized

If you've already your movie that the 2048x2048 size parameters, then you don't need to worry about a bit chunk of that previous code. You can instead type this:

ffmpeg -y -i \\etc-studio\files\Bridge\Screen_Content\main\animation_menu\animations\Cultural_Awareness\cultural_awareness.avi -vcodec msmpeg4 -qmin 4 -s 2048x2048 -r 30 -g 30 -b 5000k movie_name.avi

Where's my Converted Movie

I'm sure there's a simple solution to put the movie file exactly where you want on the server, but I find it easiest to just render to the bin folder in the ffmpeg folder, that way I can easily keep track of ALL of my recently converted movies.

So if you've used the code, and followed all the instructions thus far given, your converted movie file should be in the ffmpeg folder on your desktop, in the root of the bin folder.


Ok- I think that does it for the movie portion of this page, let's make a thumbnail and place it all on the bridge!

Thumbnail Parameters

Your thumbnail needs to be 256 x 256 and a png file with button_ and _d in the file name.

Making your Thumbnail

You should take a screenshot from your movie, something that has a good amount of contrast and displays something iconic from your animation.

Go to:

\\etc-studio\files\Bridge\Screen_Content\main\animation_menu\photoshop\button_movie.psd

Open the photoshop file: button_movie.psd

In the layers there are three groups: alpha (Dont Touch), Frame (Dont Touch) and movies.

Keep the alpha (Dont Touch) hidden, you won't need to do anything with that.

Expand the movies group.

Inside of that group you will find thumbnail images from the other movies. DO NOT delete these files.

Add your thumbnail into this "movies" group.

Size your thumbnail until it looks good under that black and blue framing. It is ok if your image is larger than that black and blue frame, it will not be seen. Only the part of your thumbnail within the black and blue border will be seen.

Make any adjustments to contrast you think will be helpful.

Save the file as "button_movie_name_d.png" Change the movie_name part to whatever your movie name is. Keep the button_ and _d.png in the title.

Save it to:

\\etc-studio\files\Bridge\Screen_Content\main\animation_menu\models\textures

And save the photoshop file with your thumbnail added. Don't delete anything unless you added it.


Placement on the Servers

Alright, we want this in two different areas, on the working space and the final sync to the bridge space.

Those two areas are NOT both on randon. One is on a server called \\etc-studio\files, while the other is \\randon\etc

etc-studio

All working files for the video, including the original and final must be saved here:

\\etc-studio\files\Bridge\Screen_Content\main\animation_menu\animations

Make a folder with the name of your video as it will be called and inside of that folder make a final folder. You now are ready to start placing your videos.

You might have multiple original files, like a .mp4 and .wmv, or you might have a web version and a HD version. Copy them all just in case into the root of your movie folder. If this is confusing look at some of the other animation folders to see what they did.

And in your final folder there should be the one and only final movie, named the same as your movie folder.

If you followed the instructions for making a thumbnail, then your thumbnail should already be in it's proper place.

If not, your final thumbnail with it's proper framing should be located here:

\\etc-studio\files\Bridge\Screen_Content\main\animation_menu\models\textures


That's it for the working space, now let's set up Randon.

randon

This Animation Menu is displayed on both station 2 and station 5 up on the bridge. So you will need to copy this information twice.

Navigate to here:

\\randon\etc\projects\internal\spacebridge\bridge-sync$\Bridge2\Content\menuContent\aniMenu\movies

Place your Final Movie File here. This should only be one file.

Navigate to here:

\\randon\etc\projects\internal\spacebridge\bridge-sync$\Bridge2\Content\menuContent\aniMenu\models\textures

Place your button_movie_d.png here.

Navigate to here:

\\randon\etc\projects\internal\spacebridge\bridge-sync$\Bridge2\Content\menuContent\aniMenu

Open the config_aniMenu.py (typically open with pype)

Find the green comment text that states "# the button texture and content must be in the same order" the two lines under that line are the ones you will update and change.

On the CONTENT line, after the square bracket [ type in ""movie_name.avi"," Yes, you need the quotes around your movie's name.

On the BUTTON_TEX line, after the square bracket [ type in ""button_movie_name_d.png"," Yes, you need the quotes around your button's name.

If you just place these as the first thing after the square bracket, you won't have to worry about keeping track of the order of content matching with button.


Now, REPEAT all of this, except do it on Bridge5 of the bridge-sync$ folder.

But we're not done yet...

Syncing the Bridge

Just because you've put your movies and buttons into the sync folder, doesn't mean it has already sync'ed the two up. You have to initialize it on the bridge machines.

VNC into spacebridge12 and spacebridge15, and it may be easier if you also VNC into spacebridge10.

With 10 open, stop bridge2 and bridge5.

With bridge2 open, double click on the sync shortcut. Keep doing this and hitting ok or cancel until it finds the path on randon successfully and opens a command window. If it syncs in a second and tells you it's finished, it's lying. Sync it again, and maybe once more for good measure.

Do the same process on bridge5.

Return to bridge0 and start bridge2 and bridge5.

Open bridge2 and 5 and see if all of the content populates correctly. If yes, go up to the actual physical bridge, and test the program.

Test it on both stations 2 and 5.

While you're hear, compare the audio levels. Play your movie, and then play a different one. Compare if your movie is too loud or too quite. You may need to make adjustments.

If your movie works on both and the audio is fine, then you are done. Congratulations.

What is currently in the menu

Cultural Awareness

Don't Feed the Birds aka The Granny Project

Mission Rendezvous

Collectible

The Gnome Project

What needs worked on

Big Surprise: It's an old file type from several years ago. And the way it compiled the audio just doesn't render properly from ffmpeg.

Errors

1. Frames and Audio Conversion

Initially I was trying to convert the movies into frames, then separate the audio from the original movie, and use ffmpeg to splice it back together.

But that ended up erroring out over and over. So we moved to taking the existing videos and just converting them, and scaling/padding where need be. This problem is not yet solved, but isn't an issue as long as the movie files are being converted from already existing movie files rather than frames to be combined with audio.

2. Big Surprise

Not sure why, but using the scale and pad on the movie method errors out.

"Error while opening encoder for output stream #0.1 - maybe parameters such as bit_rate, rate, width or height"

I tried tweaking some things, I'm pretty sure my numbers are correct. Going to have to ask Bryan what he thinks. Could it be because it's a wmv file?

His conclusion was a series of audio codecs and slight changes, that still caused error. This problem is not yet solved.