66 lines
3.4 KiB
Bash
Executable File
66 lines
3.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
if [[ "$1" = "-h" ]]; then
|
|
echo This script prints out various ffmpeg commands
|
|
exit
|
|
fi
|
|
|
|
cat <<'EOF' | md-color
|
|
# Basic Good Quality
|
|
a) -hide_banner -q:v 0 -q:a 0
|
|
b) -s hd720 -g 250 -c:v libx264 -crf 23 -c:a aac -movflags faststart -strict -2
|
|
edit) -c:v mpeg2video -q:v 3 -g 1 -c:a libmp3lame -ar 44100 -b:a 192k
|
|
YIFY) -c:v libx264 -crf 27 -x264-params cabac=1:ref=5:analyse=0x133:me=umh:subme=9:chroma-me=1:deadzone-inter=21:deadzone-intra=11:b-adapt=2:rc-lookahead=60:vbv-maxrate=10000:vbv-bufsize=10000:qpmax=69:bframes=5:b-adapt=2:direct=auto:crf-max=51:weightp=2:merange=24:chroma-qp-offset=-1:sync-lookahead=2:psy-rd=1.00,0.15:trellis=2:min-keyint=23:partitions=all -c:a aac -ar 44100 -b:a 128k -map 0
|
|
x265) -probesize 10M -i video.xxx -pix_fmt yuv420p -c:v libx265 -preset slow -tune animation -c:v libx265 -crf 20 -c:a aac -ar 44100 -b:a 128k -strict -2 -movflags faststart
|
|
# Resize
|
|
-vf scale=iw/2:-1:flags=lanczos -vf \"setsar=1:1\"
|
|
-s hd720 / hd480 /
|
|
# Smooth slow motion
|
|
-filter:v "minterpolate='mi_mode=mci:mc_mode=aobmc:vsbmc=1:fps=120'",setpts=1.5*PTS
|
|
# BCS + unsharp (works also on -filter_complex)
|
|
-vf unsharp,"eq=contrast=1.4:brightness=0.1:saturation=1.5:gamma=1.0"
|
|
# More filters to try
|
|
histeq=strength=0.1,normalize=blackpt=red:whitept=yellow:smoothing=150,hqdn3d=4:4:3:3"
|
|
# Trim
|
|
-vcodec copy -acodec copy -ss 00:01:30 -to 00:02:30
|
|
-vcodec copy -acodec copy -ss 50 -to 65
|
|
-segment_time 00:15:00 -f segment -reset_timestamps 1
|
|
# Crop
|
|
-filter:v "crop=out_w:out_h:x_offset:y_offset"
|
|
# Vertical2Horizontal
|
|
-filter_complex "[0:v]scale=ih*16/9:-1,boxblur=luma_radius=min(h\,w)/20:luma_power=1:chroma_radius=min(cw\,ch)/20:chroma_power=1[bg];[bg][0:v]overlay=(W-w)/2:(H-h)/2,crop=h=iw*9/16"
|
|
# Rotate 0=90CCW+flip,1=90CW,2=90CCW,3=90CW+flip. example 180 deg.
|
|
-vf "transpose=2,transpose=2"
|
|
# Antishake-Stabilize
|
|
in=videofile.mp4
|
|
ffmpeg -i "$in" -vf vidstabdetect=stepsize=32:shakiness=10:accuracy=10:result="$in".transforms.trf -f null -
|
|
ffmpeg -i "$in" -vf vidstabtransform=input="$in".transforms.trf:zoom=0:smoothing=10,unsharp=5:5:0.8:3:3:0.4 -q:v 0 "$in".stabilized.mp4
|
|
# To Stills
|
|
-vf fps=10 "$1".%06d.png
|
|
# From Stills
|
|
-r 1/5 -start_number 0 -i img%03d.png -r 30 -pix_fmt yuv420p
|
|
# Segment
|
|
-segment_time 00:15:00 -f segment -reset_timestamps 1 "$in.%03d.480p.mp4"
|
|
# Stacking
|
|
-i input0 -i input1 -filter_complex vstack=inputs=2 (OR/) hstack=inputs=2
|
|
# Chroma key
|
|
-f lavfi -i color=c=green:s=1920x1080 -i input.mp4 -filter_complex "[1:v]chromakey=0x297141:0.1:0.0[ckout];[0:v][ckout]overlay[o]" -map [o] -map 1:a
|
|
# View live
|
|
-pix_fmt yuv420p -f matroska - | ffplay -i -
|
|
# Concatenate
|
|
find . -type f -printf "file '%P'\n" | sort -V > filelist.txt
|
|
ffmpeg -f concat -safe 0 -i filelist.txt -c copy concatenated.mp4
|
|
# Audio encode
|
|
ffmpeg -i file.wav -codec:a libmp3lame -qscale:a 2 file.mp3
|
|
# Audio map
|
|
ffmpeg -i input.mp4 -i input.mp3 -c copy -map 0:a -map 1:v -shortest out.mp4
|
|
# Silent Audio
|
|
ffmpeg -f lavfi -i anullsrc -i input.mp4 -c:v copy -c:a aac -map 0:a -map 1:v -shortest out.mp4
|
|
# Audio Fade in/out
|
|
-vf "fade=t=in:st=0:d=1,fade=t=out:st=10:d=1" -af "afade=t=in:st=0:d=1,afade=t=out:st=10:d=1"
|
|
# Audio Downmix5.1
|
|
-map 0:a -c:s copy -c:v copy -c:a flac -af \"volume=1.160156,pan=stereo|FL=0.5*FC+0.707*FL+0.707*BL+0.5*LFE|FR=0.5*FC+0.707*FR+0.707*BR+0.5*LFE\" out.2ch.mkv
|
|
# Audio Delay
|
|
-i video.mp4 -itsoffset 1.5 -i video.mp4 -map 0:v -map 1:a -c copy "out-delayed.mp4"
|
|
EOF
|