Convenient short-hand scripts for various complicated, but commonly-used ffmpeg commands
This is a repository for any scripts I write in order to make my life easier when working with the program ffmpeg. ffmpeg commands are often simple for quick & dirty jobs but complex and specific use-case commands can become unwieldy or tedious to re-type or re-research. Each script is listed below with its respective description and usage.
- Example: You have a 45 MB video file
my_mov.mp4and wish to upload it to a file sharing website with an8.0MB limit ** Command:. bin/ffmpeg-target.sh my_mov.mp4 7.95 my_smaller_mov.mp4** This will takemy_mov.mp4and re-encode it attempting to get it as close to7.95MB as possible.7.95instead of8.0as to not accidentally meet or exceed the constraint ** See Usage for more details on parameters
OS X & Linux:
. bin/ffmpeg-target.sh| Parameter | Flag | Flag(Formal) | Sub-Parameter(s) | Default Value | Description |
|---|---|---|---|---|---|
| input | path [str] | Absolute file path to your input video file | |||
| file_size | size [float] | Desired size of the output file, in megabytes | |||
| output | output [str] | Absolute file path for your output video file | |||
| lib | -l | --lib | library [str] | libx264 | Library to use for video encoding |
| alib | -a | --alib | library [str] | aac | Library to use for audio encoding |
| abr | -b | --abr | bitrate [int] | 128 | Average audio encoding bitrate, in kilobits per second |
| threads | -t | --threads | threads [int] | 0* | Number of worker threads for the encoding process (0 for auto-detect CPU cores) |
| yes | -y | --yes | false | Overwrite output file if file already exists in the output path | |
| preset | -p | --preset | preset [str] | medium | Amount of time taken by ffmpeg to optimize quality per frame (see help) |
| help | -h | Displays the help menu, provided by Python's Argparse Library |
Kevin Tyrrell – KevinTearUl@gmail.com
Distributed under the GPL3 license. See LICENSE for more information.
https://github.com/KevinTyrrell
- Fork it (https://github.com/KevinTyrrell/ffmpeg-scripts)
- Create your feature branch (
git checkout -b feature/fooBar) - Commit your changes (
git commit -am 'Add some fooBar') - Push to the branch (
git push origin feature/fooBar) - Create a new Pull Request
