LPer's Guide to Video Processing

Joined: December 19th, 2012, 7:17 am

August 6th, 2014, 8:31 pm #1

LPer's Guide to Video Processing

-or-

"How to Use FREE Tools to Craft High Quality Videos that Upload Fast* to YouTube"

*) It'll be up to you to decide how high quality you want. The higher the quality, the longer it'll take to upload. If you have fast connection (upload) and/or you're willing to use more time for the upload, go for higher quality. If uploads take ages (and even fail because of it), decrease the quality for smaller file size using the instructions below.

MY PROCESS

I record most LPs/videos with Dxtory. In Dxtory I use UT Video Codec (UtVideo YUV420 BT.709) for video and uncompressed PCM (48Khz) for audio. This way the video and audio is lossless before encoding. UT Video Codec works the best for me on 60 fps, I opted to use that, but Lagarith Lossless Codec is other great option (especially for 30 fps)

Then I use VirtualDub to encode (compress) the video (and audio in it) for uploading. I do minimal editing (split long session into multiple videos. VDub is not much of a video editor, but an awesome encoder). I process my audio with Audacity and give VirtualDub/qaac one audio-file to encode. See LPer's Guide to Audacity for details on audio processing.

Following the YouTube advanced encoding settings I encode my videos to:

Container: .mp4
Audio Codec: AAC-LC
Video Codec: H.264

