私は壁にぶつかりました :/... 私はウェブカメラからプレビューを取得してスナップショットを取得しようとしています (私はまだそこまで行っていません...)。不明なライブラリや商用利用が許可されていないライブラリを使用したくない。とにかく今、私はMS Expression Encoderを試していますが、ソースデバイスを追加することはできません.LiveJob.AddDeviceSourceアプリを実行する必要がある場合、f***!@^%#エラーなしで強制終了されます;( ...私のコードがあります:
private void startLivePreview()
{
try
{
// find audio devs
var a_Devices = EncoderDevices.FindDevices(EncoderDeviceType.Audio);
if (a_Devices.Count < 1)
{
throw new Exception("No avaiable audio devices. Sorry but there must be at least one...");
}
EncoderDevice a_Dev = a_Devices[1];
//camLiveSource = camLiveJob.AddDeviceSource(camDevice, null); // I do not need audio so null it...
camLiveSource = camLiveJob.AddDeviceSource(camDevice, a_Dev); // this line kills the app
camLiveSource.PickBestVideoFormat(new Size(640, 480), 15);
camLiveJob.OutputFormat.VideoProfile.Size = new Size(imgPrev.Size.Width, imgPrev.Size.Height);
SourceProperties sp = camLiveSource.SourcePropertiesSnapshot();
lblInfoPrev.Text = sp.Size.Width.ToString() + "x" + sp.Size.Height.ToString() + " @ " + sp.FrameRate.ToString("0.00") + "fps";
camLiveSource.PreviewWindow = new PreviewWindow(new HandleRef(imgPrev, imgPrev.Handle));
camLiveJob.ActivateSource(camLiveSource);
}
catch (Exception ee)
{
MessageBox.Show(ee.Message);
}
}
インターネットで見つけることができるすべての例のように、壮大なことは何もありません...誰でも助けてもらえますか? MS ライブラリは正常に動作すると思いましたが、動作しません (LiveSourceSample でさえ動作せず、同じ行でアプリが強制終了されます)...
商用アプリで使用できるウェブカメラから画像を取得するために何かを使用したい。そして、オーディオはまったく必要ありません(AddDeviceSourceでオーディオデバイスとして「null」を渡すことができれば幸いです:))
これらは、システム上の私の AV デバイスです。
Video devices:
- [0] Name: >Screen Capture Source< *- this must been installed with MS Expression Encoder 4*
- [1] Name: >WebCam SC-03FFL11939N< *- built-in laptop camera*
Audio devices devices:
- [0] Name: >Microphone (Realtek High Definition Audio)<
- [1] Name: >Mix stereo (Realtek High Definition Audio)<
- [2] Name: >Speakers (Realtek High Definition Audio)<