base encode to H265 (HEVC)
ffmpeg -i in.mts -c:a copy -c:v libx265 out.mp4
base encode to H264
ffmpeg -i in.mts -c:a copy -c:v h264 out.mp4
base encode to AV1 (lower cpu-used = slower)
ffmpeg -i in.mts -c:a copy -c:v av1 -cpu-used 6 -tiles 2x2 out.mkv
scale to 720p
-s 1280x720
compress better
-preset veryslow
convert audio to aac
-c:a aac -b:a 384k -strict -2
specify bitrate
-b:v 4000k
specify quality (default 23 for H264, 28 for H265, lower is better)
-crf 20
change framerate
-r 25
keep subtitles
-c:s mov_text
drop duplicated frames and interpolate framerate
-vf mpdecimate,minterpolate=fps=25
crop (add :x:y
for position)
-filter:v "crop=1280:720"
truncate (-ss
for start time, -t
for end time, format: [[hh:]mm:]ss[.msec]
)
-ss 21 -t 42
rotate (1 = 90Clockwise, 2 = 90CounterClockwise)
-vf "transpose=1"
change image brightness
-vf "lutyuv=y=val*1.3"
-filter:v lutyuv="y=gammaval(0.8)"
audio highpass filter
-af "highpass=f=80"
audio compression filter
-af "compand"
audio right channel only + highpass (reduce clicks) + noise reduction + compression + variable bitrate (for ATC recordings)
-af "pan=mono|c0=FR,highpass=200,afftdn=nf=-30,compand" -q:a 1
find . -type f -name '*[0-9].MP3' -exec bash -c 'ffmpeg -i "$0" -af "pan=mono|c0=FR,highpass=200,afftdn=nf=-30,compand" -q:a 1 "${0/%.MP3/_mono.mp3}"' '{}' \;
two pass
-b:v 4000k -pass 1 -f mkv /dev/null
-b:v 4000k -pass 2 out.mkv
DVD MPEG2 to H264
ffmpeg -i "concat:VTS_01_1.VOB|VTS_01_2.VOB|VTS_01_3.VOB|VTS_01_4.VOB|VTS_01_5.VOB" -f dvd -c copy video.mpeg
ffmpeg -i video.mpeg -vf yadif -aspect 16:9 -c:a copy -c:v h264 -crf 19 video.mp4
convert all files
for f in *.mov; do avconv -i "$f" -c:a aac -b:a 384k -strict -2 -c:v h264 "${f%.mov}.mp4"; done
batch convert WAV to mp3
find . -type f -name '*.WAV' -exec bash -c 'ffmpeg -i "$0" -y -c:a libmp3lame -q:a 0 "${0/%WAV/mp3}"' '{}' \;
batch convert to high quality H265
find . -type f -name '* (upscaled).mp4' -exec bash -c 'ffmpeg -i "$0" -c:a copy -c:v libx265 -crf 18 "${0/%).mp4/) h265.mp4}"' '{}' \;
batch convert jpg to avif
find . -type f -name '*.JPG' -exec bash -c 'ffmpeg -i "$0" "${0/%.JPG/.avif}"' '{}' \;
batch update file time from metadata (works for pictures and videos)
exiftool "-filemodifydate<datetimeoriginal" *.mp4
https://ffmpeg.guide/ (WYSIWYG login with google)