diff --git a/video-convert.sh b/video-convert.sh new file mode 100644 index 0000000..eb68295 --- /dev/null +++ b/video-convert.sh @@ -0,0 +1,25 @@ +#!/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