Created
December 13, 2021 06:47
-
-
Save nanawel/accc64e0e238eeca762afdbc1a765185 to your computer and use it in GitHub Desktop.
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/bash | |
# transcode_ffmpeg.sh | |
# Nanawel 2014 | |
# https://lanterne-rouge.info/2014/01/num%C3%A9risation-de-vhs-sous-linux | |
echo "====== Transcode (FFmpeg) ======" | |
#OUTPUT=/mnt/workspace/videos/record_$(date +%s).tr.mkv | |
VCODEC="mpeg4" # Video codec | |
ACODEC="mp3" # Audio codec | |
VB="6000k" # Video bitrate | |
AB="160k" # Audio bitrate | |
BIN="ffmpeg" | |
if [ -z "$1" ]; then | |
echo Missing argument | |
exit 1 | |
fi | |
IN=$1 | |
STARTTIME="" | |
if [ ! -z "$2" ]; then | |
STARTTIME="-ss $2" | |
fi | |
STOPTIME="" | |
if [ ! -z "$3" ]; then | |
STOPTIME="-to $3" | |
fi | |
OUTPUT=$IN.mkv | |
if [ -f $OUTPUT ]; then | |
echo "Output file $OUTPUT already exists! Aborting." | |
exit 2 | |
fi | |
CMD="$BIN -i $IN \ | |
-c:v $VCODEC -b:v $VB \ | |
-c:a $ACODEC -b:a $AB \ | |
$STARTTIME $STOPTIME \ | |
$OUTPUT" | |
echo "====== Command ======" | |
echo $CMD | |
echo | |
echo Press Enter to confirm or Ctrl-C to abort | |
read | |
echo "====== Running ======" | |
$($CMD) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment