Home » Shell Scripting » FFmpeg Cheatsheet

About Fahd Shariff

Fahd Shariff
Fahd is a software engineer working in the financial services industry. He is passionate about technology and specializes in Java application development in distributed environments.

FFmpeg Cheatsheet

FFmpeg is a great command-line tool for dealing with audio and video files. Here are some useful commands:

1. Reduce the size of a file

Try passing the file straight through ffmpeg and check if the size reduces:

1
ffmpeg -i input.mp4 output.mp4

To reduce the size further, scale the video to half the width and height:

1
ffmpeg -i input.mp4 -vf "scale=iw/2:ih/2" output.mp4

2. Convert a MOV file to MP4

1
ffmpeg -i input.mov -vcodec h264 -acodec aac -strict -2 out.mp4

3. Create a video from an image by panning across it

If you have a landscape image, first set its height to 1600px, preserving aspect ratio (using an image editor such as IrfanView). Then run the following command to create a video which pans across the image from left to right:

1
ffmpeg -loop 1 -i input.jpg -vf crop=1200:ih:'min((iw/10)*t,9*iw/10)':0 -t 5 out.mp4

Published on System Code Geeks with permission by Fahd Shariff, partner at our SCG program. See the original article here: FFmpeg Cheatsheet

Opinions expressed by System Code Geeks contributors are their own.

(0 rating, 0 votes)
You need to be a registered member to rate this.
Start the discussion Views Tweet it!
Do you want to know how to develop your skillset to become a sysadmin Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. Introduction to NGINX
2. Apache HTTP Server Cookbook
3. VirtualBox Essentials
4. Nagios Monitoring Cookbook
5. Linux BASH Programming Cookbook
6. Postgresql Database Tutorial
and many more ....
I agree to the Terms and Privacy Policy
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments