Created
November 10, 2017 09:55
-
-
Save ravihara/75078bafee933bc91e0d57287c44d1ed to your computer and use it in GitHub Desktop.
Revisions
-
ravihara created this gist
Nov 10, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ #!/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