Use -stream_loop
to loop and -re
for real-time speed since you’re streaming (or else it will play super fast):
$ ffmpeg -stream_loop -1 -re -i input.mp4 -f v4l2 -pixel_format mjpeg \
-framerate 30 -video_size 1280x720 -i /dev/video0 \
-filter_complex \
"[0:v]scale=1280x720[bg]; \
[1:v]colorkey=0x00b140:0.5:0.0[ckout];
[bg][ckout]overlay,format=yuv420p" \
-f v4l2 /dev/video1
Given that your inputs are YUV consider replacing colorkey (RGB) with chromakey (YUV).
CLICK HERE to find out more related problems solutions.