Search

M y    b r a i n    h u r t s  !                                           w e                 r e a l l y                 t h i n k                   w h a t                y o u             k n o w

29 November 2020

Convert all MOV video files in the current folder to MP4

Convert a single MOV video file to MP4 format:

  ffmpeg -i my_video.mov my_video.mp4
Convert all MOV videos in the current folder and sub-folders to MP4 and delete the orignal .MOV files: For Linux or Mac, or on Windows under msys, cygwin, cmder etc.
for video in `find . -iname "*.mov"` ; do
    ffmpeg -i "${video}" "${video%.*}.mp4" && rm "${video}"
done
NOTE: While the script above might work with most files it will fail with files containing special characters, such as spaces, single or double quotes, slashes, dashes or !#& and others. This is a more robust version that will handle correctly special characters in file names:
find . -iname '*.mov' -print0 | xargs -0 -I {} ffmpeg -i '{}' '{}.mp4' && rm '{}'
And another version of the same that avoids the use of xargs by using a sub-shell:
find . -type f -iname "*.mov" -exec sh -c 'ffmpeg -i "${1}" "${1%.*}.mp4" && rm "${1}" ' _ {} \;
If ffmpeg is not present on your system install it with apt install ffmpeg (on Linux) or brew install ffmpeg on Mac.

2 comments :

  1. hi... sorry to interrupt your post, but I believe this is the only way to contact you...

    this topic is old... but I would still like to know ... did you get a solution?
    https://stackoverflow.com/questions/42125096/how-to-automate-installation-of-play-store-apps-by-package-name

    ReplyDelete
    Replies
    1. @FranChico: if there was a way I would have posted it on that SO page

      Delete