Upscaling video with different filter on each side

Left & right

Different filter on each side
I cropped the image to make the output size smaller just for display purposes.

This will show the whole video on each side. Left is xbr and right is scale.

Using hstack

ffmpeg -i input.avi -filter_complex \
"[0:v]xbr=4[bg]; \
 [0:v]scale=iw*4:-1:flags=neighbor[fg]; \
 [bg][fg]hstack,format=yuv420p[v]" \
-map "[v]" -map 0:a -movflags +faststart output.mp4

All input streams to hstack must have the same pixel format and same width.

Using pad & overlay

ffmpeg -i input.avi -filter_complex \
"[0:v]xbr=4,pad=iw*2[bg]; \
 [0:v]scale=iw*4:-1:flags=neighbor[fg]; \
 [bg][fg]overlay=w,format=yuv420p[v]" \
-map "[v]" -map 0:a -movflags +faststart output.mp4

This method is slower and more complex than just using hstack.


Left & right: With 10 pixel border

With 10 pixel border

ffmpeg -i input.avi -filter_complex \
"[0:v]xbr=4,pad=iw*2+10[bg]; \
 [0:v]scale=iw*4:-1:flags=neighbor[fg]; \
 [bg][fg]overlay=w+10,format=yuv420p[v]" \
-map "[v]" -map 0:a -movflags +faststart output.mp4

Split screen: left & right

Split screen: left & right

ffmpeg -i input.avi -filter_complex \
"[0:v]xbr=4[bg]; \
 [0:v]scale=iw*4:-1:flags=neighbor,crop=iw/2:ih:ow:0[fg]; \
 [bg][fg]hstack[v]" \
-map "[v]" -map 0:a -movflags +faststart output.mp4

Top & bottom

Top & bottom

Using vstack

ffmpeg -i input.avi -filter_complex \
"[0:v]xbr=4[bg]; \
 [0:v]scale=iw*4:-1:flags=neighbor[fg]; \
 [bg][fg]vstack,format=yuv420p[v]" \
-map "[v]" -map 0:a -movflags +faststart output.mp4

All input streams to vstack must have the same pixel format and same width.

Using pad & overlay

ffmpeg -i input.avi -filter_complex \
"[0:v]xbr=4,pad=iw*2[bg]; \
 [0:v]scale=iw*4:-1:flags=neighbor[fg]; \
 [bg][fg]overlay=0:h,format=yuv420p[v]" \
-map "[v]" -map 0:a -movflags +faststart output.mp4

This method is slower and more complex than just using vstack.


Split screen: top & bottom

Split screen: top & bottom

ffmpeg -i input.avi -filter_complex \
"[0:v]xbr=4[bg]; \
 [0:v]scale=iw*4:-1:flags=neighbor,crop=iw:ih/2:0:oh[fg]; \
 [bg][fg]vstack[v]" \
-map "[v]" -map 0:a -movflags +faststart output.mp4