Monday, January 19, 2015

How to record animated GIFs and videos of your games with free tools

I feel like a lot of developers and artists just take some screenshots or photos to document their work, and then move on... don't! Think of your project as an engine to generate even more art.

Plus, making animated GIFs of your games and work process is fun!... and uh making videos is still a little painful, though it's a bit of a necessity for any news media or publications to talk about your game. It used to be much worse, if that's any solace? (It's probably not.)

* * *

So first, to make animated GIFs: download GifCam, it's the best free screen-to-GIF software I found, really easy to use. (If you are on OSX, you can use LICEcap.)

Just open up GifCam, line up the see-through window frame on whatever partof the screen you want to record (e.g. the "Game" tab of your Unity Editor?), and hit REC(ord).

Now do whatever it is you want to be recorded.

Click STOP when you're done, then expand the SAVE menu (the arrow button on the right side of the button) and select PREVIEW from the list. In the menu bar for the preview window, check the file size -- it has to be under 2 MB (or ~2,000 KB) to post it on Tumblr or Twitter.

To quickly optimize the file size, you can change the color compression algorithm in the Save menu, fewer colors means smaller file size. However, you'll usually want to keep it at "Quantize" for best results, and if you have a 3-4 MB GIF, you'll need to bring out bigger guns: click the EDIT button, then right-click in the EDIT window to edit the individual frames of your GIF.

When deleting certain GIF frames to optimize the file size, I usually just use two main modes: (a) scroll to a point in your loop, then trim the start / end of the loop with the "Delete from This Frame..." options, or (b) use "Delete Even Frames" to delete every other frame of the animation, usually reducing your file size by 30-50% while doubling the playback speed.

Once you've optimized your GIF, export it out by clicking SAVE. You're done!

Other tips:
  • Keep the image size small! 400 x 200 pixels is probably pushing it, if you want a decent amount of animation while keeping it under 2 MB to post on social media.
  • The REC menu lets you set framerates (33 FPS, 16, or 10)... I recommend keeping it on 10 unless you have something that needs to be super fluid.
  • The REC menu also lets you choose whether to record the mouse cursor or not.
* * *

Okay now to record video of your game! In the past, you had to use some awful Camtastic software, or pirate FRAPS, or some weird QuickTime thing, and don't even get me started about the broken AVI support in Source Engine. Fortunately today, in the beautiful year 2015, there's a great free and legal alternative -- Open Broadcaster Software was designed for streaming games, but it can also render out to a video file on your hard drive. So go download and install OBS. Next:

1) Export or build out your game into an executable, using whatever engine or toolset you use. Then start the program, but in windowed mode. Then alt-tab and task-switch away from it for now.

2) Start up OBS, then right-click on the blank "Sources" box > Add > Game Capture. Select your game from the list of active applications. (This is why we had to start our game already in step 1.) You should also probably enable "Stretch image to screen" so that you don't get a weird black border around the edge of the video.

3) Next in OBS, we should configure your video recording settings. Click on the "Settings" button in the OBS window. In the settings, we have to do two things: (a) Under "Broadcast Settings", set the broadcast mode dropdown to "File Output Only" and set the file paths for what will be your MP4 video files. (b) Under "Video", set the resolution. I usually use 1280 x 720 (720p). You may have to go smaller depending on your computer's processing power, or bigger if you need a high res capture. (If using a laptop, plug it into an outlet!)... when you're done, click OK to save your new settings.

4) We can finally click "Start Recording" in OBS! Alt-tab task-switch back to your game window.

5) Play your game or whatever, perform it, demo it, etc. When you're done, you can quit the game (OBS will stop recording when the application source terminates) but I usually alt-tab back to OBS and click "Stop Recording" manually.

6) Look in the folder on your computer where you set the MP4 file paths from Step 3. You should have some freshly rendered video footage of your game now. Maybe you should upload it to YouTube or Vimeo or whatever?