# FFMPEG

## Slow down a gif

```bash
ffmpeg \
-r 100 \
-i "solid-snake-mgs.gif" \
-vf " minterpolate=50,split[g][p]; [p]palettegen[p]; [g][p]paletteuse" out.gif
```

## Combine images into a gif

```bash
ffmpeg \
-f image2 \
-framerate 3 \
-i frame_%d.jpeg video.gif
```

## Compression

```bash
ffmpeg \
-hwaccel vaapi \
-vaapi_device /dev/dri/renderD128 \
-hwaccel_output_format vaapi \
-i input.mp4 \
-c:v hevc_vaapi \
-rc_mode 1 \
-qp 25 \
output.mp4

ffmpeg \
-hwaccel vaapi \
-vaapi_device /dev/dri/renderD128 \
-hwaccel_output_format vaapi \
-i input.mp4 \
-c:v h264_vaapi \
-b:v 0 \
-maxrate 10M \
output.mp4
```

## DVD Ripping

```bash
# Concat the vob
ffmpeg \
-safe 0 \
-f d \
-i mylist.txt \
-c copy \
~/Downloads/ep1.vob

# Convert the vob
ffmpeg \
-i /run/media/ducoterra/DINOTOPIA_DISC_1/VIDEO_TS/VTS_01_1.VOB \
-vf yadif \
-c:v libx264 \
-preset slow \
-crf 19 \
-c:a aac \
-b:a 256k \
~/Downloads/VTS_01_1.mp4
```
