4

So I know there are lot of wrappers of libVLC.dll . But I just do not know what one is ready to do what I need...

What I need is simple...

  • in my C# program I create some bitmap (once or twice per second)...
  • I now want to stream bitmaps live as video (in some format VLC can to offer me) to some http:localhost:port/ using VLC...

How to do that?

sehe
  • 374,641
  • 47
  • 450
  • 633
Rella
  • 65,003
  • 109
  • 363
  • 636

2 Answers2

7

You need to use following code to stream a image.

cd "C:\program files\videolan\vlc" 
vlc -I dummy fake:// --fake-file c:\1.jpg -vvv --sout #transcode{vcodec=mp4v,vb=1024,scale=1}:duplicate{dst=std{access=udp,mux=ts,dst=localhost:1234}}
sehe
  • 374,641
  • 47
  • 450
  • 633
Ram
  • 11,404
  • 15
  • 62
  • 93
  • 1
    Hello! I try your example on my Windows 10 PC and VLC 3.0.3 and I have an error... May be dummy or fake does not support in this version of VLC? – JDo Sep 07 '18 at 11:22
3

You can use the NativeLibVlc.cs file available at VLC site.

To stream the bitmap file use following code

   vlc.AddTarget("fake://", new string[] {":no-overlay", ":input-repeat=-1", 
                        ":vout-filter=adjust", ":fake-file=" + fileName.Trim(), ":fake-fps=1",
                        ":brightness="+50, ":fake-caching=100"} , ref playListId);

 vlc.Play(playListId);

To stream webcam over UPD on port 1234 use following code

cd "C:\program files\videolan\vlc"
vlc.exe -vvv --dshow-vdev="Logitech QuickCam Express / Go" dshow:// --sout #transcode{vcodec=mp4v,vb=1024,scale=1}:duplicate{dst=std{access=udp,mux=ts,dst=localhost:1234}}

To stream a video on port 1234 use following code

cd "C:\program files\videolan\vlc" 
vlc.exe -vvv C:\filename.wmv --repeat --sout=#transcode{vcodec=mp4v,vb=1024,scale=1}:duplicate{dst=std{access=udp,mux=ts,dst=localhost:1234}}

To stream a image on localhost port 1234 use following code

cd "C:\program files\videolan\vlc" 
vlc -I dummy fake:// --fake-file c:\1.jpg -vvv --sout #transcode{vcodec=mp4v,vb=1024,scale=1}:duplicate{dst=std{access=udp,mux=ts,dst=localhost:1234}}
Ram
  • 11,404
  • 15
  • 62
  • 93
  • and new string[] here is r,g,b string or what? – Rella May 06 '10 at 08:34
  • Its parameters(options) to VLC player to play the image. fake:// specifies that the image is going to be played instead of a video/ audio file. – Ram May 06 '10 at 08:54
  • And will I be able to vach this images stream as video useing VLC for example? If yes - how ? To what url I should go using normal VLC player to play this stream? – Rella May 06 '10 at 08:58
  • @Ole : For image streaming you need to check VLC forum. The VLC experts will definitely help you out in this. – Ram May 06 '10 at 09:42
  • So... Where do I put my RGB values? or I always shousd save data to file before playing? And in my Q I asked about live streaming to some local port, could you please add sample code about this to your answer? – Rella May 06 '10 at 12:32
  • @Ole : I would suggest you should save the file before playing. You need to check options to set RGB. I have added code of batch file to stream the video /Image. – Ram May 06 '10 at 14:10
  • Grate!) all 3 parts... But the Q was "I now want to stream bitmaps live as video (in some format VLC can to offer me) to some http:localhost:port/ using VLC..." so Is there a way to do SUCH thing using suggested by you NativeLibVlc? Is it any how possible to integrate thouse commands into it? – Rella May 06 '10 at 15:27
  • Well check for the last one. It will stream a image on localhost port 1234. You can create batch file to play this or need to call VLC with the provided parameters. – Ram May 07 '10 at 05:13