Left & right
![Different filter on each side](https://cdn.statically.io/img/i.sstatic.net/SdZuO.png)
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
.
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.
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](https://cdn.statically.io/img/i.sstatic.net/QZPh0.png)
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](https://cdn.statically.io/img/i.sstatic.net/Xzap7.png)
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](https://cdn.statically.io/img/i.sstatic.net/YNXlm.png)
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.
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](https://cdn.statically.io/img/i.sstatic.net/eqdlB.png)
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