Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 903 Bytes

encode video.wiki

File metadata and controls

30 lines (23 loc) · 903 Bytes

  1. Encoding video for the web
    1. generate cover image
```sh ffmpeg -i "$1" -vframes 1 -vf scale=$3:-2 -q:v 1 "$2.jpg" ```

    1. mp4
      1. no audio
``` ffmpeg -i "$1" -an -vf scale=$3:-2 -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -level 3.0 -movflags +faststart -threads 0 -preset veryslow "$2.mp4" ```

      1. with audio
``` ffmpeg -i "$1" -an -vf scale=$3:-2 -vcodec libx264 -pix_fmt yuv420p -c:a aac -profile:v baseline -level 3.0 -movflags +faststart -threads 0 -preset veryslow "$2.mp4" ```

    1. webm
``` ffmpeg -i "$1" -vf scale=$3:-2 -c:v libvpx-vp9 -pass 1 -b:v 1000K -threads 1 -speed 4 \

  -tile-columns 0 -frame-parallel 0 \
  -g 9999 -aq-mode 0 -an -f webm /dev/null

ffmpeg -i "$1" -vf scale=$3:-2 -c:v libvpx-vp9 -pass 2 -b:v 1000K -threads 1 -speed 0 \

  -tile-columns 0 -frame-parallel 0 -auto-alt-ref 1 -lag-in-frames 25 \
  -g 9999 -aq-mode 0 -c:a libopus -b:a 64k -f webm "$2"

```