“Video Sources” for filter testing¶
Watch on youtube.comThe main purpose of filters belonging to the “Video Sources” category is in most cases filter testing, and for everyday use we only use “buffer”, “color”, and “nullsrc”.
Here I introduce only those that can be used for filter testing purposes. In other words, “buffer” and “nullsrc” are omitted.
All examples here are written by ffmpeg, but for everyday use it is easier to use ffplay like this:
[me@host: ~]$ ffplay -f lavfi mptestsrc
- see also
cellauto=p=@:s=800x300:full=0:rule=18:rate=25¶
00:00:26#! /bin/sh
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y -filter_complex "
cellauto=p=@:s=800x300:full=0:rule=18:rate=25,trim=0:15
,scale='-1:min(ih,1080)'
,pad=1920:1080:(ow-iw)/2:(oh-ih)/2
,setsar=1
,format=yuv420p
[v]
" -map '[v]' -an out.mp4
mandelbrot=s=800x600:maxiter=136:rate=25¶
00:00:41#! /bin/sh
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y -filter_complex "
mandelbrot=s=800x600:maxiter=136:rate=25,trim=0:10
,scale='-1:min(ih,1080)'
,pad=1920:1080:(ow-iw)/2:(oh-ih)/2
,setsar=1
,format=yuv420p
[v]
" -map '[v]' -an out.mp4
mptestsrc=rate=25¶
00:00:51#! /bin/sh
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y -filter_complex "
mptestsrc=rate=25:d=15
,scale='-1:min(ih,1080)'
,pad=1920:1080:(ow-iw)/2:(oh-ih)/2
,setsar=1
,format=yuv420p
[v]
" -map '[v]' -an out.mp4
life=ratio=2/3:s=800x600:rate=25¶
00:01:06#! /bin/sh
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y -filter_complex "
life=ratio=2/3:s=800x600:rate=25,trim=0:10
,scale='-1:min(ih,1080)'
,pad=1920:1080:(ow-iw)/2:(oh-ih)/2
,setsar=1
,format=yuv420p
[v]
" -map '[v]' -an out.mp4
allrgb=rate=25¶
00:01:16#! /bin/sh
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y -filter_complex "
allrgb=rate=25:d=10
,scale='-1:min(ih,1080)'
,pad=1920:1080:(ow-iw)/2:(oh-ih)/2
,setsar=1
,format=yuv420p
[v]
" -map '[v]' -an out.mp4
allyuv=rate=25¶
00:01:26#! /bin/sh
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y -filter_complex "
allyuv=rate=25:d=10
,scale='-1:min(ih,1080)'
,pad=1920:1080:(ow-iw)/2:(oh-ih)/2
,setsar=1
,format=yuv420p
[v]
" -map '[v]' -an out.mp4
color=blue:s=1280x720:rate=25¶
00:01:36#! /bin/sh
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y -filter_complex "
color=blue:s=1280x720:rate=25:d=10
,scale='-1:min(ih,1080)'
,pad=1920:1080:(ow-iw)/2:(oh-ih)/2
,setsar=1
,format=yuv420p
[v]
" -map '[v]' -an out.mp4
- see also
haldclutsrc=rate=25¶
00:01:46#! /bin/sh
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y -filter_complex "
haldclutsrc=rate=25:d=10
,scale='-1:min(ih,1080)'
,pad=1920:1080:(ow-iw)/2:(oh-ih)/2
,setsar=1
,format=yuv420p
[v]
" -map '[v]' -an out.mp4
pal75bars=s=1280x720:rate=25¶
00:01:56#! /bin/sh
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y -filter_complex "
pal75bars=s=1280x720:rate=25:d=10
,scale='-1:min(ih,1080)'
,pad=1920:1080:(ow-iw)/2:(oh-ih)/2
,setsar=1
,format=yuv420p
[v]
" -map '[v]' -an out.mp4
pal100bars=s=1280x720:rate=25¶
00:02:06#! /bin/sh
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y -filter_complex "
pal100bars=s=1280x720:rate=25:d=10
,scale='-1:min(ih,1080)'
,pad=1920:1080:(ow-iw)/2:(oh-ih)/2
,setsar=1
,format=yuv420p
[v]
" -map '[v]' -an out.mp4
rgbtestsrc=s=1280x720:rate=25¶
00:02:16#! /bin/sh
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y -filter_complex "
rgbtestsrc=s=1280x720:rate=25:d=10
,scale='-1:min(ih,1080)'
,pad=1920:1080:(ow-iw)/2:(oh-ih)/2
,setsar=1
,format=yuv420p
[v]
" -map '[v]' -an out.mp4
smptebars=s=1280x720:rate=25¶
00:02:26#! /bin/sh
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y -filter_complex "
smptebars=s=1280x720:rate=25:d=10
,scale='-1:min(ih,1080)'
,pad=1920:1080:(ow-iw)/2:(oh-ih)/2
,setsar=1
,format=yuv420p
[v]
" -map '[v]' -an out.mp4
smptehdbars=s=1280x720:rate=25¶
00:02:36#! /bin/sh
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y -filter_complex "
smptehdbars=s=1280x720:rate=25:d=10
,scale='-1:min(ih,1080)'
,pad=1920:1080:(ow-iw)/2:(oh-ih)/2
,setsar=1
,format=yuv420p
[v]
" -map '[v]' -an out.mp4
testsrc=s=1280x720:rate=25¶
00:02:46#! /bin/sh
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y -filter_complex "
testsrc=s=1280x720:rate=25:d=20
,scale='-1:min(ih,1080)'
,pad=1920:1080:(ow-iw)/2:(oh-ih)/2
,setsar=1
,format=yuv420p
[v]
" -map '[v]' -an out.mp4
testsrc2=s=1280x720:rate=25¶
00:03:06#! /bin/sh
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y -filter_complex "
testsrc2=s=1280x720:rate=25:d=20
,scale='-1:min(ih,1080)'
,pad=1920:1080:(ow-iw)/2:(oh-ih)/2
,setsar=1
,format=yuv420p
[v]
" -map '[v]' -an out.mp4
yuvtestsrc=s=1280x720:rate=25¶
00:03:26#! /bin/sh
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y -filter_complex "
yuvtestsrc=s=1280x720:rate=25:d=10
,scale='-1:min(ih,1080)'
,pad=1920:1080:(ow-iw)/2:(oh-ih)/2
,setsar=1
,format=yuv420p
[v]
" -map '[v]' -an out.mp4
sierpinski=s=1280x720:rate=25¶
available from version 4.3.
#! /bin/sh
#docker run -it --rm -v $(/bin/pwd)://wk -w //wk hhsprings/ffmpeg-yours \
ffmpeg -y -filter_complex "
sierpinski=s=1280x720:type=carpet:rate=25
" -an -t 10 out.mp4
#! /bin/sh
#docker run -it --rm -v $(/bin/pwd)://wk -w //wk hhsprings/ffmpeg-yours \
ffmpeg -y -filter_complex "
sierpinski=s=1280x720:type=triangle:rate=25
" -an -t 10 out.mp4
gradients=s=1280x720:rate=25¶
available from version 4.3 (but “type” option is only available 5.1+).
#! /bin/sh
#docker run -it --rm -v $(/bin/pwd)://wk -w //wk hhsprings/ffmpeg-yours \
ffmpeg -y -filter_complex "
gradients=s=1280x720:type=linear:rate=25
" -an -t 10 out.mp4
#! /bin/sh
#docker run -it --rm -v $(/bin/pwd)://wk -w //wk hhsprings/ffmpeg-yours \
ffmpeg -y -filter_complex "
gradients=s=1280x720:type=radial:rate=25
" -an -t 10 out.mp4
#! /bin/sh
#docker run -it --rm -v $(/bin/pwd)://wk -w //wk hhsprings/ffmpeg-yours \
ffmpeg -y -filter_complex "
gradients=s=1280x720:type=circular:rate=25
" -an -t 10 out.mp4
#! /bin/sh
#docker run -it --rm -v $(/bin/pwd)://wk -w //wk hhsprings/ffmpeg-yours \
ffmpeg -y -filter_complex "
gradients=s=1280x720:type=spiral:rate=25
" -an -t 10 out.mp4
colorspectrum=s=1280x720:rate=25¶
available from version 5.0.
#! /bin/sh
#docker run -it --rm -v $(/bin/pwd)://wk -w //wk hhsprings/ffmpeg-yours \
ffmpeg -y -filter_complex "
colorspectrum=s=1280x720:type=black:rate=25
" -an -t 10 out.mp4
#! /bin/sh
#docker run -it --rm -v $(/bin/pwd)://wk -w //wk hhsprings/ffmpeg-yours \
ffmpeg -y -filter_complex "
colorspectrum=s=1280x720:type=white:rate=25
" -an -t 10 out.mp4
#! /bin/sh
#docker run -it --rm -v $(/bin/pwd)://wk -w //wk hhsprings/ffmpeg-yours \
ffmpeg -y -filter_complex "
colorspectrum=s=1280x720:type=all:rate=25
" -an -t 10 out.mp4
frei0r_src¶
“Frei0r_src” is a video source filter that has been available for a long time.
However, it can be difficult to use, especially for Windows users, as it requires --enable-frei0r
and also frei0r itself (and the setting of the environment variable FREI0R_PATH
). For example, the full build version by www.gyan.dev is --enable-frei0r
, but it does not include frei0r.
In such cases, you may consider using docker. I also created a container called hhsprings/ffmpeg-yours, so you can use it:
#! /bin/sh
i=0
for filter in \
"lissajous0r:filter_params=''" \
"lissajous0r:filter_params='0.0|1.0'" \
"lissajous0r:filter_params='0.1|0.9'" \
"lissajous0r:filter_params='0.2|0.8'" \
"lissajous0r:filter_params='0.3|0.7'" \
"lissajous0r:filter_params='0.4|0.6'" \
"lissajous0r:filter_params='0.5|0.5'" \
"lissajous0r:filter_params='0.6|0.4'" \
"lissajous0r:filter_params='0.7|0.3'" \
"lissajous0r:filter_params='0.8|0.2'" \
"lissajous0r:filter_params='0.9|0.1'" \
"lissajous0r:filter_params='1.0|0.0'" \
"lissajous0r:filter_params='1.0|0.5'" \
"lissajous0r:filter_params='0.5|1.0'" \
"nois0r:filter_params=''" \
"onecol0r:filter_params=''" \
"onecol0r:filter_params='blue'" \
"onecol0r:filter_params='green'" \
"partik0l:filter_params=''" \
"partik0l:filter_params='0.0|1.0'" \
"partik0l:filter_params='0.1|0.9'" \
"partik0l:filter_params='0.2|0.8'" \
"partik0l:filter_params='0.3|0.7'" \
"partik0l:filter_params='0.4|0.6'" \
"partik0l:filter_params='0.5|0.5'" \
"partik0l:filter_params='0.6|0.4'" \
"partik0l:filter_params='0.7|0.3'" \
"partik0l:filter_params='0.8|0.2'" \
"partik0l:filter_params='0.9|0.1'" \
"partik0l:filter_params='1.0|0.0'" \
"plasma:filter_params=''" \
"plasma:filter_params='1.0|1.0|0.0|0.0|0.0|0.0'" \
"plasma:filter_params='0.0|0.0|1.0|1.0|0.0|0.0'" \
"plasma:filter_params='0.0|0.0|0.0|0.0|1.0|1.0'" \
"plasma:filter_params='1.0|1.0|1.0|1.0|1.0|0.0'" \
"plasma:filter_params='1.0|1.0|1.0|0.0|1.0|1.0'" \
"plasma:filter_params='1.0|0.0|1.0|1.0|1.0|1.0'" \
"plasma:filter_params='1.0|1.0|1.0|1.0|0.0|1.0'" \
"plasma:filter_params='1.0|1.0|0.0|1.0|1.0|1.0'" \
"plasma:filter_params='0.0|1.0|1.0|1.0|1.0|1.0'" \
; do
ofn=frei0r-src-exam-$i.mkv
docker run --rm -it -v "$(/bin/pwd)"://wk -w //wk \
hhsprings/ffmpeg-yours \
ffmpeg -y -filter_complex "
frei0r_src=size=1440x810:filter_name=${filter}
" -t 5 ${ofn}
i=`expr $i + 1`
done
#! /bin/sh
i=0
for filter in \
"test_pat_B:filter_params='0'" \
"test_pat_B:filter_params='1'" \
"test_pat_B:filter_params='2'" \
"test_pat_B:filter_params='3'" \
"test_pat_B:filter_params='4'" \
"test_pat_B:filter_params='5'" \
"test_pat_B:filter_params='6'" \
"test_pat_B:filter_params='7'" \
\
"test_pat_C:filter_params='0|0'" \
"test_pat_C:filter_params='0|1'" \
"test_pat_C:filter_params='0|2'" \
"test_pat_C:filter_params='1|0'" \
"test_pat_C:filter_params='1|1'" \
"test_pat_C:filter_params='1|2'" \
"test_pat_C:filter_params='2|0'" \
"test_pat_C:filter_params='2|1'" \
"test_pat_C:filter_params='2|2'" \
"test_pat_C:filter_params='3|0'" \
"test_pat_C:filter_params='3|1'" \
"test_pat_C:filter_params='3|2'" \
\
"test_pat_G:filter_params='0'" \
"test_pat_G:filter_params='1'" \
"test_pat_G:filter_params='2'" \
"test_pat_G:filter_params='3'" \
"test_pat_G:filter_params='4'" \
"test_pat_G:filter_params='5'" \
"test_pat_G:filter_params='6'" \
"test_pat_G:filter_params='7'" \
"test_pat_G:filter_params='8'" \
"test_pat_G:filter_params='9'" \
"test_pat_G:filter_params='10'" \
"test_pat_G:filter_params='11'" \
"test_pat_G:filter_params='12'" \
\
"test_pat_I:filter_params='0'" \
"test_pat_I:filter_params='1'" \
"test_pat_I:filter_params='2'" \
"test_pat_I:filter_params='3'" \
"test_pat_I:filter_params='4'" \
"test_pat_I:filter_params='5'" \
\
"test_pat_L:filter_params='0'" \
"test_pat_L:filter_params='1'" \
"test_pat_L:filter_params='2'" \
"test_pat_L:filter_params='3'" \
"test_pat_L:filter_params='4'" \
"test_pat_L:filter_params='5'" \
"test_pat_L:filter_params='6'" \
\
"test_pat_R:filter_params='0'" \
"test_pat_R:filter_params='1'" \
"test_pat_R:filter_params='2'" \
"test_pat_R:filter_params='3'" \
"test_pat_R:filter_params='4'" \
"test_pat_R:filter_params='5'" \
"test_pat_R:filter_params='6'" \
"test_pat_R:filter_params='7'" \
"test_pat_R:filter_params='8'" \
"test_pat_R:filter_params='9'" \
; do
ofn=frei0r-src-exam-$i.mkv
docker run --rm -it -v "$(/bin/pwd)"://wk -w //wk \
hhsprings/ffmpeg-yours \
ffmpeg -y -filter_complex "
frei0r_src=size=1440x810:filter_name=${filter}
" -t 5 ${ofn}
i=`expr $i + 1`
done
- see also