我正在为Onvif
相机开发WPF应用程序。按照Onvif SDK
我已成功连接相机以获取视频流和控制ptz ...
现在我想使用相机上的本地存储SD card
,但我没有相关信息。
任何人都可以告诉我如何使用Onvif library
连接到SD card
并从中获取录制的数据。
感谢您的帮助。
答案 0 :(得分:0)
从这里开始:http://www.onvif.org/onvif/ver10/recording.wsdl
您需要致电:GetRecordingJobs
找到录音作业。
从这里开始:http://www.onvif.org/ver10/replay.wsdl
您需要致电:GetReplayUri
答案 1 :(得分:0)
我不确定这是否适合您的需要,但我认为它可能会对您有所帮助。此代码可用于连接到Onvif IP摄像机并将流记录为MPEG4格式。通过使用此代码,录制文件将自动存储在计算机上。
namespace Basic_CameraViewer
{
public partial class MainWindow : Window
{
private VideoViewerWPF _videoViewerWpf;
private BitmapSourceProvider _provider;
private IIPCamera _ipCamera;
private WebCamera _webCamera;
private MediaConnector _connector;
private MPEG4Recorder _recorder;
private IVideoSender _videoSender;
public MainWindow()
{
InitializeComponent();
_connector = new MediaConnector();
_provider = new BitmapSourceProvider();
SetVideoViewer();
}
private void SetVideoViewer()
{
_videoViewerWpf = new VideoViewerWPF
{
HorizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment = VerticalAlignment.Stretch,
Background = Brushes.Black
};
CameraBox.Children.Add(_videoViewerWpf);
_videoViewerWpf.SetImageProvider(_provider);
}
private void ConnectIPCamera_Click(object sender, RoutedEventArgs e)
{
var host = HostTextBox.Text;
var user = UserTextBox.Text;
var pass = Password.Password;
_ipCamera = IPCameraFactory.GetCamera(host, user, pass);
if (_ipCamera == null) return;
_connector.Connect(_ipCamera.VideoChannel, _provider);
_videoSender = _ipCamera.VideoChannel;
_ipCamera.Start();
_videoViewerWpf.Start();
}
private void DisconnectIPCamera_Click(object sender, RoutedEventArgs e)
{
_videoViewerWpf.Stop();
_ipCamera.Disconnect();
_ipCamera.Dispose();
_connector.Disconnect(_ipCamera.VideoChannel, _provider);
}
private void StartCapture_Click(object sender, RoutedEventArgs e)
{
if (_videoSender == null) return;
var date = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + "-" +
DateTime.Now.Hour + "-" + DateTime.Now.Minute + "-" + DateTime.Now.Second;
var currentpath = AppDomain.CurrentDomain.BaseDirectory + date + ".mpeg4";
_recorder = new MPEG4Recorder(currentpath);
_recorder.MultiplexFinished += _recorder_MultiplexFinished;
_connector.Connect(_videoSender, _recorder.VideoRecorder);
}
void _recorder_MultiplexFinished(object sender, Ozeki.VoIP.VoIPEventArgs<bool> e)
{
_recorder.MultiplexFinished -= _recorder_MultiplexFinished;
_recorder.Dispose();
}
private void StopCapture_Click(object sender, RoutedEventArgs e)
{
if (_videoSender == null) return;
_connector.Disconnect(_videoSender, _recorder.VideoRecorder);
_recorder.Multiplex();
}
}
}
Here you can find a video explanation on how to implement video recording.
答案 2 :(得分:0)
您应该能够使用http://www.onvif.org/onvif/ver10/recording.wsdl和ExportRecordedData()方法将视频从SD卡复制到网络存储中。