feat(user/mp4_make480.sh):Use GNU parallel, split into functions
[BK-2020-03.git] / unitproc / bkvideo2webm
CommitLineData
b2fc770c
SBS
1#/bin/bash
2# Desc: Convert video file to webm
3# Usage: bkvideo2webm.sh [ file ]
4# Example:
5# $ for file in ./*; do bkvideo2webm "$file"; done;
6# Ref/Attrib: Geert Van Pamel, original author; date accessed: 2021-06-12; url: https://commons.wikimedia.org/wiki/Help:Converting_video
7# Version 0.1.2
8# Depends: ffmpeg version 4.1.6-1 (see https://tracker.debian.org/pkg/ffmpeg )
9
10# Parameters:
11# P1: input file name
12
13if [[ -z "$1" ]]; then echo "Input file missing"; exit; fi;
14
15input="$1";
16output=$(basename "$1").webm
17
18ffmpeg -i "$input" -c:v libvpx-vp9 -b:v 0 -crf 30 -pass 1 -row-mt 1 -an -f webm -y /dev/null;
19ffmpeg -i "$input" -c:v libvpx-vp9 -b:v 0 -crf 30 -pass 2 -row-mt 1 -c:a libopus "$output";