0
我試圖建立使用DirectShow.Net庫訪問原始視頻流 - DirectShow中,C#
我已經能夠預覽現場影像面板上本地的視頻會議桌面軟件。 現在我需要這個原始數據饋送來通過網絡。 對不起noob問題,但我不知道如何獲得這個飼料。
到目前爲止的代碼:
public partial class Form1 : Form
{
private LiveJob job;
private LiveDeviceSource livedevicesource;
private bool startedrecording;
List<object> lstVideoDevices = new List<object>(10);
List<object> lstAudioDevices = new List<object>(10);
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
foreach (EncoderDevice edv in EncoderDevices.FindDevices(EncoderDeviceType.Video)) {
lstVideoDevices.Add(edv.Name);
label1.Text=label1.Text+" "+ edv.Name;
}
foreach (EncoderDevice eda in EncoderDevices.FindDevices(EncoderDeviceType.Audio))
{
lstVideoDevices.Add(eda.Name);
label2.Text = label2.Text + " " + eda.Name;
}
}
private void btnStartPreview_Click(object sender, EventArgs e)
{
EncoderDevice video = EncoderDevices.FindDevices(EncoderDeviceType.Video).ElementAt(1);
EncoderDevice audio = EncoderDevices.FindDevices(EncoderDeviceType.Audio).ElementAt(0);
if (video == null)
{
return;
}
job = new LiveJob();
if (video != null && audio != null) {
livedevicesource = job.AddDeviceSource(video, audio);
livedevicesource.PickBestVideoFormat(new Size(640,480), 15);
SourceProperties sourceprop = livedevicesource.SourcePropertiesSnapshot();
pnlVideoUs.Size = new Size(sourceprop.Size.Width, sourceprop.Size.Height);
//This line here sets panel as the preview window
livedevicesource.PreviewWindow = new PreviewWindow(new HandleRef(pnlVideoUs, pnlVideoUs.Handle));
job.ActivateSource(livedevicesource);
}
}
嗨。感謝你的回答。 現在我已經使用PullBroadcastPublishFormat在Windows Forms窗體中廣播和WPF控件(MediaElement)來接收這個廣播。 我會嘗試在這兩個服務器之間放置一個服務器,並在我成功時更新我的答案。 再次感謝羅馬 – lmali92