On the fly? Possible but it'd tax your CPU too much or would look horrible if it didn't. After you've finished recording? Sure.
Since I encode video very often, I wanted a quick way to encode all videos I have in a directory so I wrote these two bat files. One to encode all the AVIs in the same folder as the bat (so Fraps videos) to H.264 and AAC in MKV, the other is to remux that MKV to MP4 for use online.
The first one for encoding it to something smaller. Requires the following software:
- ffmpeg - ffmpeg.exe in the same folder as the bat
- eac3to - eac3to folder in the same folder as the bat
- NeroAACEnc - put NeroAacEnc.exe in the eac3to folder
- mkvtoolnix - mkvmerge is the needed program.. just install and done
- x264 - exe in the same folder as the batch.. 32-bit or 64-bit, both work
Code:
SETLOCAL ENABLEDELAYEDEXPANSION
SETLOCAL ENABLEEXTENSIONS
for /F "delims=;" %%A IN ('dir /b *.avi') DO (
ffmpeg -i "%%A" -vn "%%~nA.wav"
eac3to\eac3to "%%~nA.wav" "%%~nA.aac"
ffmpeg -i "%%A" -vcodec rawvideo -f yuv4mpegpipe -sws_flags bicubic+full_chroma_int+accurate_rnd -an -pix_fmt yuv420p - | x264 - --stdin y4m --crf 20 --bframes 5 --b-adapt 2 --ref 4 --mixed-refs --no-fast-pskip --direct auto --deblock -3:-3 --subme 10 --trellis 2 --analyse all --8x8dct --me umh --output "%%~nA.noaudio.mkv"
mkvmerge -o "%%~nA.final.mkv" --forced-track 1:no -d 1 -A -S "%%~nA.noaudio.mkv" --forced-track 0:no -a 1 -D -S --no-chapters "%%~nA.aac.m4a" --track-order 0:1,1:1
del "%%~nA.wav"
del "%%~nA.aac.m4a"
del "%%~nA - Log.txt"
del "%%~nA.noaudio.mkv"
)
pause
For my MKV -> MP4 bat, there's only one additional requirement:
- MP4Box - exe and dll in the same directory as the bat
Code:
SETLOCAL ENABLEDELAYEDEXPANSION
SETLOCAL ENABLEEXTENSIONS
for /F "delims=;" %%A IN ('dir /b *.mkv') DO (
ffmpeg -i "%%A" -vcodec copy -acodec copy "%%~nA.mp4"
MP4Box -inter 0.5 "%%~nA.mp4"
)
pause
Should look similar to this:
http://i31.tinypic.com/25u47pl.jpg
(My epicbat is the first one, and the other bat is guess which.)
And the results could look like this - left is Fraps orginal, right is the encode:
http://stfcc.org/pics/i/4d82a9d2b935...e172daf_th.jpg
http://stfcc.org/pics/i/fdc6137df1ed...e53d497_th.jpg
http://stfcc.org/pics/i/4972b1a63113...68206c5_th.jpg
For a 30 second 500MB 640x480 clip, my Q6600 encodes it at ~10fps and brings the final file size to ~20MB, so 4% of the original. Of course, you can change the settings to your heart's desire if that's too slow or fast or whathaveyou.
So it's as simple as putting all your Fraps videos into the folder and double clicking on the the first bat (and optionally, after the first bat has finished, the 2nd). Can't get better a better quality:speed ratio than that. Then again, could use some encoder like HandBrake but since I like precision, I did it this way. To each their own.