Windows with ffmpeg — recursively convert all *.mov movies to .mp4. with fixed resolution for android 1


We needed to convert a bunch of mov files to mp4 and while doing that we wanted to shrink them down so that they would fit the screen of an older android device.
We did that both to save space on the internal memory and to make the device perform as efficient as possible as it would not have to shrink the video on the fly.

We downloaded the windows binary for ffmpeg from https://ffmpeg.org/ and copied it to the folder we wanted to execute the command from using Windows Explorer.
After that, while holding the Shift key we right clicked in the Windows Explorer empty area to popup the menu. From the menu we selected Open command window here, that opened a Command Prompt that was already navigated in the folder we placed the binary.
To convert the movies we executed the following:

for /R %f in ("*.mov") do (ffmpeg.exe -i "%~f" -s 864x486 -acodec copy "%~pf%~nf.mp4")

What the above command did was, direct command prompt to find recursively all the files that their name ends in .mov (this is the part that looks like this for /R %f in ("*.mov")) and then execute for each a command, in our case was to convert the file to mp4, resize the video while preserving the audio as is and produce a new file that has the same name but different file extension so that new files will have the mp4 extension instead of mov.

This post is also available in: Greek


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

One thought on “Windows with ffmpeg — recursively convert all *.mov movies to .mp4. with fixed resolution for android

  • George

    find . -type f -name "*.mp4" -exec bash -c 'FILE="$1"; ffmpeg -i "${FILE}" -vf scale=1280:-1 -acodec copy -y "${FILE%.mp4}.shrink.mp4";' _ '{}' \;
    The above code will resize all videos to have a specific width (1280) and depending on the movie a dynamic height.