Hi guys search high and low for an answer but still can't solve my issue. I even asked my teacher for help and he asked me to research harder?! Okay so I am trying to implement a record button into my LibVLC rtsp stream. The recording works but when i try to record it it only records the RTSP stream for 3 seconds and when it does the recording the stream stops completely. How do I make it stream continuously while recording the RTSP stream? The code is below. I'm still learning C# so please give me a chance! Really need you guys help as it is for a assignment! It is also in WPF Visual Studios format
void RecordButton_Click(object sender, RoutedEventArgs e)
{
//string[] AddOptions = { ":sout=#duplicate{dst=display,dst=std{access=file, mux=asf,dst="D:\\My-Output-Video-Filename.asf"}}" };
//VideoView2.MediaPlayer.Stop();
//VideoView2.MediaPlayer.Dispose();
//VideoView2.MediaPlayer = new LibVLCSharp.Shared.MediaPlayer(_libVLC);
//var rtsp1 = new Media(_libVLC, VIDEO_URL, FromType.FromLocation);
// var currentDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly(). Location);
// var destination = Path.Combine(currentDirectory, "record.mp4");
//rtsp1.AddOption(":sout=#file{dst=" + destination + "}");
// rtsp1.AddOption(":sout-keep");
// VideoView2.MediaPlayer.Play(rtsp1);
//var currentDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly(). Location);
//var destination = Path.Combine(currentDirectory, "record.mp4");
rtsp1.AddOption(":screen-fps=24");
rtsp1.AddOption(":sout=#transcode{vcodec=h264,vb=0 ,scale=0,acodec=mp4a,ab=128,channels=2,samplerate= 44100}:file{dst=record1.mp4}");
//rtsp1.AddOption(":sout=#file{dst=" + Destination + "}");
rtsp1.AddOption(":sout-keep");
VideoView2.MediaPlayer.Play(rtsp1); // start recording
//await Task.Delay(5000); // record for 5 seconds
System.Threading.Thread.Sleep(5000);
VideoView2.MediaPlayer.Stop(); // stop recording and saves the file
}
Last edited by xsdys; 06-07-2020 at 04:39 AM.