ffmpeg scripts
A collection of ffmpeg shell scripts for basic editing tasks
ffmpeg scripts English version
ffmpeg-Skripte Deutsche Ausgabe
- audio-silence
- combine-clips
- chapter-add
- chapter-csv
- clip-extract
- clip-time
- correct-clip
- crossfade-clips
- ebu-meter
- extract-frame
- fade-clip
- fade-normalize
- fade-title
- img2video
- loudnorm
- normalize
- overlay-clip
- overlay-pip
- pan-scan
- scene-cut
- scene-detect
- scene-images
- scene-time
- sexagesimal-time
- subs2transcript
- subtitle-add
- scopes
- tile-thumbnails
- trim-clip
- vid2gif
- waveform
- webp
- xfade
- zoompan
scripts install
ffmpeg scripts install youtube
create a bin directory
create a bin directory in your home to add the scripts to
mkdir -p ~/bin
if you are using bash add the following code to your ~/.bashrc
if [ -d "$HOME/bin" ]; then
PATH="$HOME/bin:$PATH"
fi
if you are using zsh add the following code to your ~/.zshenv file
typeset -U PATH path
path=("$HOME/bin" "$path[@]")
export PATH
- source your ~/.bashrc if you are using the bash shell
source ~/.bashrc
- source your ~/.zshenv if you are using the zsh shell
source ~/.zshenv
clone the git repository
create a git directory in you home folder to download the scripts into, or use any other location in your file system
mkdir -p ~/git
change directory in the git directory
cd ~/git
clone the git repository
git clone https://github.com/NapoleonWils0n/ffmpeg-scripts.git
update the scripts using git pull
copy or symlink scripts into the bin directory
you can now either copy the scripts into the ~/bin directory in your home, or create symbolic links from the scripts in the ~/git/ffmpeg-scripts directory to the ~/bin directory
creating a symbolic link
ln -s path/to/source path/to/destination
example
ln -s ~/git/ffmpeg-scripts/trim-clip ~/bin
ffmpeg install
linux ffmpeg install
install ffmpeg on debian or ubuntu, for other linux distros see the documentation for your package manager
sudo apt install ffmpeg
mac ffmpeg install
open a terminal and run the following commands to install the xcode command line tools, homebrew and ffmpeg
- xcode command line tools install
xcode-select --install
- homebrew install
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- ffmpeg install with libfdk_aac
brew tap homebrew-ffmpeg/ffmpeg
brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-fdk-aac --HEAD
- ffmpeg upgrade
brew update && brew upgrade homebrew-ffmpeg/ffmpeg/ffmpeg --fetch-HEAD
freebsd ffmpeg install
switch to root and install the ffmpeg package
pkg install ffmpeg
you can also install ffmpeg from ports, or use poudriere to build the ffmpeg package
note the ebumeter script uses ffplay which isnt installed with the ffmpeg package, so you need to build ffmpeg with the sdl option enable from ports or with poudriere
if you want to use the libfdk_aac audio you should also enable that option when building the ffmpeg port, and build the lame package for mp3 support
windows ffmpeg install
install the windows subsystem for linux and then install a linux distro like ubuntu, then follow the linux install instructions
audio-silence
audio-silence add silent audio to a video clip
If the video doesnt have an audio track the script copies the video track, and adds a silent audio track to match the duration of the video and creates a new video clip
If the video has a video and audio track the script only copies the video track, and adds a silent audio track to match the duration of the video and creates a new video clip.
- script usage
audio-silence -i input.(mp4|mkv|mov|m4v) -c (mono|stereo) -r (44100|48000) -o output.mp4
- script help
audio-silence -h
# audio-silence add silent audio to a video clip audio-silence -i input.(mp4|mkv|mov|m4v) -c (mono|stereo) -r (44100|48000) -o output.mp4 -i input.(mp4|mkv|mov|m4v) -c (mono|stereo) : optional argument # if option not provided defaults to mono -r (44100|48000) : optional argument # if option not provided defaults to 44100 -o output.mp4 : optional argument # if option not provided defaults to input-name-silence-date-time
audio-silence batch process
Batch process files in the current working directory
Note we omit the -o option to use the default outfile name, which is infile-name-silence-date-time
audio-silence batch process without specifying the -c and -r options using the defaults of -c mono and -r 44100
find . -type f -name "*.mp4" -exec sh -c \
'audio-silence -i "${0}"'
"{}" \;
audio-silence batch process and override the defaults with the -c and -r options
find . -type f -name "*.mp4" -exec sh -c \
'audio-silence -i "${0}" -c stereo -r 48000'
"{}" \;
chapter-add
add chapters to a video or audio file with ffmpeg using a metadata file, use the chapter-csv script to create the metadata file from a csv files
- script usage
chapter-add -i input -c metadata.txt -o output
- script help
chapter-add -h
chapter-csv
convert a csv file into a chapter metadata file for ffmpeg
- script usage
chapter-csv -i input -o output
- script help
chapter-add -h
- csv file example
The last record is the duration of the video and is used as the end time for the previous chapter,and End isnt used as a chapter
00:00:00,Intro 00:02:30,Scene 1 00:05:00,Scene 2 00:07:00,Scene 3 00:10:00,End
chapter-extract
extract chapters from a video or audo file and save as a csv file
- script usage
chapter-extract -i input -o output
- script help
chapter-extract -h
- convert the csv file to youtube timestamps
tr ',' ' ' < input.txt > output.txt
clip-time
convert timestamps into start and duration
- script usage
clip-time -i input -o output
- script help
clip-time -h
clip-time -i input -o output -i input -o output
combine-clips
combine an image or video file with an audio clip
- script usage
combine-clips -i input.(mp4|mkv|mov|m4v|png|jpg) -a audio.(m4a|aac|wav|mp3) -o output.mp4
- script help
combine-clips -h
# combine an image or video file with an audio clip combine-clips -i input.(mp4|mkv|mov|m4v|png|jpg) -a audio.(m4a|aac|wav|mp3) -o output.mp4 -i input.(mp4|mkv|mov|m4v|png|jpg) -a audio.(m4a|aac|wav|mp3) -o output.mp4 : optional argument # if option not provided defaults to input-name-combined-date-time
combine-clips batch process
Batch process files in the current working directory
Note we omit the -o option to use the default outfile name, infile-name-combined-date-time
- batch combine video and audio files into video clips
The video and audio files you want to combine must have the same name
for example
file1.mp4 file1.wav file2.mp4 file2.wav
running the following code will combine file1.mp4 with file1.wav and file2.mp4 with file2.wav
find . -type f -name "*.mp4" -exec sh -c \
'combine-clip -i "${0}" -a "${0%.*}.wav"' \
"{}" \;
- batch combine images and audio files into video clips
The images and audio files you want to combine must have the same name
for example
file1.png file1.wav file2.png file2.wav
running the following code will combine file1.png with file1.wav and file2.png with file2.wav
find -s . -type f -name "*.png" -exec sh -c \
'combine-clip -i "${0}" -a "${0%.*}.wav"' \
"{}" \;
correct-clip
- curves code based on:
converting gimp curves files for ffmpeg
correct a video clip by using a gimp curve converted into a ffmpeg curves filter command, to adjust the levels and white balance
- requires a curve file created with the following script
- script usage
correct-clip -i input.(mp4|mkv|mov|m4v) -c curve.txt -o output.mp4
- script help
correct-clip -h
# correct a video clip by using a gimp curve # requires a curve file created with the following script # https://github.com/NapoleonWils0n/curve2ffmpeg correct-clip -i input.(mp4|mkv|mov|m4v) -c curve.txt -o output.mp4 -i input.(mp4|mkv|mov|m4v) -c curve.txt -o output.mp4 : optional argument # if option not provided defaults to input-name-corrected-date-time
correct-clip batch process
Batch process files in the current working directory
Note we omit the -o option to use the default outfile name, infile-name-corrected-date-time
The video and gimp curve text files you want to combine must have the same name
for example
file1.mp4 file1.txt file2.mp4 file2.txt
running the following code will correct file1.mp4 with file1.txt gimp curve file and file2.mp4 with file2.txt gimp curve file
find . -type f -name "*.mp4" -exec sh -c \
'correct-clip -i "${0}" -c "${0%.*}.txt"' \
"{}" \;
crossfade-clips
cross fade 2 video clips with either a 1 or 2 second cross fade the videos must have the same codecs, size and frame rate
- script usage
crossfade-clips -a clip1.(mp4|mkv|mov|m4v) -b clip2.(mp4|mkv|mov|m4v) -d (1|2) -o output.mp4
- script help
crossfade-clips -h
# ffmpeg cross fade clips crossfade-clips -a clip1.(mp4|mkv|mov|m4v) -b clip2.(mp4|mkv|mov|m4v) -d (1|2) -o output.mp4 -a clip1.(mp4|mkv|mov|m4v) : first clip -b clip2.(mp4|mkv|mov|m4v) : second clip -d (1|2) : cross fade duration :optional argument # if option not provided defaults to 1 second -o output.mp4 : optional argument # if option not provided defaults to input-name-xfade-date-time
ebu-meter
ffplay ebu meter
- script usage
ebu-meter -i input.(mp4|mkv|mov|m4v|webm|aac|m4a|wav|mp3) -t (00)
-t = luf target, eg 16
- script help
ebu-meter -h
ebu-meter -i input.(mp4|mkv|mov|m4v|webm|aac|m4a|wav|mp3) -t (00)
extract-frame
extract a frame from a video and save as a png image
Note that you can use two different time unit formats: sexagesimal (HOURS:MM:SS.MILLISECONDS, as in 01:23:45.678), or in seconds. If a fraction is used, such as 02:30.05, this is interpreted as โ5 100ths of a secondโ, not as frame 5. For instance, 02:30.5 would be 2 minutes, 30 seconds, and a half a second, which would be the same as using 150.5 in seconds.
- script usage
extract-frame -i input.(mp4|mov|mkv|m4v|webm) -s 00:00:00.000 -o output.png
- script help
extract-frame -h
# extract a frame from a video as a png file https://trac.ffmpeg.org/wiki/Seeking extract-frame -i input.(mp4|mov|mkv|m4v|webm) -s 00:00:00.000 -o output.png -i input.(mp4|mov|mkv|m4v) -s 00:00:00.000 : optional argument # if option not provided defaults to 00:00:00 -o outfile.png : optional argument # if option not provided defaults to input-name-timecode
extract-frame batch process
Batch process files in the current working directory
Note we omit the -o option to use the default outfile name, infile-name-frame-date-time
- extract frame with default option of 00:00:00
find . -type f -name "*.mp4" -exec sh -c \
'extract-frame -i "${0}"' \
"{}" \;
- extract frame at 30 seconds into the video
find . -type f -name "*.mp4" -exec sh -c \
'extract-frame -i "${0}" -s 00:00:30' \
"{}" \;
fade-clip
fade video and audio in and out
- script usage
fade-clip -i input.(mp4|mkv|mov|m4v) -d (0.[0-9]|1) -o output.mp4
- script help
fade-clip -h
# fade video and audio in and out fade-clip -i input.(mp4|mkv|mov|m4v) -d (0.[0-9]|1) -o output.mp4 -i infile.(mp4|mkv|mov|m4v) -d (0.[0-9]|1) : optional argument # if option not provided defaults to 0.5 -o output.mp4 : optional argument # if option not provided defaults to input-name-fade-date-time
fade-clip batch process
Batch process files in the current working directory
Note we omit the -o option to use the default outfile name, infile-name-fade-date-time
- fade-clip with default option of 0.5
find . -type f -name "*.mp4" -exec sh -c \
'fade-clip -i "${0}"' \
"{}" \;
- fade-clip and override the default option of 0.5 with -d 1 for a 1 second fade
find . -type f -name "*.mp4" -exec sh -c \
'fade-clip -i "${0}" -d 1' \
"{}" \;
fade-normalize
fade video and audio in and out and normalize
- script usage
fade-normalize -i input.(mp4|mkv|mov|m4v) -d (0.[0-9]|1) -o output.mp4
- script help
fade-normalize -h
# fade video and normalize audio levels fade-normalize -i input.(mp4|mkv|mov|m4v) -d (0.[0-9]|1) -o output.mp4 -d (0.[0-9]|1) : optional argument # if option not provided defaults to 0.5 -o output.mp4 : optional argument # if option not provided defaults to input-name-normalized-date-time
fade-normalize batch process
Batch process files in the current working directory
find . -type f -name "*.mp4" -exec sh -c \
'fade-normalize -i "${0}" -d 0.5' \
"{}" \;
fade-title
fade video and audio in and out, normalize the audio and create video a lower third title from the filename
- script usage
fade-title -i input.(mp4|mkv|mov|m4v) -d (0.[0-9]|1) -s 000 -e 000 -o output.mp4
- script help
fade-title -h
# fade video, audio add title from video filename fade-title -i input.(mp4|mkv|mov|m4v) -d (0.[0-9]|1) -s 000 -e 000 -o output.mp4 -i input.(mp4|mkv|mov|m4v) -d (0.[0-9]|1) : from 0.1 to 0.9 or 1 :optional argument # if option not provided defaults to 0.5 -s 000 : from 000 to 999 -e 000 : from 000 to 999 -o output.mp4 : optional argument # if option not provided defaults to input-name-title-date-time
fade-title batch process
Batch process files in the current working directory
find . -type f -name "*.mp4" -exec sh -c \
'fade-title -i "${0}" -d 0.5 -s 10 -e 20' \
"{}" \;
img2video
convert an image into a video file
- script usage
img2video -i input.(png|jpg|jpeg) -d (000) -o output.mp4
- script help
img2video -h
# image to video img2video -i input.(png|jpg|jpeg) -d (000) -o output.mp4 -i input.(mp4|mkv|mov|m4v) -d (000) : duration -o output.mp4 : optional argument # if option not provided defaults to input-name-video-date-time
img2video batch process
Batch process files in the current working directory
Note we omit the -o option to use the default outfile name, infile-name-video-date-time
Batch convert png in the current directory into video clips with a 30 second duration
find . -type f -name "*.png" -exec sh -c \
'img2video -i "${0}" -d 30' \
"{}" \;
loudnorm
ffmpeg loudnorm
- script usage
loudnorm -i infile.(mkv|mp4|mov|m4v|m4a|aac|wav|mp3)
- script help
loudnorm -h
# ffmpeg loudnorm loudnorm -i input.(mp4|mkv|mov|m4v|aac|m4a|wav|mp3)
normalize
normalize audio levels
- script usage
normalize -i input.(mp4|mkv|mov|m4v|aac|m4a|wav|mp3) -o output.(mp4|mkv|mov|m4v|aac|m4a|wav|mp3)
- script help
normalize -h
# normalize audio levels normalize -i input.(mp4|mkv|mov|m4v|aac|m4a|wav|mp3) -o output.(mp4|mkv|mov|m4v|aac|m4a|wav|mp3) -i input.(mp4|mkv|mov|m4v|aac|m4a|wav|mp3) -o output.(mp4|mkv|mov|m4v|aac|m4a|wav|mp3) : optional argument # if option not provided defaults to input-name-normalized-date-time-extension
normalize batch process
Batch process files in the current working directory
Note we omit the -o option to use the default outfile name, infile-name-normalize-date-time
Batch normalize mp4 videos in the current directory
find . -type f -name "*.mp4" -exec sh -c \
'normalize -i "${0}"' \
"{}" \;
overlay-clip
overlay one video clip on top of another video clip
- script usage
overlay-clip -i input.(mp4|mkv|mov|m4v) -v input.(mp4|mkv|mov|m4v) -p [0-999] -o output.mp4
- script help
overlay-clip -h
# overlay one video clip on top of another video clip overlay-clip -i input.(mp4|mkv|mov|m4v) -v input.(mp4|mkv|mov|m4v) -p [0-999] -o output.mp4 -i input.(mp4|mkv|mov|m4v) : bottom video -v input.(mp4|mkv|mov|m4v) : overlay video -p [0-999] : time to overlay the video -o output.mp4 : optional argument # if option not provided defaults to input-name-overlay-date-time
overlay-pip
create a picture in picture
- script usage
overlay-pip -i input.(mp4|mkv|mov|m4v) -v input.(mp4|mkv|mov|m4v) -p [0-999]
-m [00] -x (tl|tr|bl|br) -w [000] -f (0.1-9|1) -b [00] -c colour -o output.mp4
- script help
overlay-pip -h
# create a picture in picture overlay-pip -i input.(mp4|mkv|mov|m4v) -v input.(mp4|mkv|mov|m4v) -p [0-999] -m [00] -x (tl|tr|bl|br) -w [000] -f (0.1-9|1) -b [00] -c colour -o output.mp4 -i input.(mp4|mkv|mov|m4v) : bottom video -v input.(mp4|mkv|mov|m4v) : overlay video -p [0-999] : time to overlay the video -m [00] : margin defaults to 0 -x (tl|tr|bl|br) : pip position - defaults to tr -w [000] : width - defaults to 1/4 of video size -f (0.1-9|1) : fade from 0.1 to 1 - defaults to 0.2 -b [00] : border -c colour : colour -o output.mp4 : optional argument # if option not provided defaults to input-name-pip-date-time
pan-scan
pan image
- script usage
pan-scan -i input.(png|jpg|jpeg) -d (000) -p (l|r|u|d) -o output.mp4
- script help
pan-scan -h
# pan scan image pan-scan -i input.(png|jpg|jpeg) -d (000) -p (l|r|u|d) -o output.mp4 -i = input.(png|jpg|jpeg) -d = duration : from 1-999 -p = position : left, right, up, down -o = output.mp4 : optional argument # default is input-name-pan-date-time
scene-cut
scene-cut takes a cut file and video and cuts the video into clips
- script usage
scene-cut -i input -c cutfile
- script help
scene-cut -h
scene-cut -i input -c cutfile -i input.(mp4|mov|mkv|m4v) -c cutfile
ffmpeg requires a start point and a duration, not an end point
cut file - hours, minutes, seconds in this example we create 2 - 30 seconds clips
a 30 second clip that starts at 00:00:00 and another 30 second clip that starts at 00:01:00
00:00:00,00:00:30 00:01:00,00:00:30
cut file - seconds in this example we create 2 - 30 seconds clips
a 30 second clip that starts at 0 and another 30 second clip that starts at 60
0,30 60,30
scene-detect
scene-detect takes a video file and a threshold for the scene detection from 0.1 to 0.9 you can also use the -s and -e options to set a range for thew scene detection, if you dont specify a range scene detection will be perform on the whole video
ffmpeg scene detection - automatically cut videos into separate scenes
ffmpeg scene detection - version 2 - specify a range in the video and cut into separate scenes
ffmpeg scene detect - version 3 - sexagesimal format - hours, minutes, seconds
- script usage
scene-detect -s 00:00:00 -i input -e 00:00:00 -t (0.1 - 0.9) -f sec -o output
- script help
scene-detect -h
scene-detect -s 00:00:00 -i input -e 00:00:00 -t (0.1 - 0.9) -f sec -o output -s 00:00:00 : start time -i input.(mp4|mov|mkv|m4v) -e 00:00:00 : end time -t (0.1 - 0.9) # threshold -f sec # output in seconds -o output.txt
scene-images
scene-images takes a video file and a cut file, created with the scene-detect script either in seconds or sexagesimal format and then creates an image for each cut point
- script usage
scene-images -i input -c cutfile
- script help
scene-images -h
scene-images -i input -c cutfile -i input.(mp4|mov|mkv|m4v) -c cutfile
scene-time
scene-time takes a cut file, created with the scene-detect script either in seconds or sexagesimal format
0:00:00 0:00:11.875000 0:00:15.750000
The script creates clips by subtracting the cut point from the start point and converts sexagesimal format and then creates a file with the start point a comma and then the duration of the clip
the output of the scene-time script is used with the scene-cut script to create the clips
0,11.875 11.875,3.875
- script usage
scene-time -i input -o output
- script help
scene-time -h
scene-time -i input -o output -i input -o output
sexagesimal-time
calculate sexagesimal duration by subtracting the end time from start time for trimming files with ffmpeg
- script help
sexagesimal-time -h
example
sexagesimal-time -s 00:05:30 -e 00:18:47
ouput
00:13:17
also works with milliseconds
subtitle-add
add subtitles to a video file
- script usage
subtitle-add -i input.(mp4|mkv|mov|m4v) -s subtitle.srt -o output.mp4
- script help
subtitle-add -h
# add subtitles to a video subtitle-add -i input.(mp4|mkv|mov|m4v) -s subtitle.srt -o output.mp4 -i input.(mp4|mkv|mov|m4v) -s subtitle.srt -o output.mp4 : optional argument # if option not provided defaults to input-name-subs-date-time
subtitle-add batch process
Batch process files in the current working directory
Note we omit the -o option to use the default outfile name, infile-name-subs-date-time
The video and subtitle files you want to combine must have the same name
for example
file1.mp4 file1.srt file2.mp4 file2.srt
running the following code will run the subtitle-add script and combine file1.mp4 with file1.srt and file2.mp4 with file2.srt
find . -type f -name "*.mp4" -exec sh -c \
'subtitle-add -i "${0}" -s "${0%.*}.srt"' \
"{}" \;
scopes
ffplay video scopes youtube video
- script usage
scopes -i input = histogram
scopes -o input = rgb overlay
scopes -p input = rgb parade
scopes -s input = rgb overlay and parade
scopes -w input = waveform
scopes -v input = vector scope
- script help
scopes -h
# ffplay video scopes scopes -i input = histogram scopes -o input = rgb overlay scopes -p input = rgb parade scopes -s input = rgb overlay and parade scopes -w input = waveform scopes -v input = vector scope scopes -h = help
tile-thumbnails
create thumbnails froma a video and tile into an image
Note that you can use two different time unit formats: sexagesimal (HOURS:MM:SS.MILLISECONDS, as in 01:23:45.678), or in seconds. If a fraction is used, such as 02:30.05, this is interpreted as โ5 100ths of a secondโ, not as frame 5. For instance, 02:30.5 would be 2 minutes, 30 seconds, and a half a second, which would be the same as using 150.5 in seconds.
- script usage
tile-thumbnails -i input -s 00:00:00.000 -w 000 -t 0x0 -p 00 -m 00 -c color -f fontcolor -b boxcolor -x on -o output.png
- script help
tile-thumbnails -h
# create an image with thumbnails from a video tile-thumbnails -i input -s 00:00:00.000 -w 000 -t 0x0 -p 00 -m 00 -c color -f fontcolor -b boxcolor -x on -o output.png -i input.(mp4|mkv|mov|m4v|webm) -s seek into the video file : default 00:00:05 -w thumbnail width : 160 -t tile layout format width x height : 4x3 : default 4x3 -p padding between images : default 7 -m margin : default 2 -c color = https://ffmpeg.org/ffmpeg-utils.html#color-syntax : default black -f fontcolor : default white -b boxcolor : default black -x on : default off, display timestamps -o output.png : optional argument # if option not provided defaults to input-name-tile-date-time.png"
If the tiled image only creates one thumbnail from the video and the rest of the image is black, then the issue may be the frame rate of the video
you can check the videos frame rate with ffmpeg
ffmpeg -i infile.mp4
if the framerate is 29.97 instead of 30 then you can use ffmpeg to change the framerate and fix the issue
ffmpeg -i infile.mp4 -vf fps=fps=30 outfile.mp4
tile-thumbnails batch process
batch process videos and create thumbnails from the videos and tile into an image
find . -type f -name "*.mp4" -exec sh -c \
'tile-thumbnails -i "${0}" -s 00:00:10 -w 200 -t 4x4 -p 7 -m 2 -c white' \
"{}" \;
trim-clip
trim video clip
Note that you can use two different time unit formats: sexagesimal (HOURS:MM:SS.MILLISECONDS, as in 01:23:45.678), or in seconds. If a fraction is used, such as 02:30.05, this is interpreted as โ5 100ths of a secondโ, not as frame 5. For instance, 02:30.5 would be 2 minutes, 30 seconds, and a half a second, which would be the same as using 150.5 in seconds.
- script usage
trim-clip -s 00:00:00.000 -i input.(mp4|mov|mkv|m4v|aac|m4a|wav|mp3) -t 00:00:00.000 -o output.(mp4|aac|mp3|wav)
- script help
trim-clip -h
# trim video or audio clips with millisecond accuracy https://trac.ffmpeg.org/wiki/Seeking trim-clip -s 00:00:00.000 -i input.(mp4|mov|mkv|m4v|aac|m4a|wav|mp3) -t 00:00:00.000 -o output.(mp4|aac|mp3|wav) -s 00:00:00.000 : start time -i input.(mp4|mov|mkv|m4v|aac|m4a|wav|mp3) -t 00:00:00.000 : number of seconds after start time -o output.(mp4|aac|mp3|wav) : optional argument # if option not provided defaults input-name-trimmed-date-time.(mp4|wav)
trim-clip batch process
Batch process files in the current working directory
Note we omit the -o option to use the default outfile name, infile-name-trimmed-date-time
Batch trim all the mp4 files in the current directory, from 00:00:00 to 00:00:30
find . -type f -name "*.mp4" -exec sh -c \
'trim-clip -s 00:00:00 -i "${0}" -t 00:00:30' \
"{}" \;
vid2gif
create a gif animation from a video
- script usage
vid2gif -s 00:00:00.000 -i input.(mp4|mov|mkv|m4v) -t 00:00:00.000 -f [00] -w [0000] -o output.gif
- script help
vid2gif -h
# convert a video into a gif animation vid2gif -s 00:00:00.000 -i input.(mp4|mov|mkv|m4v) -t 00:00:00.000 -f [00] -w [0000] -o output.gif -s 00:00:00.000 : start time -i input.(mp4|mov|mkv|m4v) -t 00:00:00.000 : number of seconds after start time -f [00] : framerate -w [0000] : width -o output.gif : optional argument # if option not provided defaults input-name-gif-date-time.gif
waveform
create a waveform from an audio or video file and save as a png
- script usage
waveform -i input.(mp4|mkv|mov|m4v|webm|aac|m4a|wav|mp3) -o output.png
- script help
waveform -h
# create a waveform from an audio or video file and save as a png waveform -i input.(mp4|mkv|mov|m4v|webm|aac|m4a|wav|mp3) -o output.png -i output.(mp4|mkv|mov|m4v|aac|m4a|wav|mp3) -o output.png : optional argument # if option not provided defaults to input-name-waveform-date-time
waveform batch process
Batch process files in the current working directory
Note we omit the -o option to use the default outfile name, infile-name-waveform-date-time
Create waveform images from all the mp4 fies in the current directory
find . -type f -name "*.mp4" -exec sh -c \
'waveform -i "${0}"' \
"{}" \;
webp
create a animated webp image from a video with ffmpeg
- script usage
webp -i input -c 0-6 -q 0-100 -f 15 -w 600 -p none -o output.webp
- script help
webp -h
# webp animated image webp -i input -c 0-6 -q 0-100 -f 15 -w 600 -p none -o output.webp -i input -c compression level: 0 - 6 : default 4 -q quality: 0 - 100 : default 80 -f framerate: default 15 -w width: default 600px -p preset: none|default|picture|photo|drawing|icon|text : default none -o output.webp : optional agument # if option not provided defaults input-name.webp
webp batch process
Batch process files in the current working directory
find . -type f -name "*.mp4" -exec sh -c 'webp -i "${0}"' "{}" \;
xfade
apply a transition between two clips with the xfade filters
- script usage
xfade -a clip1.(mp4|mkv|mov|m4v) -b clip2.(mp4|mkv|mov|m4v) -d duration -t transition -f offset -o output.mp4
- script help
xfade -h
# ffmpeg xfade transitions xfade -a clip1.(mp4|mkv|mov|m4v) -b clip2.(mp4|mkv|mov|m4v) -d duration -t transition -f offset -o output.mp4 -a clip1.(mp4|mkv|mov|m4v) : first clip -b clip2.(mp4|mkv|mov|m4v) : second clip -d duration : transition duration -t transition : transition -f offset : offset -o output.mp4 : optional argument # if option not provided defaults to input-name-xfade-date-time + transitions circleclose, circlecrop, circleopen, diagbl, diagbr, diagtl, diagtr, dissolve, distance fade, fadeblack, fadegrays, fadewhite, hblur, hlslice, horzclose, horzopen, hrslice pixelize, radial, rectcrop, slidedown, slideleft, slideright, slideup, smoothdown smoothleft, smoothright, smoothup, squeezeh, squeezev, vdslice, vertclose, vertopen, vuslice wipebl, wipebr, wipedown, wipeleft, wiperight, wipetl, wipetr, wipeup
zoompan
convert a image to video and apply the ken burns effect to the clip
- script usage
zoompan -i input.(png|jpg|jpeg) -d (000) -z (in|out) -p (tl|c|tc|tr|bl|br) -o output.mp4
- script help
zoompan -h
# zoompan, ken burns effect zoompan -i input.(png|jpg|jpeg) -d (000) -z (in|out) -p (tl|c|tc|tr|bl|br) -o output.mp4 -i = input.(png|jpg|jpeg) -d = duration : from 1-999 -z = zoom : in or out -p = position : zoom to location listed below -o = outfile.mp4 : optional argument # default is input-name-zoompan-date-time +------------------------------+ +tl tc tr+ + + + c + + + +bl br+ +------------------------------+
zoompan batch process
Batch process files in the current working directory
Note we omit the -o option to use the default outfile name, infile-name-zoompan-date-time
Batch process all the png files in the current working directory, apply the zoompan script with a 5 second duration, zoom in to the center of the image
find . -type f -name "*.png" -exec sh -c \
'zoompan -i "${0}" -d 5 -z in -p c' \
"{}" \;