5

我能够通过 C# Winform 应用程序在 Windows 7 64 位机器上流式传输 rtsp。这是我使用的库 - VLCDotNet,这是播放 RTSP 流的代码示例:

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

我想通过单击按钮将流存储到我的 PC 中的文件中,然后用另一个按钮停止相同的操作。我如何实现这一目标?

4

3 回答 3

7

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();
于 2012-10-25T18:50:28.077 回答
1
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
于 2015-01-07T19:02:16.223 回答
1

从 Vlc.DotNet.Core 2.1.62 开始,执行此操作的方法是使用vlc 控件上的额外opts参数。.Play

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

`

于 2015-12-24T14:11:27.483 回答