Store RTSP in file location

I can transfer rtsp to a Windows 7 64-bit machine through a C # Winform application. This is the library I used - VLCDotNet , and here is an example code for playing the RTSP stream:

LocationMedia media = new LocationMedia(@"rtsp://192.168.137.73:554/live.sdp"); vlcControl1.Media = media; vlcControl1.Play(); 

I would like to save streams to a file on my PC by pressing a button and stop it with another button. How do I achieve this?

+4
source share
3 answers

Here is the code:

 Vlc.DotNet.Core.Medias.MediaBase media1 = new Vlc.DotNet.Core.Medias.PathMedia("rtsp://192.168.137.73:554/live.sdp"); media.AddOption(":sout=#transcode{vcodec=theo,vb=800, scale=1,acodec=flac,ab=128,channels=2,samplerate=44100}:std{access=file,mux=ogg, dst=D:\\123.mp4}"); VlcControl control = new VlcControl(); control.Media = media; control.Play(); 
+8
source
 VlcContext.StartupOptions.IgnoreConfig = true; VlcContext.StartupOptions.LogOptions.LogInFile = true; VlcContext.StartupOptions.LogOptions.ShowLoggerConsole = true; VlcContext.StartupOptions.LogOptions.Verbosity = VlcLogVerbosities.Debug; // Disable showing the movie file name as an overlay // VlcContext.StartupOptions.AddOption("--no-video-title-show"); // VlcContext.StartupOptions.AddOption("--no-audio"); VlcContext.StartupOptions.AddOption("--rtsp-tcp"); //this line was important to make this work 
+1
source

As in Vlc.DotNet.Core 2.1.62, the way to do this is to use the optional opts parameter for .Play in the vlc control.

 var opts = new string[] { @":sout=file/ogg:C:\video.ogg" }; vlc.MediaPlayer.Play(new Uri(videoURI), opts); 

`

+1
source

Source: https://habr.com/ru/post/1442090/


All Articles