Created
November 10, 2017 09:55
-
-
Save ravihara/75078bafee933bc91e0d57287c44d1ed to your computer and use it in GitHub Desktop.
This file contains 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 -e | |
# Shell script to convert videos in a folder to mp4 format | |
export IFS=$(echo -en "\n\b") | |
VID_LIST_FILE="/tmp/videos.txt" | |
## List out the videos first | |
rm -f $VID_LIST_FILE | |
for a in $(find . -iname "video*" -type d); do | |
find $a -name "*" -type f | grep -v "Thumbs.db" | sed -e 's/^.\///' >> $VID_LIST_FILE | |
sync | |
done | |
## Convert the videos to mp4 | |
for a in $(cat $VID_LIST_FILE); do | |
b="$(echo $a | sed -e 's/.\w\+$/.mp4/')" | |
ffmpeg -i "$a" -vcodec libx264 -b 500k "$b" && sync | |
done | |
# Finally, remove the temporary video list file | |
rm -f $VID_LIST_FILE | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment