Skip to content

Instantly share code, notes, and snippets.

@Plasmoxy
Created November 24, 2021 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Plasmoxy/0e523479126b4b02ca961969ef4c8690 to your computer and use it in GitHub Desktop.
Save Plasmoxy/0e523479126b4b02ca961969ef4c8690 to your computer and use it in GitHub Desktop.
# Vidmod by Plasmoxy
# - clip editor for ffmpeg
$cmd = $args[0]
$fname = $args[1]
# cut with reencoding
# vidmod cut source.mp4 0:00 0:04
if ($cmd -eq "cut") {
$from = $args[2]
$to = $args[3]
ffmpeg -i "$fname" -ss "$from" -to "$to" -async 1 "$fname.cut.mp4"
}
# cut without reencoding (can miss keyframes)
# vidmod cut source.mp4 0:00 0:04
if ($cmd -eq "cutc") {
$from = $args[2]
$to = $args[3]
ffmpeg -i "$fname" -ss "$from" -to "$to" -async 1 "$fname.cut.mp4"
}
# downscale by half
# vidmod desize source.mp4
if ($cmd -eq "desize") {
ffmpeg -i "$fname" -vf "scale=iw/2:ih/2" "$fname.desize.mp4"
}
# reduce bitrate to specified number (units 2M=2 Mbps, 64k = 64kbps)
# vidmod bitrate source.mp4 2M
if ($cmd -eq "bitrate") {
ffmpeg -i "$fname" -b:v $args[2] "$fname.bitrate.mp4"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment