views:

750

answers:

2

So I know there are lot of wrapers 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# programm 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?

+2  A: 

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
and new string[] here is r,g,b string or what?
Blender
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
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?
Blender
@Ole : For image streaming you need to check VLC forum. The VLC experts will definitely help you out in this.
Ram
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?
Blender
@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
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?
Blender
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
Hi Ole,Did you try the suggest approach? Did you find it useful?
Ram
+1  A: 

Hi Ole,

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}}
Ram