Last active
January 12, 2018 05:20
-
-
Save kuntalchandra/9bc89f8b6425a45bb3f96fa3ca5ac0d4 to your computer and use it in GitHub Desktop.
Convert mkv file to avi file. Applicable to a list of files. Uses xargs for parallel processing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
shopt -s nullglob | |
source_files=(/home/kuntal/Videos/Tom.and.Jerry.The.Golden.Collection.Volume.One.720p.BluRay/*.mkv) | |
convert() { | |
source_file=$(echo $0 | cut -f1 -d:) | |
target_file=$(echo $0 | cut -f2 -d:) | |
echo "source file: $source_file" | |
ffmpeg -i $source_file $target_file | |
echo "converted file: $target_file" | |
sleep 1 | |
} | |
export -f convert | |
for source_file in "${source_files[@]}"; do | |
filename="${source_file%.*}" | |
target_file="$filename.avi" | |
echo "$source_file:$target_file" | |
done | xargs -t -I{} --max-procs=3 bash -c convert "{}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment