Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ffmpeg-scripts

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.

ffmpeg-target

Shorthand ffmpeg command for a two-pass encoding to target an approximate file size. Ideal for uploaded media which must meet tight file size constraints.
  • Example: You have a 45 MB video file my_mov.mp4 and wish to upload it to a file sharing website with an 8.0 MB limit ** Command: . bin/ffmpeg-target.sh my_mov.mp4 7.95 my_smaller_mov.mp4 ** This will take my_mov.mp4 and re-encode it attempting to get it as close to 7.95 MB as possible. 7.95 instead of 8.0 as to not accidentally meet or exceed the constraint ** See Usage for more details on parameters

Usage

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

Meta

Kevin Tyrrell – KevinTearUl@gmail.com

Distributed under the GPL3 license. See LICENSE for more information.

https://github.com/KevinTyrrell

Contributing

  1. Fork it (https://github.com/KevinTyrrell/ffmpeg-scripts)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

About

Convenient short-hand scripts for various complicated, but commonly-used ffmpeg commands

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages