I have a whole bunch of text files, jpg and mp4 in a folder. I want the jpg and text files to be left alone. I want to compress all the mp4 using ffmpeg's -crf
argument with a value of 23
, to save disk space. Files should be overwritten in place.
I used @llogan answer here, and replaced .avi
with .mp4
but that does not work.
for f in *.mp4; do ffmpeg -i "$f" -c:v libx264 -crf 23 -preset medium \
-c:a aac -b:a 128k -movflags +faststart -vf scale=-2:720,format=yuv420p \
"encoded/${f%.avi}.mp4"; done
What would the for
loop be to convert mp4 to lower quality (-crf 23
), in place, without deleting and/or modifying any other files in the same working directory? I don't really want the other flags either, because I won't be doing resizing, youtube uploading, changing encoding speed, etc.