my-scripts/Convert2mkv.sh

32 lines
1.3 KiB
Bash
Raw Normal View History

2021-11-07 14:10:16 +00:00
#!/bin/bash
# Convert input video in a vp9/libvorbis mkv
#
# (c) LUG-VS (GPL)
VERSION="$(basename $0) Version 0.0.2 from 08.11.2019"
2021-11-07 14:10:16 +00:00
#
# Input: VideoFile.mp4 (or other video container format like webm)
# Output: VideoFile.mkv (convertet to vp9/libvorbis)
#
# Changes:
# 0.0.2: scale to full-HD 1920x1080 (1080p)
2021-11-07 14:10:16 +00:00
# 0.0.1: generation
#
## If VideoFile is first parameter
if [ $# -gt 0 ] && [ -e $1 ]; then
filename=$(basename -- "$1")
# extension="${filename##*.}"
filename="${filename%.*}"
## Convert input Video to VP9 and scale it to 1080p - convert audio to libvorbis in an mkv container
# ffmpeg -i $1 -c:v vp9 -vf scale=1920:1080 -c:a libvorbis ${filename}.mkv
## Convert input Video to VP8 and scale it to 1080p - convert audio to libvorbis in an mkv container
# ffmpeg -i $1 -c:v vp8 -vf scale=1920:1080 -c:a libvorbis ${filename}.mkv
## Scale imput video to 1080p and convert audio to libvorbis in an mkv container
# ffmpeg -i $1 -vf scale=1920:1080 -c:a copy ${filename}.mkv
## Convert video and audio copy in an mkv container
ffmpeg -i $1 -c:v copy -c:a copy ${filename}.mkv
2021-11-07 14:10:16 +00:00
else
## Show help
echo -e "** Konvertiert eine beliebige Videodatei in ein vp9/libvorbis mkv Kontainer. Benutzung: \n\t$(basename $0) <Videodatei>"
fi