1
0
Fork 0

Add some scripts used in post-production

master
Ambrose Chua 2020-03-26 23:16:54 +08:00
parent cdfb87762a
commit e627e6e002
Signed by: ambrose
GPG Key ID: BC367D33F140B5C2
3 changed files with 68 additions and 0 deletions

20
scripts/README.md Normal file
View File

@ -0,0 +1,20 @@
# Requirements
- [ffmpeg](https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz)
# `audio.sh`
Normalise audio
```
Usage: ./audio.sh videofile
```
# `cutgui.sh`
Download and run LosslessCut in a temp directory
```
Usage: ./cutgui.sh
```

26
scripts/audio.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/sh
set -e
mode=loudnorm
file="$1"
outfile="${file%.*}.audiotweaked.${file##*.}"
if [[ -z "$file" ]]; then
echo "Usage: $0 videofile"
exit 1
fi
if [[ "$mode" == "mean" ]]; then
# A simple way to detect mean_volume and use it to tweak the entire file
ffmpeg -i "$file" -filter:a volumedetect -f null /dev/null
read -p "Enter mean_volume: " volume
ffmpeg -i "$file" -filter:a "volume=$volume" -af "highpass=f=200, lowpass=f=3000" "$outfile"
elif [[ "$mode" == "loudnorm" ]]; then
# Use the recommended loudnorm filter
ffmpeg -i "$file" -vcodec copy -af "loudnorm" "$outfile"
else
echo "Unknown mode"
exit 1
fi

22
scripts/cutgui.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
set -e
temp=/tmp/lossless-cut
download=https://github.com/mifi/lossless-cut/releases/download/v3.17.4/LosslessCut-linux.tar.bz2
mkdir -p "$temp"
if [[ ! -f "$temp/lossless-cut" ]]; then
echo "lossless-cut not found in $temp"
echo "Downloading lossless-cut..."
wget -nv --show-progress "$download" -O "$temp/archive.tar.bz2"
echo "Extracting lossless-cut..."
tar -xf "$temp/archive.tar.bz2" -C "$temp" --strip-components=1
echo "Successfully obtained lossless-cut"
fi
"$temp/lossless-cut" "$@"