Last active
February 1, 2023 21:07
-
-
Save Plasmoxy/5dde9ca6d045f3bd25c664d227de888f to your computer and use it in GitHub Desktop.
VidMod 4 shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# VidMod 4 shell by Plasmoxy | |
# - clip editor for ffmpeg for shell but can also like extract subtitile and cool stuff | |
fname=$2 | |
case $1 in | |
# cut with reencoding | |
# vidmod cut source.mp4 0:00 0:04 | |
cut) | |
from=$3 | |
to=$4 | |
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 | |
cutc) | |
from=$3 | |
to=$4 | |
ffmpeg -i "$fname" -ss "$from" -to "$to" -async 1 "$fname.cut.mp4" | |
;; | |
# downscale by half | |
# vidmod desize source.mp4 | |
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 | |
bitrate) | |
ffmpeg -i "$fname" -b:v $3 "$fname.bitrate.mp4" | |
;; | |
# extract specified subtitle track as srt | |
# vidmod srt source.mp4 0 | |
srt) | |
ffmpeg -i "$fname" -map 0:s:$3 "$fname.$3.srt" | |
;; | |
*) | |
echo "No such command, use cut/cutc/desize/bitrate as parameter." | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment