# Using crop, and hstack (or vstack)¶

doc

For example, imagine that you want to show the effect of the ffmpeg filter. At this time, there is a way to show the original image divided horizontally or vertically. It is very easy.

Horizontally

00:00:00
#! /bin/sh
pref="basename $0 .sh" inf="Pexels_flowers.mp4" # 1920x1080 # ffmpeg -y -i "${inf}" -filter_complex "
[0:v]crop='iw/2:ih:0:0'[vo];
[0:v]crop='iw/2:ih:iw/2:0',hue=b=-2[vf];
[vo][vf]hstack[v]
" -map '[v]' -an \
"${pref}.mp4" Vertically 00:00:30 #! /bin/sh pref="basename$0 .sh"
inf="Pexels_flowers.mp4"  # 1920x1080

#
ffmpeg -y -i "${inf}" -filter_complex " [0:v]crop='iw:ih/2:0:0'[vo]; [0:v]crop='iw:ih/2:0:ih/2',swapuv[vf]; [vo][vf]vstack[v] " -map '[v]' -an \ "${pref}.mp4"

with drawbox

00:01:00

Depending on your needs, the boundary of two images may be difficult to distinguish. In such a case, you can use “drawbox”.

#! /bin/sh
pref="basename $0 .sh" inf="Pexels_flowers.mp4" # 1920x1080 # ffmpeg -y -i "${inf}" -filter_complex "
[0:v]crop='iw/2:ih:0:0',drawbox=c=yellow[vo];
[0:v]crop='iw/2:ih:iw/2:0',avgblur=30,drawbox=c=yellow[vf];
[vo][vf]hstack[v]
" -map '[v]' -an \
"\${pref}.mp4"