ffmpeg small cheat sheet

Nikola Mandic
1 min readJul 9, 2019

Here is some quick and dirty video editing that one can use to for example submit app preview to app store or meet constraints on video like duration and resolution.

If we want to rescale our video we could do something like

ffmpeg -i preview.mov -vf scale=886:1920 video_640.mp4

if we want to strip sound we could

ffmpeg -i video_640.mp4 -an -vcodec copy output_file.mp4

if we want to add sound we could

ffmpeg -i output_file.mp4 -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 \\n-c:v copy -shortest output.mp4

if we want to change FPS we could do following

ffmpeg -y -i output.mp4 -c copy -f h264 output.h264

followed by

ffmpeg -y -r 30 -i output.h264 -c copy output3.mp4

now that we changed FPS video might be long

lets speed it up lets say 4 times

ffmpeg -i output3.mp4 -filter:v “setpts=0.20*PTS” output4.mp4

It takes a few google searches but here it is sublimed.