💻
Cheatsheets
  • Most Useful Command Line Tools: 50 Cool Tools to Improve Your Workflow, Boost Productivity, and More
  • 7_tips_to_reverse_engineer_javascript
  • Configuring a Repl
  • How to create your command-line program (CLI) with NodeJS and Commander.js | by Duc N. | JavaScript
  • replit Node.JS 24/7 Project Hoster
  • cheatsheets
  • Alacritty, Tmux, and Vim
  • amethyst
  • Android
  • Installing Arch Linux
  • Arch Linux
  • aria2
  • bin
  • bspwm
  • Chocolately Notes
  • command_line_pipes
  • CSS Grid
  • curl
  • The curl guide to HTTP requests
  • Docker
  • Easymotion
  • Emmet
  • Favorite figlet fonts
  • FFMPEG
  • figlet
  • File Serve
  • File Transfer
  • fish shell
  • Front End Dev Links
  • How to use Git.io to shorten GitHub URLs and create vanity URLs
  • Git
  • Downloading a Tarball from GitHub
  • Make Infinite Gmail Addresses For One Inbox
  • How To Use GPG on the Command Line
  • guide_to_fish_completions
  • Homebrew
  • How to clean Arch Linux
  • HTML5 Boilerplate
  • Install
  • All the keyboard shortcuts you’ll ever need for Safari on iPad
  • iosevka
  • iPhone
  • ish (iOS)
  • Javascript Notes
  • jq
  • Jupyter Notebooks
  • Lettering
  • lf-wiki
  • lf
  • Command Line
  • Adding a swapfile after a clean installation without swap partition
  • mac_bluetooth_issues
  • Mac Terminal
  • maim
  • markdown-sample
  • Markdown Notes
  • Images in README.md Markdown Files
  • Organizing information with tables
  • md_cheatsheet
  • NiftyWindows Help
  • nix
  • Justin Restivo - A Portable Text Editor: Nix <3 Neovim
  • NPM
  • neovim configuration
  • Pastery
  • Powershell
  • Table of Basic PowerShell Commands | Scripting Blog
  • Powershell Modules
  • Puppeteer
  • Python
  • rclone-colab
  • replit
  • Hi there, I'm Raju Ghorai - a.k.a. [coderj001]
  • Scriptable
  • Servor
  • Replacing Postlight’s Mercury scraping service with your self-hosted copy
  • Shell Scripts
  • skhd
  • Spicetify
  • SSH
  • SurfingKeys
  • tar
  • Terminal Web Browser Docker
  • Text Generators
  • tmux shortcuts & cheatsheet
  • unicode
  • VIM
  • VIM Diff
  • vi Complete Key Binding List
  • 8 Essential Vim Editor Navigation Fundamentals
  • Vim Shortcut Keys
  • Vite
  • VNC
  • web-servers
  • Web Server
  • Windows Command Line
  • Writeguard
  • WSL Cheatsheet
  • youtube-dl
  • zsh Plugins
  • zspotify
Powered by GitBook
On this page
  • Convert AVI to MP4
  • Convert Image Sequence to Video
  • Convert .mov to .mp4
  • Converting .oog to .mp3

Was this helpful?

FFMPEG

PreviousFavorite figlet fontsNextfiglet

Last updated 2 years ago

Was this helpful?

Convert AVI to MP4

no Re-encode: Only changing the container

ffmpeg -i input_filename.avi -c:v copy -c:a copy -y output_filename.mp4

In this commandline, you are providing

  • the AVI video as input

  • specifying the name of the output MP4 file,

  • instructing FFmpeg to directly copy the audio and video (seen here: -c:v copy -c:a copy) from the AVI container format to the MP4 container format.

Convert Image Sequence to Video

Sequential

In this example the input images are sequentially named img001.png, img002.png, img003.png, etc.

ffmpeg -framerate 24 -i img%03d.png output.mp4
  • When outputting H.264, adding -vf format=yuv420p or -pix\_fmt yuv420p will ensure compatibility so crappy players can decode the video. See the for more info.

  • If -framerate option is omitted the default will input and output 25 frames per second. See for more info.

Starting with a specific image

For example if you want to start with img126.png then use the -start_number option:

ffmpeg -start_number 126 -i img%03d.png -pix_fmt yuv420p out.mp4

Pipe

You can use cat or other tools to pipe to ffmpeg:

cat *.png | ffmpeg -f image2pipe -i - output.mkv

Convert .mov to .mp4

ffmpeg -i IMG_1530.mov -vcodec h264 -acodec mp2 my-video.mp4

Converting .oog to .mp3

I used this command:

ffmpeg -i audio.ogg -b:a 320k audio.mp3

Here is a more complicated version:

ffmpeg -i input.wav -vn -ar 44100 -ac 2 -b:a 192k output.mp3

Explanation of the used arguments in this example:

  • -i - input file

  • -vn - Disable video, to make sure no video (including album cover image) is included if the source would be a video file

  • -ar - Set the audio sampling frequency. For output streams it is set by default to the frequency of the corresponding input stream. For input streams this option only makes sense for audio grabbing devices and raw demuxers and is mapped to the corresponding demuxer options.

  • -ac - Set the number of audio channels. For output streams it is set by default to the number of input audio channels. For input streams this option only makes sense for audio grabbing devices and raw demuxers and is mapped to the corresponding demuxer options. So used here to make sure it is stereo (2 channels)

  • -b:a - Converts the audio bitrate to be exact 192kbit per second

colorspace and chroma-subsampling
Frame rates