encode_youtube.bat

This post was last updated: 2 Sep 2016 17:53

Finally decided to write a script that will make my YouTube encoding easier.

screenshot

Features

  • Upscales SD (less than 720p) video to 720p30 or 720p60 (both 4:3 and 16:9) to take advantage of YouTube 60fps
  • Encodes HD video such as 1080p30 and 1080p60
  • Can trim (set start time and end time)
  • Encodes follow YouTube's Recommended upload encoding settings (Level 4.1, profile high, 4:2:0 pixel format, 2 bframes, etc.)

Installation/Usage

  • Download (right click, save as): encode_youtube.bat
  • Have ffmpeg in path
    • An easy way to get ffmpeg in path is to just download a ffmpeg build from here and put ffmpeg.exe in the same folder you put this script in.
  • Drag n drop a video file onto the .bat
  • Answer the few questions (the default answers are in (paranthesis))

Please note: This script does not deinterlace or scan line double video. If you have a interlaced capture (30 fps) you should deinterlace it first in something like Yua. You can then drop the 60 fps video from Yua onto this script.

For quality tests, scroll down.


Until now I always used to google for stuff like "ffmpeg trim" to figure out how to trim something. Now I have a script with it and I don't have to manually type out a ffmpeg command.

"Why not just use Yua or anri-chan?"

First of anri-chan is incredibly outdated. I do however prefer it over Yua in some cases, as it doesn't do that audio amplification factor thing.

Yua is a good, simple to use, tool. If I was submitting a run to SDA I would definitively encode using that.

But for what I'm trying to do here, get videos from Amarec onto YouTube as fast as I can, Yua is no good:

  • It does some kind of Audio Amplification Factor calculation that takes way too long
  • It doesn't upscale to 720p

Why not use Don Melton's video transcoding scripts that you are so fond of, or just Handbrake?

I am fond of his scripts, and I do still use them for my DVDs and Blu-Rays. They are excellent. But not for my gaming videos:

  • They don't upscale to 720p
  • The quality targets are not suitable for a 60 fps racing game like F-Zero

It does have some nice features though, like automatic cropping.

As for why I don't use plain Handbrake: it doesn't upscale to 720p (that might be possible though, I haven't looked much.) I also hate Handbrake's GUI.

It's CLI component, HandbrakeCLI, is interesting though. I might look into that to get automatic cropping and simple deinterlacing. ffmpeg is more portable though, just a single .exe file. So for now it's gonna be using ffmpeg.If I decide to re-write it in a language that's not batch I might switch to HandbrakeCLI.

Future plans

  • Cropping (delete black borders automatically, not sure how this will mess with aspect ratio though)
  • Rewrite in a better language than BATCH. Probably Python.
  • Watermarking so people can't steal your videos
  • Burn-in timer?

Quality tests on YouTube

Here are a bunch of quality tests I've uploaded to youtube using an older version of this script. Video quality should be the same though. Audio quality is not the same (it's worse.)

When you watch these, please remember that YouTube re-encodes everything you upload to them. Therefore, a game like F-Zero GX is very very hard to get good looking on YouTube.

NES RGB 240p

  • See my dedicated NESRGB blogpost: NESRGB

SNES RGB 240p

N64 RGB 240p

Gamecube/Wii Component 480p

PS4 HDMI 1080p

github logo