Ben Shi

Blog Post

ffmpeg one liners

Posted Under: notes
October 02, 2012

ffmpeg is a cross-platform library for videos and audio files.

ffmpeg just hit version 1.0 couple days ago and I thought its a good time to blog about some useful one liners I use every now and then.

# Get infomation for a audio/video
ffmpeg -i file.mp3
# Convert video into images
ffmpeg -i video.avi image_output%d.jpg
# Split audio files
# Generate a section of the audio from the 30 second mark (start) for 15 seconds (duration)
ffmpeg -f mp3 -i input.mp3 -t 00:00:30 -ss 00:00:15 output.mp3
# Covert avi to animated gif
ffmpeg -i video.avi output.gif
# Add audio to a video file
ffmpeg -i music.mp3 -i video.avi output.mpg
# Extract audio from video file">## Useful for extracting music from youtube videos
# avi to mp3
ffmpeg -i video.avi -vn -ar 44100 -ac 2 -ab 192k -f mp3 output.mp3

# flv to mp3
ffmpeg -i video.flv -ar 44100 -ac 2 -ab 192k -f mp3 output.mp3

Ben Shi

I'm Ben Shi, a Sydney-based Full Stack Software Engineer specialising in micro-services and API development. This is a playground for me to document my learnings and experiences as a technologist.

You can find out a little bit more about me over here.

Contact: [email | twitter| linkedin]