Yaky's

Editing video using ffmpeg

Usage examples from own experience.

Convert to another codec

ffmpeg -i original_video.mp4 -vcodec libx265 -crf 20 

Resize

fmpeg -i original_video.mp4 -vf "scale=-2:720" video_720.mp4

Crop a rectangular area

ffmpeg -i original_video.mp4 -c:v copy -c:a copy -vf "crop=120:180:640:480;eq=brightness=0.15:contrast=1.3" cropped_video.mp4

Trim by time

ffmpeg -i original_video.mp4 -ss 00:05:30 -t 00:01:00 -c:v copy -an trimmed_video.mp4

Where:

Play video with applied filters

ffplay -ss 00:16:00 -t 00:05:00 -vf "eq=brightness=0.2:contrast=1.5" video_to_play.mp4

Useful for previewing filters you are about to apply.