(Details: https://support.google.com/youtube/answer/1722171?hl=en)

YouTube does accept a lot of formats, but these work well for me. For super HQ uploads one could use ProRes and PCM, but H.264+AAC in .mp4 (or H.264+AC3 in AVI) can be very high quality without ridiculous file sizes and upload time, so I recommend them.

TOOLS

Some useful tools and ways to use'em to get there:

VirtualDub
VirtualDub is an incredibly powerful (but somewhat hard to use) video encoder/processor.
http://www.virtualdub.org/

x264
x264 is a free software library and application for encoding video streams into the H.264/MPEG-4 AVC compression format
http://www.videolan.org/developers/x264.html (official page)
http://www.x264.nl/x264_main.php (command line version, external encoder for VDub)
http://komisar.gin.by/ (VFW for VirtualDub .AVIs)

qaac
qaac is a command line AAC/ALAC encoder frontend based on Apple encoder
https://sites.google.com/site/qaacpage/

MP4BOX
MP4BOX is a multimedia packager, e.g. for creating mp4 container (streaming, fast start format that YouTube likes)
http://gpac.wp.mines-telecom.fr/mp4box/

FFmpeg
FFmpeg is Jack of All Trades in video processing. Can do everything via command line. Great for scripts or external encoding from VDub. You could do everything with just FFmpeg, but other specialized tools give more, in some cases better options.
https://www.ffmpeg.org/

Codecs
K-Lite Codec Pack, all the codecs you need and then some (even with the Basic pack):
http://www.codecguide.com/download_kl.htm

ENCODING AND PROCESSING SETTINGS

* Different CRF values for x264 give different quality (0 to 51, from highest quality to the lowest), higher the quality, the bigger the bitrate and the file size. CRF 16 will give very high quality, but a big file. CRF 23 is the x264 default and gives a good compromise between quality and file size. Bitrate and file size depends on the video / game you're recording.
* I use "slow" preset for x264 for smaller file size. Using veryfast or medium and you'll encode faster, but get bigger file. Presets have no or minimal effect on quality (slower presets use more time to get smaller file).
* I use --tvbr 127 for qaac for MAX quality. This is probably an overkill and 100 or even 63 would be OK, but higher the number the higher the quality (qaac wiki).

H.264 (x264) & CRF

The Constant Rate Factor (CRF) is the default quality setting for the x264 encoder. You can set the values between 0 and 51. The lower the value the better the quality (at the expense of higher file sizes). The values between 16 and 28 are most used.

The default for x264 is 23, so you use it as a starting point and increase CRF for smaller filesize (at the expense of quality) or decrease it for higher quality (but larger filesize). A change of ±6 results in about half/double the file size, but results might vary.

(Source: http://slhck.info/articles/crf & https://trac.ffmpeg.org/wiki/Encode/H.264)

INSTRUCTIONS

How to use MP4BOX to combine two (or more videos)

Code: Select all

mp4box -force-cat -add "C:\pathtovideo1\video1.mp4" -cat "C:\pathtovideo2\video2.mp4" -new "C:\pathtofinalvideo\finalvideo.mp4"
(all files in the same dir)

Code: Select all

mp4box -force-cat -add 1.mp4 -cat 2.mp4 -cat 3.mp4 ... -cat n.mp4 -new 1-n.mp4
How to use VirtualDub to save directly to MP4:

VirtualDub: save direct to MP4 with external encoders

I use qaac instead of NeroAAC for audio, but the guide is solid. And the process works for any video, not just Fraps recordings, it's just that the EncodingTalk forum used to the FrapsForum

EXTERNAL ENCODERS for VirtualDub

My external encoder package (check the above link for instructions how to use this in VirtualDub):
[+] spoiler

Code: Select all

{
"description": "Zemalf's VirtualDub External Encoder Profile Collection",
"externalEncoders": {
	"sets": {
		"mp4 x264 r16+qaac": {
			"videoEncoder": "V x264 r16",
			"audioEncoder": "A qaac aac vbrMAX",
			"multiplexer": "M mp4box",
			"description": "mp4",
			"extension": "mp4",
			"processPartial": true,
			"useOutputAsTemp": false
		},
		"mp4 x264 r19+qaac": {
			"videoEncoder": "V x264 r19",
			"audioEncoder": "A qaac aac vbrMAX",
			"multiplexer": "M mp4box",
			"description": "mp4",
			"extension": "mp4",
			"processPartial": true,
			"useOutputAsTemp": false
		},
		"mp4 x264 r23+qaac": {
			"videoEncoder": "V x264 r23",
			"audioEncoder": "A qaac aac vbrMAX",
			"multiplexer": "M mp4box",
			"description": "mp4",
			"extension": "mp4",
			"processPartial": true,
			"useOutputAsTemp": false
		}
	},
	"profiles": {
		"V x264 r16": {
			"name": "V x264 r16",
			"program": "x264.exe",
			"commandArguments": "--crf 16 --preset slow --profile high --bframes 2 --demuxer raw --input-res %(width)x%(height) --fps %(fpsnum)/%(fpsden) --colormatrix bt709 -o \"%(tempvideofile)\" -",
			"outputFilename": "%(outputname).264",
			"type": 0,
			"inputFormat": 0,
			"checkReturnCode": true,
			"logStdout": true,
			"logStderr": true,
			"bypassCompression": false,
			"predeleteOutputFile": true
		},
		"V x264 r19": {
			"name": "V x264 r19",
			"program": "x264.exe",
			"commandArguments": "--crf 19 --preset slow --profile high --bframes 2 --demuxer raw --input-res %(width)x%(height) --fps %(fpsnum)/%(fpsden) --colormatrix bt709 -o \"%(tempvideofile)\" -",
			"outputFilename": "%(outputname).264",
			"type": 0,
			"inputFormat": 0,
			"checkReturnCode": true,
			"logStdout": true,
			"logStderr": true,
			"bypassCompression": false,
			"predeleteOutputFile": true
		},
		"V x264 r23": {
			"name": "V x264 r23",
			"program": "x264.exe",
			"commandArguments": "--crf 23 --preset slow --profile high --bframes 2 --demuxer raw --input-res %(width)x%(height) --fps %(fpsnum)/%(fpsden) --colormatrix bt709 -o \"%(tempvideofile)\" -",
			"outputFilename": "%(outputname).264",
			"type": 0,
			"inputFormat": 0,
			"checkReturnCode": true,
			"logStdout": true,
			"logStderr": true,
			"bypassCompression": false,
			"predeleteOutputFile": true
		},
		"M mp4box": {
			"name": "M mp4box",
			"program": "MP4Box.exe",
			"commandArguments": "-add \"%(tempvideofile)\" -add \"%(tempaudiofile)\" \"%(outputname)\" -fps %(fps)",
			"outputFilename": "",
			"type": 2,
			"inputFormat": 0,
			"checkReturnCode": true,
			"logStdout": true,
			"logStderr": true,
			"bypassCompression": false,
			"predeleteOutputFile": true
		},
		"A qaac aac vbrMAX": {
			"name": "A qaac aac vbrMAX",
			"program": "qaac.exe",
			"commandArguments": "--tvbr 127 --ignorelength -o \"%(tempaudiofile)\" -",
			"outputFilename": "%(outputname).aac",
			"type": 1,
			"inputFormat": 1,
			"checkReturnCode": true,
			"logStdout": true,
			"logStderr": true,
			"bypassCompression": true,
			"predeleteOutputFile": true
		}
	}
}
}
I'm currently evaluating how well all this H.264+AAC MP4 works on YouTube (vs. encoding to H.264+AC3 AVI with VirtualDub without external encoders)
Quote
Like
Share