Solution for VB6 to broadcast Webcam

Sorry, I know VB6 is decades ago, but I'm in a situation that I have to use VB6 to deliver live webcam stream beetween 2 PC in Server - Client Model program. Vb6-code holds the connection then I have no choice but to transfer all data via that connection.

I've tried weeks for this, uncountable approaches but went to nowhere. My efforts focused on 3 major approaches:

1/ Use ffmpeg to record live webcam as ".avi" file on hard disk, transfer parts of file to other end & play it. But I've stucked with a media-player that can play a "being written" avi file.

Windows Media Player control told me "file already in use..." & VLC Plugin can't even be added to VB6 (axvlc.dll).

2/ Use ffmpeg to save live webcam as avi file, transfer each bit of that file to the other end, then in other end, extract 24 images / second from the avi to display continously in a picture box. This approach is ok except that my hard disk get fulled of images in a time of wink and my program get very slow before hanging.

3/ Use ffmpeg to stream the live webcam to a rtp-port like this:

ffmpeg -f dshow -i video="Lenovo EasyCamera" -vcodec mpeg2video -pix_fmt yuv422p -f rtp -an rtp://224.1.2.3:8191

I've successfully watch the stream in VLC, but VLC(axvlc.dll) refused to be integrated into ancient VB6. And more important, I don't know how to redirect/reroute the rtp stream to other PC with VB6.

Any one please light me up? (Any 3rd party component is welcomed)


After some research it seems that Microsoft uses rtsp which is a variation of the rtp protocol. Fortunately ffmpeg supports muxing and demuxing in that format. https://www.ffmpeg.org/ffmpeg-protocols.html#rtsp . You may have to adjust the parameters outlined.
If the server must be a vb6 frontend, you can have ffmpeg launched as the backend from the command line. This is a common method and I found an example of it here: https://www.ehow.com/how_6038708_use-ffmpeg-visual-basic-6.html for reference.

The next stage is the ability to play those streams in visual basic 6. What you can do is add a Windows Media Player control and set its property WindowsMediaPlayer1.URL to {a list with your url added to it as a string}.
One version of control has a id of {6BF52A50-394A-11D3-B153-00C04F79FAA6} and the dll is wmp.dll. Make sure the control has autoStart & invokeURLs set to true.

Some other things worth mentioning is trying to use WMP compliant codecs and contains such as windows media video.

链接地址: http://www.djcxy.com/p/21476.html

上一篇: VSTO:在Outlook规则移动邮件之前使用newmailex处理邮件

下一篇: VB6广播网络摄像头的解决方案