histogram¶
Watch on youtube.comdisplay_mode=stack¶
Especially in recent years, almost all of the videos that you deal with should be of YUV format. Therefore, if you want to see the distribution of RGB, you need to convert with “format” filter.
00:00:00#! /bin/sh
ifn="Drifting with Cars.mp4"
ifnb="`basename \"${ifn}\" .mp4`"
pref="`basename $0 .sh`"
#
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y \
-i "${ifn}" -filter_complex "
[0:v]split=2[v0][v1];
[v0]format=rgb24,histogram=display_mode=stack,scale=1280:720,setsar=1,format=yuv420p[v2];
[v1]scale=1280/6:720/6,setsar=1[v3];
[v2][v3]overlay=x=50:y=H-h-50[v]
" -map '[v]' -an "${pref}_${ifnb}.mp4"
Therefore, the “histogram” filter visualizes the distribution of Y, U, V (, A) (depending on input format, of course).
00:00:38#! /bin/sh
ifn="Drifting with Cars.mp4"
ifnb="`basename \"${ifn}\" .mp4`"
pref="`basename $0 .sh`"
#
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y \
-i "${ifn}" -filter_complex "
[0:v]split=2[v0][v1];
[v0]histogram=display_mode=stack,scale=1280:720,setsar=1[v2];
[v1]scale=1280/6:720/6,setsar=1[v3];
[v2][v3]overlay=x=50:y=H-h-50[v]
" -map '[v]' -an "${pref}_${ifnb}.mp4"
display_mode=parade¶
00:01:16#! /bin/sh
ifn="Drifting with Cars.mp4"
ifnb="`basename \"${ifn}\" .mp4`"
pref="`basename $0 .sh`"
#
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y \
-i "${ifn}" -filter_complex "
[0:v]split=2[v0][v1];
[v0]histogram=display_mode=parade,scale=1280:720,setsar=1[v2];
[v1]scale=1280/6:720/6,setsar=1[v3];
[v2][v3]overlay=x=W-w-250:y=50[v]
" -map '[v]' -an "${pref}_${ifnb}.mp4"
display_mode=overlay¶
00:01:56#! /bin/sh
ifn="Drifting with Cars.mp4"
ifnb="`basename \"${ifn}\" .mp4`"
pref="`basename $0 .sh`"
#
"/c/Program Files/ffmpeg-4.1-win64-shared/bin/ffmpeg" -y \
-i "${ifn}" -filter_complex "
[0:v]split=2[v0][v1];
[v0]histogram=display_mode=overlay,scale=1280:720,setsar=1[v2];
[v1]scale=1280/6:720/6,setsar=1[v3];
[v2][v3]overlay=x=W-w-50:y=50[v]
" -map '[v]' -an "${pref}_${ifnb}.mp4"