Useful FFmpeg commands

Collection of FFmpeg commands to perform various conversion procedures on audio and video files.

Video Data

ffmpeg -i input.mp4 -hide_banner

Rotate anti clockwise

ffmpeg -i input.mp4 -vf "transpose=2" output.mp4

Rotate clockwise

ffmpeg -i input.mp4 -vf "transpose=1" output.mp4

h265 codec

ffmpeg -i input.mp4 -c:v libx265 output.mp4

Flip video vertically or horizontally

ffmpeg -i input.mp4 -vf vflip -c:a copy output.mp4
ffmpeg -i input.mp4-vf hflip -c:a copy output.mp4

Nvidia GPU h264_nvenc codec

ffmpeg -i input.mp4 -c:v h264_nvenc output.mp4

Convert into mp3 format

ffmpeg -i input.mp4 -vn -ar 44100 -ac 2 -ab 192 -f mp3 output.mp3

Convert into gif format

ffmpeg -i input.mp4 output.gif.mp4

Video resize fixed and flexible

ffmpeg -i input.mp4 -s 720x480 -c:a copy output.mp4
ffmpeg -i input.mp4 -filter:v scale=720:-1 -c:a copy output.mp4

Windows CMD dir batch convert mov to mp4

FOR /F "tokens=*" %G in ('dir /b *.mov') DO ffmpeg -i "%G" "%~nG.mp4"

Removing 1 minute video footage from the beginning

ffmpeg -i input.mp4 -ss 00:01:00 output.mp4

Keep Metadata

-movflags use_metadata_tags

Leave a Comment

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