TIL you can convert media file extensions with ffmpeg
Benji 🍙
Posted on May 28, 2023
You can convert a video clips file extension using ffmpeg like this:
$ ffmpeg -i chill.mp4 chill.wav
$ ll
-rw-r--r-- 1 hello world 84317363 21 Jun 2022 chill.mp4
-rw-r--r-- 1 hello world 49074254 28 May 13:13 chill.wav
You can also play directly from the terminal (which opens in a new window)
$ ffplay chill.mp4
And probably the most useful I found, which is to convert a video clip to a .gif
for PRs/MRs
ffmpeg -i in.mov -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > out.gif
Notes on the arguments:
-r 10
tells ffmpeg to reduce the frame rate from 25 fps to 10-s 600x400
tells ffmpeg the max-width and max-height--delay=3
tells gifsicle to delay 30ms between each gif--optimize=3
requests that gifsicle use the slowest/most file-size optimization
(full credits for this one go to this README.md)
💖 💪 🙅 🚩
Benji 🍙
Posted on May 28, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.