So you've decided to assist the HDification of the published movies on TASVideos? Great! We could always use more contributors!
This guide assumes that:
- You are using Windows (Basically, TODO: Write contribution guide that a Linux user can use)
- Have a YouTube account
- Don't have an upload limit (Trust me, if you make videos at a decent rate, you don't want a limit)
- You already have all of the Mencoder related tools normally used for encoding at TASVideos, as well as x264
- Have some MKV muxing tools available
- Have installed Avisynth 2.6 Alpha 2. Available here: http://sourceforge.net/projects/avisynth2/files/AviSynth_Alpha_Releases/AVS%202.6.0%20Alpha%202%20%5B090927%5D/AviSynth_090927.exe/download
- Are able to use VirtualDub
- Have ffdshow installed
- Have the disk space available to dump to a RGB based codec, I personally use the CamStudio codec
- That you don't mind contacting adelikat about uploading TASs to YouTube
Assuming you have all of the above, we can begin. First, dump the AVI from the emulator into the lossless RGB based codec as standard and open it up in VirtualDub, trimming the end for any spare frames. This is where we begin to stray off the standard path; save the AVI into a folder named Avisynth or another name of choice and open up Notepad, copy the following lines into the Notepad document and save as script.avs. The filename can be anything you want, just make sure the file extension is .avs.
#Raiscan's Magnificient Picture biggerizer.
#Upsamples an AVI Source to HD.
#ONLY FOR 2D PIXEL GAMES.
#Use this on anything else and it will be fuggin' ugly.
#VERSION 0.6
#Open the source.
a = AVISource("mixed.avi")
#Check the source is RGB. If it isn't, throw an error, because we want an RGB input.
a = a.IsRGB() ? a : BlankClip(10,800,50).subtitle("Error: Your Source is not RGB. Capture using a RGB codec such as FFV1.",0,0,0,a.framecount-1,"Arial",25,$FF0000)
#Setting the maximum possible size. The script won't resize higher than this.
MAX_WIDTH = 1920
MAX_HEIGHT = 1080
#Get the current width of our source.
curWidth = a.width
curHeight = a.height
#This big block of code checks the dimensions of our source. If it's above or equal to our maximum dimensions,
#We do nothing. Otherwise we check various scalings until we get one which is an integer value yet still
#within the bounds of HD. If source is YUV, don't resize.
e = (a.IsYUV()) ? \
"global b = factor(1,a)" : \
(curWidth >= MAX_WIDTH) && curHeight >= MAX_HEIGHT ? \
"global b = factor(1,a)" : \
(curWidth*6 <= MAX_WIDTH && curHeight*6 <= MAX_HEIGHT ? \
"global b = factor(6, a)" : \
(curWidth*4 <= MAX_WIDTH && curHeight*4 <= MAX_HEIGHT ? \
"global b = factor(4, a)" : \
(curWidth <= MAX_WIDTH*2 && curHeight*2 <= MAX_HEIGHT ? \
"global b = factor(2, a)" : \
"global b = factor(1, a)")))
Eval(e)
#Get the current width and height of our upscaled source.
curWidth = b.width
curHeight = b.height
#Calculate border dimensions. We want to pad out any space left that the resize did not fill.
borderWidth = (MAX_WIDTH - curWidth)/2
borderHeight = (MAX_HEIGHT - curHeight)/2
#Add the border (unless source is YUV)...
c = (a.IsYUV()) ? b : \
b.AddBorders(borderWidth, borderHeight, borderWidth, borderHeight)
#...colour convert to prevent bleeding...
c = c.ConvertToYV24(chromaresample="point").ConvertToYV12(chromaresample="point")
#...and return the finished product.
return c
Function factor(amt, a)
{
b = a.PointResize(a.width * amt, a.height * amt)
return b
}
The above script automatically upscales the video to HD. Optimal resizing is automatically selected so that the video is smaller than 1080p, then borders are added to make it 1080p.
Put the .avs file in the same directory as the video you wish to upscale and either rename the avi to "mixed.avi" or modify the above script in notepad so that the following line:
a = AVISource("mixed.avi")
is changed to match your avi's filename.
Next, open the avs you have made in VirtualDub. You should encounter no problems. From here, save the result into the lossless H.264 codec and make sure that the logo combiner is set up with an appropriate logo for you to you (It is assumed you already know how to do this).
When the video is combined (This should take a while, 10 frames per second on my computer), run the mixed AVI through the following script.
x264.exe --qp 1 -b 0 --threads 2 --keyint 600 --output encodedboth.mp4 mixed.avi
You can set the keyint much higher (Assuming it is a single part video) but for the sake of simplicity, lets not bother setting it higher, the encoding speed benefits of setting it higher aren't that much.
While the video is encoding, extract the WAV from the mixed AVI using VirtualDub (This is my time management side speaking, you can do it whenever the hell you want) and save it into the appropriate place, it isn't worth reencoding it because even if it was, the file will be huge anyway. FLAC encoding can be used if you really want to anyway, YouTube processes it correctly.
When the video finishes encoding, mux the WAV and MP4 into an MKV; MP4 won't suffice for doing this. It is worth noting I have not tested with AVI files yet.
When that is done, give yourself a pat on the back and upload the video to YouTube, be sure to follow the StreamingMedia guidelines for Dailymotion and YouTube.
When all is done, post a link to the video inside the topic and see about getting Movie Editor powers from an admin after a few video uploads.
For movies longer than 10 minutes, you will want to use the MKV splitter to split the MKV into multipart segments, I suggest 8 minute segments personally.
If you can think of any ways to improve this guide or reword it, feel free to edit it as long as you don't rape it all up, mmkay? (No promises. --Raiscan)