How to use ffmpeg

Most of this is from here eh.

Basic usage

ffmpeg -i source.mp4 OPTIONS output.mp4

Important options

Use h.264 encoding

-c:v libx264

Processing speed

-preset slow

Adjust volume:

-af 'volume=1.2'

Scale the resolution (use -2 if the resolution doesn't divide well):

-vf scale=-1:720

Stretch the resolution (setsar tells player not to squish later):

-vf "scale=1280:760,setsar=1"

Quality setting (27 is probably okay)

-crf 27

Start and stop times (trim video)

-ss 00:01:54 -to 00:06:53

Crop video

-vf "crop=W:H:X:Y"
  • W is the desired width of the output video
  • H is the desired height of the output video
  • X:Y are the output coordinates of the top left corner to start at on original video
  • Example: "crop=960:720:150:0" - would crop video with 150px bars to 4:3 ratio

Basic audio settings: 2 channel AAC at 128k

-c:a aac -b:a 128k -ac 2
tips/how_to_convert_video_with_ffmpeg.txt · Last modified: 2024-08-04 19:04 by snork
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki