drawtext, drawgraph, blackframe, freezedetect

Watch on youtube.com
doc

https://ffmpeg.org/ffmpeg-filters.html#drawgraph_002c-adrawgraph, https://ffmpeg.org/ffmpeg-filters.html#drawtext, https://ffmpeg.org/ffmpeg-filters.html#blackframe, https://ffmpeg.org/ffmpeg-filters.html#freezedetect

see also

drawtext

Just because “you can do it” I will show you this, but as you can see, this is neither interesting nor valuable. For both “blackframe” and “freezedetect”, it is better for you to use their console output (with ffplay or ffmpeg).

#! /bin/sh
ifn="DriftingWithCars_pf.mp4"
ifnb="`basename \"${ifn}\" .mp4`"
pref="`basename $0 .sh`"
#
../../ffmpeg-20190108-8a1fc95-win64-shared/bin/ffmpeg -y \
-i "${ifn}" -filter_complex "
[0:v]blackframe,freezedetect,
drawtext='fontsize=50:fontcolor=0xAAFFAA:
text=pblack\=%{metadata\:lavfi.blackframe.pblack}':
x=20:y=500,
drawtext='fontsize=50:fontcolor=0xAAFFAA:
text=freeze_start\=%{metadata\:lavfi.freezedetect.freeze_start}':
x=20:y=560,
drawtext='fontsize=50:fontcolor=0xAAFFAA:
text=freeze_end\=%{metadata\:lavfi.freezedetect.freeze_end}':
x=20:y=600,
drawtext='fontsize=50:fontcolor=0xAAFFAA:
text=freeze_duration\=%{metadata\:lavfi.freezedetect.freeze_duration}':
x=20:y=640

,pad=1920:1080:1920-1280:1080-720[v1];

[0:v]blackframe,
drawgraph=mode=bar:
m1=lavfi.blackframe.pblack:min=90:max=100[v2];

[0:v]freezedetect,
drawgraph=mode=bar:
m1=lavfi.freezedetect.freeze_duration:min=0:max=8[v3];

[v1][v2]overlay=x=5:y=5[b];
[b][v3]overlay=x=5:y=256+10[v]
" -map '[v]' -an "${pref}_${ifnb}.mp4"

By the way, the artificial video named “DriftingWithCars_pf.mp4” was created as follows:

#! /bin/sh
fn="Drifting with Cars.mp4"

#
ffmpeg -y -i "${fn}" -ss 00:00:05 -to 00:00:06 -r 1/1 _05.png
ffmpeg -y -i "${fn}" -ss 00:00:10 -to 00:00:11 -r 1/1 _10.png
ffmpeg -y -i "${fn}" -ss 00:00:15 -to 00:00:16 -r 1/1 _15.png
ffmpeg -y -i "${fn}" -ss 00:00:20 -to 00:00:21 -r 1/1 _20.png
ffmpeg -y -i "${fn}" -ss 00:00:25 -to 00:00:26 -r 1/1 _25.png
ffmpeg -y -i "${fn}" -ss 00:00:30 -to 00:00:31 -r 1/1 _30.png
ffmpeg -y -i "${fn}" -ss 00:00:35 -to 00:00:36 -r 1/1 _35.png

#
ffmpeg -y -i "${fn}" \
-i _05.png \
-i _10.png \
-i _15.png \
-i _20.png \
-i _25.png \
-i _30.png \
-i _35.png \
-filter_complex "
[0:v]trim=0:5,setpts=PTS-STARTPTS[0v_1];
[1:v]loop=loop=25*3:size=2
,drawtext='fontsize=40:fontcolor=0x0000FF@0.7
:text=pause -> fade-out':x=920:y=20:shadowcolor=black@0.7:shadowx=1:shadowy=1
,fade=t=out:st=2:d=1[pause1];
[0:v]trim=5:10,setpts=PTS-STARTPTS
,fade=t=in:d=1[0v_2];
[2:v]loop=loop=25*4:size=2
,drawtext='fontsize=40:fontcolor=0x0000FF@0.7
:text=pause -> fade-out':x=920:y=20:shadowcolor=black@0.7:shadowx=1:shadowy=1
,fade=t=out:st=3:d=1[pause2];
[0:v]trim=10:15,setpts=PTS-STARTPTS
,fade=t=in:d=1[0v_3];
[3:v]loop=loop=25*5:size=2
,drawtext='fontsize=40:fontcolor=0x0000FF@0.7
:text=pause -> fade-out':x=920:y=20:shadowcolor=black@0.7:shadowx=1:shadowy=1
,fade=t=out:st=3:d=2[pause3];
[0:v]trim=15:20,setpts=PTS-STARTPTS
,fade=t=in:d=1[0v_4];
[4:v]loop=loop=25*6:size=2
,drawtext='fontsize=40:fontcolor=0x0000FF@0.7
:text=pause -> fade-out':x=920:y=20:shadowcolor=black@0.7:shadowx=1:shadowy=1
,fade=t=out:st=3:d=3[pause4];
[0:v]trim=20:25,setpts=PTS-STARTPTS
,fade=t=in:d=1[0v_5];
[5:v]loop=loop=25*7:size=2
,drawtext='fontsize=40:fontcolor=0x0000FF@0.7
:text=pause -> fade-out':x=920:y=20:shadowcolor=black@0.7:shadowx=1:shadowy=1
,fade=t=out:st=3:d=4[pause5];
[0:v]trim=25:30,setpts=PTS-STARTPTS
,fade=t=in:d=1[0v_6];
[6:v]loop=loop=25*5:size=2
,drawtext='fontsize=40:fontcolor=0x0000FF@0.7
:text=pause -> fade-out':x=920:y=20:shadowcolor=black@0.7:shadowx=1:shadowy=1
,fade=t=out:st=3:d=2[pause6];
[0:v]trim=30:35,setpts=PTS-STARTPTS
,fade=t=in:d=1[0v_7];
[7:v]loop=loop=25*3:size=2
,drawtext='fontsize=40:fontcolor=0x0000FF@0.7
:text=pause -> fade-out':x=920:y=20:shadowcolor=black@0.7:shadowx=1:shadowy=1
,fade=t=out:st=2:d=1[pause7];
[0:v]trim=35,setpts=PTS-STARTPTS
,fade=t=in:d=1[0v_8];

[0v_1][pause1]
[0v_2][pause2]
[0v_3][pause3]
[0v_4][pause4]
[0v_5][pause5]
[0v_6][pause6]
[0v_7][pause7]
[0v_8]
concat=n=15:a=0:v=1[v]
" -map '[v]' -an "DriftingWithCars_pf.mp4"