Log in

View Full Version : Command Line Bitrate Calculator


Chumbo
27th July 2011, 14:16
I've been looking for a command line bitrate calculator but haven't found one. Any of you know if there is one that can be used on the command line?

I mostly use MeGUI for encoding a few files, but occassionally, I'll have many files to encode which I do via the command line through batch files. This makes it easy to encode many files at once.

Right now I can set the bitrate based on the MeGUI calculator for one of the files, e.g.,for /f "delims=" %%i in ('dir /b "*.avs"') do (
x264_64.exe --pass 1 --bitrate 2631 --stats "E:\Media\work\hfo\%%~ni.stats" --open-gop --sar 1:1 --output NUL "%%~fi"
x264_64.exe --pass 2 --bitrate 2631 --stats "E:\Media\work\hfo\%%~ni.stats" --open-gop --sar 1:1 --output "%%~ni.264" "%%~fi"
)

That produces an approximate file size but not exacly the file size I want since each file may be a little different. So if there's a command line bitrate calculator I can pass a source file to with audio and a target file size and it returns the bitrate, I can then automate each encode to produce the target size I want.

In the case above I have 25 files to encode and would have to calculate each one manually in the MeGUI bitrate calculator which I'm trying to avoid. Thanks for any help.

ramicio
28th July 2011, 22:56
I use a perl script (http://timramich.com/movie-script.html) to batch run my encodings. I calculate my bit rate from the dimensions of the video, but you could easily get the number of frames, turn that into seconds, and divide a set file size by those seconds.