Interesting things you can do with FFmpeg

Interesting things you can do with FFmpeg. convolution, debug, audi

Interesting things you can do with FFmpeg

Download a sample mp4 file and rename it to input.mp4:

wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4

mv ElephantsDream.mp4 input.mp4

Convolution (kernels)

Apply edge enhance
ffmpeg -i input.mp4 -vf convolution="0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128" -c:a copy -c:v h264_nvenc output.mp4
using Nvidia hardware
ffmpeg -i input.mp4 -vf convolution="0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128" -c:a copy -c:v h264 output.mp4
using CPU
edge enhance
Apply edge detect
ffmpeg -i input.mp4 -vf convolution="0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128" -c:a copy -c:v h264_nvenc output.mp4
edge detect
Apply embos
ffmpeg -i input.mp4 -vf convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2" -c:a copy -c:v h264_nvenc output.mp4
embos
Apply blur
ffmpeg -i input.mp4 -vf convolution="1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9" -c:a copy -c:v h264_nvenc output.mp4
blur

Generate macroblock (debug video)

Debug/MacroblocksAndMotionVectors – FFmpeg
ffmpeg -flags2 +export_mvs -i input.mp4 -vf codecview=mv=pf+bf+bb output.mp4

Extract Audio

ffmpeg -i input.mp4 -b:a 320K -vn output-audio.mp3

Sources: