summaryrefslogtreecommitdiff
path: root/files/convert-mp4-to-webm.sh
blob: 5fd56e1c023151649b4b7d557b536dd614d8081e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

SOURCE_DIR="."
OUTPUT_PREFIX="video"
COUNT=1

mkdir -p webm_output &>/dev/null

for FILE in "${SOURCE_DIR}"/*.mp4; do
    OUTPUT_FILE="webm_output/${OUTPUT_PREFIX}${COUNT}.webm"
    printf "%s\n" "[inf] processing ${FILE} -> ${OUTPUT_FILE}"
    ffmpeg -i "${FILE}" -an -c:v libvpx-vp9 -crf 32 -b:v 0 -vf "scale=1920:1080,fps=24" -threads 4 -speed 3 -g 48 "${OUTPUT_FILE}"

    ((COUNT++))
done

printf "%s\n" "[inf] all videos converted to optimized .webm format in ./webm_output/"