#!/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/"