FFMPEG

Door Kor Dwarshuis op 2022-05-25

How to use FFMPEG on the command line.

Use FFMPEG

If you are comfortable using the command line, then stop using all these applications for video editing and start using FFMPEG.

One way to install is via Homebrew.

Crop

Source: https://video.stackexchange.com/a/4571

Where the options are as follows:

  • out_w is the width of the output rectangle
  • out_h is the height of the output rectangle
  • x and y specify the top left corner of the output rectangle
ffmpeg -i input.mp4 -filter:v "crop=888:555:0:400" output.mp4

Cut

Source: https://stackoverflow.com/a/42827058

The timing format is: hh:mm:ss

ffmpeg -ss 00:01:00 -to 00:02:00 -i input.mp4 -c copy output.mp4

MOV to MP4

Source: https://mrcoles.com/convert-mov-mp4-ffmpeg/

The “30” is my preference for the quality of the video. A lower value generally leads to higher quality.

ffmpeg -i input.mov -preset veryslow -crf 30 output.mp4

MP4 to MP3

Source: https://stackoverflow.com/questions/3255674/convert-audio-files-to-mp3-using-ffmpeg/12952172#12952172

ffmpeg -i input.mp4 -vn -ar 44100 -ac 2 -b:a 192k output.mp3

Remove audio

Source: https://ottverse.com/add-remove-extract-audio-from-video-using-ffmpeg/

ffmpeg -i input.mp4 -c:v copy -an output.mp4

Find codec

ffprobe -hide_banner -stats -i input.mp4 2>&1 >/dev/null | grep Stream

Remove metadata

Source: https://superuser.com/a/428039

ffmpeg -i input.mp4 -map_metadata -1 -c:v copy -c:a copy output.mp4