Saturday, February 29, 2020

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:

ffmpeg -i input.mp4 output.mp4

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

ffmpeg -i input.mp4 -vf "scale=iw/2:ih/2" output.mp4
2. Convert a MOV file to MP4
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:

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

Wednesday, January 01, 2020

fahd.blog in 2019

Happy 2020, everyone!

I'd like to wish everyone a great start to an even greater new year!

In keeping with tradition, here's one last look back at fahd.blog in 2019.

During 2019, I posted 7 new entries on fahd.blog. I am also thrilled that I have more readers from all over the world! Thanks for reading and especially for giving feedback.

Top 3 posts of 2019:

I'm going to be writing a lot more this year, so stay tuned for more great techie tips, tricks and hacks! :)

Related posts: