Created
August 4, 2020 16:56
-
-
Save yspreen/174623b640b1420c50ea3aaa02003d16 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
vlcconvert() { | |
######################## Transcode the files using ... ######################## | |
vcodec="mp4v" | |
acodec="mp4a" | |
vb="1024" | |
ab="128" | |
mux="mp4" | |
############################################################################### | |
# Store path to VLC in $vlc | |
if command -pv vlc >/dev/null 2>&1; then | |
# Linux should find "vlc" when searching PATH | |
vlc="vlc" | |
# Sanity check | |
if ! command -pv "$vlc" >/dev/null 2>&1; then | |
printf '%s\n' "Cannot find path to VLC. Abort." >&2 | |
return 1 | |
fi | |
else | |
# macOS seems to need an alias | |
vlc="/Applications/VLC.app/Contents/MacOS/VLC" | |
# Sanity check | |
if ! [ -f "$vlc" ]; then | |
printf '%s\n' "Cannot find path to VLC. Abort." >&2 | |
return 1 | |
fi | |
fi | |
for filename in *; do | |
printf '%s\n' "=> Transcoding '$filename'... " | |
"$vlc" -I dummy -q "$filename" \ | |
--sout '#transcode{vcodec="'"$vcodec"'",vb="'"$vb"'",acodec="'"$acodec"'",ab="'"$ab"'"}:standard{mux="'"$mux"'",dst="'"$filename"'.'"$mux"'",access=file}' \ | |
vlc://quit | |
done | |
} | |
vlcconvert |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment