Using HandBrakeCLI¶HandBrake's CLI is really easy to use. If you get comfortable with it, it can be a lot more efficient than the GUIs.
The Basics¶First, simple input and output.
HandBrakeCLI -i source -o destination That will encode with default values: 1000kbps ffmpeg video and 160kbps AAC audio in an .mp4 container.
Easy, right? So now you can start customizing those settings. You can pile on all sorts of things, and end up with a monster like:
HandBrakeCLI -i /Volumes/MyBook/VIDEO_TS -o /Volumes/MyBook/movie.m4v -v -P -m -E aac,ac3 -e x264-q 0.65 -x ref=3:mixed-refs:bframes=6:b-pyramid=1:weightb=1:analyse=all:8x8dct=1:subme=7:me=umh:merange=24:filter=-2,-2:trellis=1:no-fast-pskip=1:no-dct-decimate=1:direct=auto For now, think about less complex stuff:
HandBrakeCLI -i VIDEO_TS -o movie.mp4 -e x264 -b 2000 -B 192That will encode a source video located at the path VIDEO_TS to an output file called movie.mp4. It will use x264 with a bitrate of 2000 to encode the video, and encode the audio as 128kb/s AAC.
So can you start to see how this works? The most important info for HandBrakeCLI is the location of the DVD, and the location and name where you want to store the encoded video it will output. If you don't specify anything else, it uses fast, low-quality, default values. Each bit of information is preceded by a flag: -i for input, -o for output. To select an encoder, you use -e followed by the encoder name. So -e x264 uses x264 to encode the video. Video bitrate is controlled by -b, and audio bitrate is controlled by -B (yes, the option names are case-sensitive. -b is not -B and -e is not -E).
A few rudimentary hints for using the command line¶
- Filepaths are important. I'm on a Mac, and my username is jon. My home directory is: /Users/jon/So the path to my Desktop is: /Users/jon/DesktopAnd so my Movies folder is at /Users/jon/MoviesA common shortcut is to use a tilde (~) to represent your home directory. That means: ~/Moviesis the same as: /Users/jon/Movies
Make sure you remember the right capitalization for everything. At the command line, HandBrakeCLI is not the same as handbrakecli. If you have to type a space in filepath, precede it with a \ backslash so the system knows what's going on.
Presets¶HandBrake offers hard coded, factory-fresh presets that are exactly the same as the built-in presets in the MacGui. Descriptions of presets and rankings for speed, as well as a web-copy of all the presets' CLI strings are available.
- You usually store GUI programs in the /Applications folder. CLI programs are usually stored in places like /usr/bin or /opt/local/bin. You can do that with HandBrake, but the easiest thing to do is just navigate to the directory that stores HandBrakeCLI. To navigate through your file system at the command line, you change directories (folders) by using the "cd" (Change Directories) command. For example, to move to my Movies folder, I would type: cd ~/MoviesThen, tell the shell to look for the program in the current working directory. To run a command in the Terminal, you just type its name. But the shell will only look in the places where applications are usually stored (like /usr/bin/). You need to tell it to look in the current directory. To do that, precede the program name with ./ like this: ./HandBrakeCLIOf course, running that won't do much anything useful. If you run HandBrake without telling it what to do, it will just tell you to read the help...
To use a preset, type, for example:
./HandBrakeCLI -i /Volumes/DVD -o movie.mp4 --preset="iPhone & iPod Touch" So it's:
--preset="Preset Name"Be careful -- spelling and spacing and capitalization count. Don't forget the quotation marks, either. You can override most preset settings by specifying other options on the command line. To see a list of all the preset names and settings, type:
./HandBrakeCLI --preset-listThe following presets are available:
- Apple
- Basic
- High Profile
- Gaming Consoles
欢迎光临 批处理之家 (http://www.bathome.net/) | Powered by Discuz! 7.2 |