Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merging two web cameras streaming into a single live streaming - Programmatically

I have two web cameras and I want to merge their streams into a single live streaming preview and display it to the screen.

I am skilled in C#/Java programming, could you please help me to find a framework that helps me to achieve this ?

Thanks,

like image 730
Ahmad Alkhawaja Avatar asked Sep 30 '11 21:09

Ahmad Alkhawaja


2 Answers

If you are aiming only at visualizing the two videos side by side, I would recommend taking a look at DirectShow.Net and GMFBridge toolkit.

Quote from GMFBridge site about the sample project GMFPlay included in the package:

GMFBridge: GMFPlay shows how to view multiple clips as a single movie

If you want to "merge" both streams (as drawing one on top of the other with some transparency level), then you could try this codeproject sample (for visualization only, also using DirectShow).

If you actually want to produce a new video stream and not only visualize, you could again use DirectShow combined with a mixing filter, Medialooks-Video-Mixer for example looks promissing.

like image 113
yms Avatar answered Oct 30 '22 02:10

yms


You can combine two cameras, send the stream to a server (like SRS) and use ffplay to display this in real-time.

 .\ffmpeg.exe -f dshow -i video="LRCP  USB2.0" -i .\right.avi -filter_complex "nullsrc=size=1280x1440 [base];[0:v] setpts=PTS-STARTPTS,scale=1280x720 [upper];[1:v] setpts=PTS-STARTPTS,scale=1280x720 [lower];[base][upper] overlay=shortest=1 [temp1];[temp1][lower] overlay=shortest=1:y=720" -c:v libx264 -preset:v ultrafast -tune:v zerolatency -f flv rtmp://192.168.1.136:1935/live/stream

You can watch the combined video in real-time like in this image example.

Let me know if still not clear.

like image 29
聂颖彬 Avatar answered Oct 30 '22 04:10

聂颖彬