I've got a one-liner script that uses HandBrake to batch encode all my home movies from .AVI to .mp4. I'd like to give the script some intelligence when it comes to stripping the extensions off the original video file names before naming the new video files. My directory is filled with.avi, .AVI, .mov and .MOV files and I'm renaming them all with .mp4.
Script:
Code:
for file in `ls $PWD`; do $(HandBrakeCLI -i $PWD/${file} -o ${PWD}/"${file%.avi}.mp4" -e x264 -b 1500 -B 192 -w 960 -l 720 -O); done
The
"${file%.avi}.mp4" part, after the
%, is where I'd like to insert a regular expression.
I've tried:
Code:
"${file%[(/.avi|/.AVI|/.mov|/.MOV)]}.mp4"
but that didn't work.
I also tried:
Code:
"${file%[(/.(a|A)vi)|(/.(m|M)ov)]}.mp4"
but that didn't do it either.
Could someone point me in the right direction?