Introducing AfsaneDB (Beta) – Now Available on Play Store!

Dive into the world of classic literature with AfsaneDB. Explore timeless masterpieces in an elegant and user-friendly app, designed for book lovers like you.

Monday, 10 August 2026

Perfect ffmpeg commands that I use regularly for audio/video conversion


Ffmpeg is a gigantic library with customizations that makes people like me happy. I'm a man of 'give me life customization' kind, so it's a treat for me. 

I do the same when I build my own software and apps - most people don't even realize what I keep hidden in my apps, because layman don't need them or don't want to go into complexities of learning them. But for power users it's a blessing.

Ffmpeg is backbone of every video/audio/downloader tool out there. Every app that you see for YouTube download, Audio or Video manipulation online, be it web app, android app, iOS app or desktop app, it's all based on ffmpeg more or less.

Anyway, over the years I have accumulated quite a lot of ffmpeg commands that I use, and when I make something work/tweak perfectly according to my liking, it goes into number of note taking apps that I have (scattered everywhere). 

This blog post is to keep a track of all those commands so that I can come back here and pick those instead of going through my stuff looking for 'that perfect command' again.

Mp4 to Mp3 (or any other format)

Simple and useful, one format to another.

ffmpeg -i input.mp4 -vn output.wav

The vn flag is optional - it's to say `video no` meaning drop the video. Of course you can convert video to another video format, or audio to another audio format or any permutation that you like.

Slow down the video/audio

I have experimented quite a lot of things, stretching the time and the pitch shift etc. What gives us exact speed control is knowing your source, which is usually 41 or 48 kHz. 

Here's the command for an audio file that goes kaboom.

ffmpeg -i input.mp4 -vn -af "asetrate=24000,aresample=48000" output_slow.wav

YouTube video

There's another lib made on top of ffmpeg, for everything YouTube or any online video grabbing. You'll see a port of it in every language. It's called `yt-dl` or another famous fork of it, `yt-dlp`. 
You can get the whole video or a part of it. Example:

yt-dlp -f "(bestvideo+bestaudio/best)[protocol!*=dash]" --external-downloader ffmpeg --external-downloader-args "ffmpeg_i:-ss 815 -to 903" "https://youtu.be/gwjFSonRzno"

Will keep adding commands here. Until then, thanks for the visit.

Rab raakha. 

Shakeeb Ahmad Maharashtra, India

Shakeeb Ahmad is a blogger, poet, enthusiast programmer, student of comparative religion and psychology, public speaker, singer and Vedic Maths expert. He loves playing with the numbers and invented a shortcut method to square the numbers at the age of 16. In sports, football is root to his happiness. He lives it.

No comments:

Post a Comment