- https://gist.github.com/tayvano/6e2d456a9897f55025e25035478a3a50 -> complete list of ffmpeg flags / commands
- https://gist.github.com/Vestride/278e13915894821e1d6f#gistcomment-3023674 -> good quality gist with informative comments
- https://evilmartians.com/chronicles/better-web-video-with-av1-codec -> the new av1 format
- Add -movflags +faststart as per https://rigor.com/blog/optimizing-mp4-video-for-fast-streaming ?
- Resarch 2-pass setup also for libx264/mp4
- Explore av1 (se above)
ffmpeg -i [SOURCE] \
-vf "scale=w=min(iw\,1920):h=-2" \
-c:v libx264 \
-profile high \
-b:v 20000k \
-pix_fmt yuv420p \
out2k_8k.mp4
ffmpeg -i [SOURCE] \
-vf "scale=w=min(iw\,1920):h=-2, fps=fps=30" \
-c:v libx264 \
-profile:v high \
-b:v 8000k \
-pix_fmt yuv420p \
out2k_30fps_8Mb.mp4
ffmpeg -i [SOURCE] \
-vf "scale=w=min(iw\,3840):h=-2, fps=fps=30" \
-c:v libx264 \
-profile:v high \
-b:v 8000k \
-pix_fmt yuv420p \
out4k_30fps_8Mb.mp4
ffmpeg -i [SOURCE] \
-vf "scale=w=min(iw\,3840):h=-2, fps=fps=30" \
-c:v libx264 \
-b:v 8000k \
-maxrate 8000k \
-bufsize 16000k \
-pix_fmt yuv420p \
out4k_30fps_8000mbr.mp4
- https://trac.ffmpeg.org/wiki/Encode/VP9
- https://www.webmproject.org/docs/encoder-parameters/
- https://developers.google.com/media/vp9
result: 24 hour encoding. 6.8MB file. Not good enough quality
ffmpeg -y -i [SOURCE] -an -c:v libvpx-vp9 -pass 1 \
-b:v 6000k \
-minrate 3000k \
-maxrate 8700k \
-crf 24 \
-quality best \
-f webm /dev/null && \
ffmpeg -i [SOURCE] -an -c:v libvpx-vp9 -pass 2 \
-b:v 6000k \
-minrate 3000k \
-maxrate 8700k \
-crf 24 \
-quality best \
-speed 2 \
-threads 2
-f webm out-6k-crf24.webm
ffmpeg -y -i [SOURCE] \
-c:v libvpx-vp9 \
-b:v 0 \
-pass 1 \
-an\
-f webm /dev/null && \
ffmpeg -i [SOURCE] \
-c:v libvpx-vp9 \
-b:v 0 \
-pass 2 \
-an
out_avg-br.webm
ffmpeg -y -i [SOURCE] \
-c:v libvpx-vp9 \
-pass 1 \
-b:v 2M \
-vf "scale=w=min(iw\,1920):h=-2" \
-crf 30 \
-speed 4 \
-an \
-quality good \
-f webm /dev/null
ffmpeg -y -i [SOURCE] \
-c:v libvpx-vp9 \
-pass 2 \
-b:v 2M \
-vf "scale=w=min(iw\,1920):h=-2" \
-crf 30 \
-quality good \
-speed 2 \
-an \
-f webm out.webm
ffmpeg -i [SOURCE] \
-an \
-frames:v 1 \
-vf "scale=w=1920:h=-1" \
image.jpg
Optional forced scaling with crop
-vf "scale=200:100:force_original_aspect_ratio=increase,crop=200:100"
prop | desc | ||
---|---|---|---|
-an | skip audio | ||
-c:v libx264 | codec video | ||
-c:a copy | copies audio (no codec) | ||
-b:vf | video bitrate | ||
-vf | filtergraph | ||
scale | scaling. See https://trac.ffmpeg.org/wiki/Scaling | ||
h=-2 | (preserve aspec ratio as multiple of 2 | ||
w=min(iw,1920) | input width but not over 1920 (no upscaling) | ||
fps=fps=30 | frame per second in output | ||
-pix_fmt yuv420p | Chroma subsampling: 4:2:0. I have no fucking idea... | ||
-r 24 | force the frame rate to 24 fps. (NB: Better to use fps filter) | ||
-y | Overwrite output files without asking. | ||
>>>>>>>>> | For thumbnails | ||
-ss 100 | Position | ||
-frames:v 1 | Number of frames / images |