https://github.com/yangboz/ffmpeg-cheatsheet
FFMPEG Cheatsheet.
https://github.com/yangboz/ffmpeg-cheatsheet
ffmpeg ffmpeg-command ffmpeg-libraries ffmpeg-script video-processing
Last synced: 7 months ago
JSON representation
FFMPEG Cheatsheet.
- Host: GitHub
- URL: https://github.com/yangboz/ffmpeg-cheatsheet
- Owner: yangboz
- License: mit
- Created: 2018-09-29T01:33:14.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-09-04T08:05:59.000Z (about 1 year ago)
- Last Synced: 2025-02-28T22:36:02.390Z (7 months ago)
- Topics: ffmpeg, ffmpeg-command, ffmpeg-libraries, ffmpeg-script, video-processing
- Homepage: http://smartkit.club
- Size: 62.5 KB
- Stars: 5
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ffmpeg-cheatsheet
for single image, please check:https://github.com/yangboz/imagemagick-cheatsheet
FFMPEG Cheatsheet.
**Want to improve this cheat sheet? See the [Contributing](#contributing) section!**
## Table of Contents
* [Why FFMPEG?](#why-ffmpeg)
* [Prerequisites](#prerequisites)
* [Installation](#installation)
* [Best Practices](#cheatsheet)
* [Tools](#tools)
* [Contributing](#contributing)## Why FFMPEG
FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations.
A complete, cross-platform solution to record, convert and stream audio and video.
Converting video and audio has never been so easy.TL;NR
## Prerequisites
https://ffmpeg.org/documentation.html
### Video format
mp4,avi,mpeg,flv...
### Video Processing
### Video codec
TL;NR
## Installation
http://ffmpeg.org/download.html
### Linux
```
apt-get install ffmpeg
``````
yum install ffmpeg
```### MacOS
```
brew install ffmpeg
```### Windows
https://ffmpeg.org/download.html#build-windows
#### Memory Constraints
#### Overview
```
_______ ______________
| | | |
| input | demuxer | encoded data | decoder
| file | ---------> | packets | -----+
|_______| |______________| |
v
_________
| |
| decoded |
| frames |
|_________|
________ ______________ |
| | | | |
| output | <-------- | encoded data | <----+
| file | muxer | packets | encoder
|________| |______________|```
### Cheatsheet
ffmpeg [global_options] {[input_file_options] -i input_url} ... {[output_file_options] output_url} ...
### Info
```ffmpeg info```
#### mp4 to avi:
```
ffmpeg -i input.mp4 output.avi
```#### gif to mp4:
```
ffmpeg -i animated.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" video.mp4
```#### webm to mp4:
```
ffmpeg -i movie.webm movie.mp4
```#### Resize:
```
```#### Extract to images
```
ffmpeg -i video.mpg image-%04d.jpg
```
#### pngs to video
```
ffmpeg -framerate 30 -pattern_type glob -i '*.png' \
-c:v libx264 -pix_fmt yuv420p out.mp4
```#### take snapshot of video
```
ffmpeg -i VID_20200720_092249.mp4 -y -f image2 -ss 08.010 -t 0.001 -s 352x240 b.jpg
```#### Specifying start and end frames
```
ffmpeg -r 60 -f image2 -s 1920x1080 -start_number 1 -i pic%04d.png -vframes 1000 -vcodec libx264 -crf 25 -pix_fmt yuv420p output.mp4
```### jpgs to video with video filter
```
ffmpeg -framerate 10 -pattern_type glob -i '*.jpg' \
-c:v libx264 -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -pix_fmt yuv420p out609cfbgs.mp4```
### jpgs to video with video filter
```
ffmpeg -framerate 10 -pattern_type glob -i '*.jpg' \
-c:v libx264 -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -pix_fmt yuv420p out609cfbgs.mp4```
### add background music
```
ffmpeg -i audio.mp3 -i input.mp4 -filter_complex "[0:a][1:a]amerge,pan=stereo|c0