ffmpeg small cheat sheet

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.

computer user

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store