Problem on play dshow devices on C#
Posted: 18 Sep 2024 21:49
Hello everyone!
I apologize for my horrible English.
I've been trying to solve my problem for days, but I can't. My c# app keeps giving an error when I try to play any dshow:// in libVlc. If I manually enter the command in the windows cmd it works, in my app it doesn't want to know.
I don't know what to do anymore.
Help me, thanks
This is the log console:
I apologize for my horrible English.
I've been trying to solve my problem for days, but I can't. My c# app keeps giving an error when I try to play any dshow:// in libVlc. If I manually enter the command in the windows cmd it works, in my app it doesn't want to know.
I don't know what to do anymore.
Help me, thanks
Code: Select all
private void PlayLiveStream(string videoDeviceName, string audioDeviceName, string txt)
{
try
{
Trace.WriteLine("videoDeviceName: " + videoDeviceName);
Trace.WriteLine("audioDeviceName: " + audioDeviceName);
// Crea il media utilizzando dshow://
var media = new Media(_libVLC, "dshow://", FromType.FromLocation);
// Opzioni per dshow
string[] dshowOptions = {
$":dshow-vdev={videoDeviceName}", // Dispositivo video
$":dshow-adev={audioDeviceName}", // Dispositivo audio
":live-caching=300", // Buffering minimo
":dshow-aspect-ratio=16:9", // Imposta l'aspect ratio
":dshow-fps=30" // Imposta il frame rate
};
// Aggiungi tutte le opzioni al media
foreach (string option in dshowOptions)
{
media.AddOption(option);
Trace.WriteLine($"Aggiunto opzione: {option}");
}
// Avvia il flusso all'interno del tuo controllo VLC
_mediaPlayer.Play(media);
Trace.WriteLine("Flusso live avviato correttamente.");
}
catch (Exception ex)
{
MessageBox.Show("Errore durante la riproduzione del flusso live: " + ex.Message);
}
}
Code: Select all
videoDeviceName: vMix Video
audioDeviceName: vMix Audio
Aggiunto opzione: :dshow-vdev=vMix Video
Aggiunto opzione: :dshow-adev=vMix Audio
Aggiunto opzione: :live-caching=300
Aggiunto opzione: :dshow-aspect-ratio=16:9
Aggiunto opzione: :dshow-fps=30
[VLC Log] Debug: main: Creating an input for 'dshow://'
Flusso live avviato correttamente.
[VLC Log] Debug: main: using timeshift granularity of 50 MiB
[VLC Log] Debug: main: using timeshift path: C:\Users\Ilari\AppData\Local\Temp
[VLC Log] Error: main: Your input can't be opened
[VLC Log] Debug: main: `dshow://' gives access `dshow' demux `any' path `'
[VLC Log] Debug: main: looking for access module matching "dshow": 25 candidates
[VLC Log] Debug: main: no access_demux modules matched
[VLC Log] Error: main: VLC is unable to open the MRL 'dshow://'. Check the log for details.
[VLC Log] Debug: main: looking for access_demux module matching "dshow": 11 candidates
[VLC Log] Debug: main: no access modules matched
[VLC Log] Debug: main: creating demux: access='dshow' demux='any' location='' file='(null)'
[VLC Log] Debug: main: creating access: dshow://
Errore VLC durante la riproduzione del flusso