Left & right
![Different filter on each side](../../I/static/images/562996510796b1d07ac4a78d2bca05f0fe60ebfec3115b566e8521789c001007.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](../../I/static/images/afd1a0510b33428230d0e845826e0e4109a70d79d477a0900ad88394c43223bc.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](../../I/static/images/98d1c2a5c115d9ba3dec65b7ed13dd8c33df0259b8c8008624a7cd04ea8daf2b.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](../../I/static/images/6e94ac40e4ef0e8dc98693799dace906d28c54aca281e4dc3f86d90c9facb69f.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](../../I/static/images/e9eefe5a7238a6e0cfbcd1f28142b2c4af556345b7bd2df353435f9d671a85d4.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
Big thanks! You saved me many hours ;-). Result
– Matěj Pokorný – 2015-05-25T21:42:14.150