scripts/video-convert.sh

26 lines
662 B
Bash

#!/bin/bash
while IFS= read -r filepath; do
# Skip empty lines
[ -z "$filepath" ] && continue
# Get the base name without extension and directory
dir=$(dirname "$filepath")
filename=$(basename "$filepath" .wmv)
output="$dir/$filename.mp4"
echo "Converting: $filepath -> $output"
# Run ffmpeg conversion
ffmpeg -i "$filepath" -c:v libx264 -preset fast -crf 23 -c:a aac -b:a 128k "$output"
# If ffmpeg succeeded, delete the original file
if [ $? -eq 0 ]; then
echo "Conversion successful. Deleting: $filepath"
rm "$filepath"
else
echo "Conversion failed for: $filepath"
fi
# find ./ -type f -iname "*.wmv"
done < wmv.txt