How to Convert All The .MOV Videos To .MP4 in folder

using ubuntu 14.04 i am a newbie can anyone help how to easily convert all the .mov files in my /var/sentora/hostdata/zadmin/public_html/ctkdonline_com/wp-content/uploads/2015/08 folder need to convert all the .MOV files to .MP4 please help :)


Solution 1:

Here are the proper methods:

Stream copy

If you simply want to re-mux instead of re-encode, and if the input streams are compatible with MP4, you can just stream copy. It is fast and will preserve quality:

mkdir out
for f in *.mov; do ffmpeg -i "$f" -c copy -movflags +faststart out/"${f%.mov}.mp4"; done

Re-encode

If you want to re-encode:

mkdir out
for f in *.mov; do ffmpeg -i "$f" -c:v libx264 -crf 23 -preset medium -c:a aac -strict experimental -b:a 192k -movflags +faststart out/"${f%.mov}.mp4"; done

Adjust -crf and -preset according to your needs as described in FFmpeg Wiki: H.264 Video Encoding Guide. Or just rely on the defaults if it looks acceptable (-crf 23 -preset medium will be used if you omit these options).

For audio info see FFmpeg Wiki: AAC Audio Encoding Guide.

Stream copy one stream, re-encode another

Of course you can do both if you prefer:

mkdir out
for f in *.mov; do ffmpeg -i "$f" -c:v libx264 -c:a copy -movflags +faststart out/"${f%.mov}.mp4"; done

Getting ffmpeg

Since you used the ffmpeg tag I'll assume that's what you want to use. Ubuntu 14.04 doesn't provide ffmpeg, but even if it did I would recommend using a recent build since development is very active. You have 4 main options as described in FFmpeg on Ubuntu Trusty (static build or PPA is easiest).