Converting video in Linux system

Converting video in Linux system from a smartphone to save space is very easy with ffmpeg:
ffmpeg -i input.mp4 -c:v libx265 -crf 28 -preset medium -c:a aac -b:a 128k output.mp4

If you would like to additionally rotate the video clockwise you need to add -vf "transpose=1", so:

ffmpeg -i input.mp4 -c:v libx265 -crf 28 -preset medium -c:a aac -b:a 128k -vf "transpose=1" output.mp4

Counter clockwise is -vf "transpose=2"

Rotating by 180 degrees may be performed by:

ffmpeg -i input.mp4 -vf "hflip,vflip" -c:v libx265 -crf 28 -preset medium -c:a aac -b:a 128k output.mp4

For MOV files you can use:

ffmpeg -i input.MOV -c:v libx265 -tag:v hvc1 -crf 28 -preset medium -c:a aac -b:a 128k output.mp4

And in a loop:

for f in *.mp4; do ffmpeg -i "$f" -c:v libx265 -crf 28 -preset medium -c:a aac -b:a 128k "${f%.mp4}_converted.mp4"; done


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

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