video compression?

ilkhan

[H]F Junkie
Joined
Sep 23, 2002
Messages
13,790
goal: to take a video recorded in FRAPS and make a much smaller filesize without losing much quality.
Current files: 4GB+1.8GB, 1920x1200, native FRAPS format,

While I did look there first, the encoding thread is a maze of confusing info. I haven't done anything like this before.


So how do I do this?
 
Piece of cake.

Make a bat file similar to this one:
Code:
SETLOCAL ENABLEDELAYEDEXPANSION
SETLOCAL ENABLEEXTENSIONS
for /F "delims=;" %%A IN ('dir /b *.avi') DO (
mkvmerge -o "%%~nA.mkv" --forced-track 0:no --forced-track 1:no -a 1 -d 0 -S "%%A" --track-order 0:0,0:1
ffmpeg -i "%%A" -acodec ac3 -ab 192000 "%%~nA.ac3"
ffmpeg -i "%%A" -vcodec rawvideo -f rawvideo -an -pix_fmt yuv420p - | x264 --fps 30 --crf 19 --bframes 5 --b-adapt 2 --ref 3 --mixed-refs --no-fast-pskip --direct auto --deblock -3:-3 --subme 10 --trellis 2 --analyse all --me umh --ssim --output "%%~nA.noaudio.mkv" - 1920x1080
mkvmerge -o "%%~nA.final.mkv" --forced-track 1:no -d 1 -A -S "%%~nA.noaudio.mkv" --forced-track 0:no -a 0 -D -S "%%~nA.ac3" --track-order 0:1,1:0
del "%%~nA.ac3"
del "%%~nA.noaudio.mkv"
)
pause

Install mkvtoolnix (comes with mkvmerge), download x264 (x264.nl), download an ffmpeg binary (first result in google). Place x264.exe and ffmpeg.exe in the same directory as the bat. Place those files in the directory that has the Fraps-made avi files. Change resolution/fps in the bat. Run bat file, voila. Imperceptible quality loss with the fastest H.264 encoder.
 
Last edited:
did as you said. Basic copy/paste on the bat. Its just going really really fucking slow. Oh well.
 
Welcome to the wonderful world of computational mathematics in the slow lane... ;) This is the unavoidable side effect of video compression that matters. Even the biggest baddest fastest hardware can be brought to its knees, for the most part, when crunching the kind of numbers required to do video compression.

Get it started, then find something else to do till it's done. :)
 
it finished. I think the framerates didnt match, its starts off all green and then starts looking like an old fashioned movie with the frames not matching the screen.

Ill try again with some different settings, and make sure that the fraps can maintain a constant framerate, that may have been the problem. But the script itself worked great.
 
I said you have to change the fps (--fps 30) and the resolution (1920x1080) in the really long line to whatever you require. If the resolution is wrong, the end result will most certainly be what you describe.
 
Last edited:
So the batch file above is working great for compressing if its just one avi. But if theres 2 videos it doesnt splice them together, just encodes them seperately. Is there an easy way to append them together and compress it in what step in like vdub? Splicing together is easy but its also a bit slow, doing the whole thing (and maybe resizing, but thats easy with vdub) in one operation would be perfect.
 
Yanno, you can just get HandBrake and feed it the damned AVI file and not have all this muss, fuss, and trouble... more than likely.
 
So the batch file above is working great for compressing if its just one avi. But if theres 2 videos it doesnt splice them together, just encodes them seperately. Is there an easy way to append them together and compress it in what step in like vdub? Splicing together is easy but its also a bit slow, doing the whole thing (and maybe resizing, but thats easy with vdub) in one operation would be perfect.

The quick and dirty way of accomplishing the appending would be to append the final encodes with mkvmerge. However, as I said, its quick and dirty, so don't expect perfect transitions (maybe a pop in the audio, maybe they won't append at all). Nothing wrong with trying that, though.
 
Back
Top