Skip to content

Instantly share code, notes, and snippets.

@hasenbalg
Last active June 21, 2018 10:18
Show Gist options
  • Save hasenbalg/7fd0f43d78a35c1097f7804159aa1479 to your computer and use it in GitHub Desktop.
Save hasenbalg/7fd0f43d78a35c1097f7804159aa1479 to your computer and use it in GitHub Desktop.
rename and convert all .mov files in a dir structure
#!/bin/bash
# install rename and libav-tools
# place this script in the root dir of the video dirs
# get all the spaces out of the names
find . -depth -name "* *" -execdir rename 's/ /_/g' "{}" \; #https://stackoverflow.com/a/2709619/4062341
# convert all the videos. (remove the echo)
# https://superuser.com/a/1059219/895813
for i in `find . -name "*.mov" -print0| xargs -0`; do
echo avconv -i $i -c:v libx264 -strict -2 -y -f mp4 ${i%.mov}.mp4;
done
#for i in `find . -name "*.mov" -print0| xargs -0`; do rm $i ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment