顯示具有 ONVIF 標籤的文章。 顯示所有文章
顯示具有 ONVIF 標籤的文章。 顯示所有文章

2016年9月13日 星期二

ONVIF -- Profile C and Profile A

最近 ONVIF發布了 Profile A,看來與 Profile C 是很類似的東西,以Profile C為例,定義了兩種角色,Camera或 NVR 可以扮演 ONVIF Client 的角色來控制門禁系統。

  • ONVIF Device,需支援兩項功能。 
  • provide information regarding the PACS related entities included in the system as well as the status of these entities, including standardized PACS related events. 
  • provides basic door control 
  • ONVIF Client,需支援三項功能。 
  • get information regarding the PACS related entities. 
  • do basic door control. 
  • retrieve and receive standardized PACS related events.

    下面將針對這兩種Profile作一比較。

    Prfoile A 與 Profile C 的相同部分

    1. 若一個設備屬於 Physical Access Control System (PACS) 的一部分,便可宣稱支援 ONVIF Profile C 或 Profile A
    要宣稱支援 ONVIF Profile C,要回應下列 scope
     • onvif://www.onvif.org/Profile/C 
    要宣稱支援 ONVIF Profile A,要回應下列 scope
     • onvif://www.onvif.org/Profile/A

    2. 若要支援 Profile C/A,需遵守下列規定
    • 需遵循 ONVIF Core Specification v2.3 或是更新的規範。
    • 需支援 HTTP digest authentication
    • 需支援 pull points 的方式取得 Event, 並且最少要有兩個 pull points
    • 需支援 GetWsdlUrl

    Prfoile A 與 Profile C 的不同

    1. 應用領域不同
    Profile C 官方定義  
    Device
    provide information regarding the PACS related entities included in the system as well as the status of these entities, including standardized PACS related events. This device also provides basic door control
    Client
    get information regarding the PACS related entities and do basic door control.
    It can also retrieve and receive standardized PACS related events.
    Profile A 官方定義 
    Device
    provide functionality to retrieve information, status and
    events and to configure the PACS related entities such as access rules, credentials and schedules. 
    Client
    provide configurations of access rules,credentials and schedules.
    The client can also retrieve and receive standardized PACS related events.
    2. ProfileA 涵蓋了以下規範
    • ONVIF Network Interface Specification
    • Access Rules Service Specification
    • Credential Service Specification
    • Schedule Service Specification
    個人認知:若只要簡單控制門禁,只要實作Profile C,若需要較複雜的控制邏輯,則需要同時實作Profile C 與 Profile A。

    參考資料:
    1. 2013_12_ONVIF_Profile_C_Specification_v1-0.pdf
    2. ONVIF_Profile_A_Spec_RCv1-1.pdf

    2016年9月12日 星期一

    ONVIF -- media2 簡介

    2016/06 ONVIF 發布 Media2 規格書,我將值得注意的地方作一整理,如下:

    1. VideoEncoderConfiguration 內的 Encoding 已可支援 H265
    原本作法(MEDIA) 直接定義 enum { 'JPEG', 'MPEG4', 'H264' }
    新作法(MEDIA2) 改為採用 IANA 定義的字串,例如: "video/H265",如此支援的媒體類型就更廣了。詳細列表可參考 http://www.iana.org/assignments/media-types/media-types.xhtml
       
    2. GetProfile 修改
    原本作法會回 VideoAnalyticsConfiguration
    新作法只會回 Analytics(只有Token,Name, 沒有 Configuration

    3. Set synchronization point
    可強制 Camera 作出三種行為
    a. 立刻送出 iFrame,
    b. 提供使用者訂閱Event的目前狀態。
    c. 提供 PTZ status

    4. VideoRateControl2 新增 ConstantBitRate
    原本的 RateControl 支援下列三項設定
    • FrameRateLimit
    • EncodingInterval
    • BitrateLimit
    現在新增 ConstantBitRate,如此便能夠與 Camera內部設定有一致的對應關係。

    5. MetadataConfiguration 支援 CompressionType.
    為了節省空間,Camera 回傳的 Metadata 除了原本的 XML 格式,還可使用
    • GZIP 或
    • EXI(Efficient XML Interchange Format)       

    6. 新增 SetVideoSourceMode 與 GetVideoSourceModes
    可用來切換 NTSC/PAL ,或是切換 FOV(4:3/16:9) 。
       
    7. 新增 GetVideoEncoderInstances
    可得知每個 VideoSource 最多可同時支援幾條 live stream.

    8. VideoSourceConfigurationExtension2 支援 LensDescription
    使用者可利用此資訊修正鏡頭失真問題(lens distortion)

    參考資料:

    1. http://www.onvif.org/specs/srv/media/ONVIF-Media2-Service-Spec-v1606.pdf    

    2013年9月11日 星期三

    ONVIF -- Support Customized Event

    If you want to support a customized event which not belong to ONVIF spec.
    You can follow below setup to re-generate your gSoap code by gSOAP.

    1. Revise WS-typemap.dat to add customized namespace
    tnsMy = <http://www.avigilon.com/onvif/ver10/topics>

    2013年8月21日 星期三

    ONVIF -- 各種平台上可使用的測試工具

    工作上常常需要使用不同的 ONVIF 軟體來測試 IPCAM 對於 ONVIF 的支援能力,其中最常用的ONVIF測試工具,主要是 Windows 作業系統的兩個軟體,如下:
    • ONVIF Test Tool
    • ONVIF Device Manager

    鑑於不同的作業系統可能會提供不同的 ONVIF 測試軟體,以下特別對此作一整理。

    2013年8月7日 星期三

    ONVIF -- 如何產生正確的 TopicSet

    針對 ONVIF 13.06 test tool 的測試案例 ACCESSCONTROL-12-1-1,進行測試時,
    在 Step 4 Validate topics XML representation. 會發生錯誤。

    問題是 Test tool 認為 GetEventPropertiesResponse 的 xml 不合法,
    錯誤訊息為 "tns1:Configuration/tns1:VideoEncoderConfiguration must be respresennted by a non-qualified element"

    查詢event.wsdl內的GetEventPropertiesResponse,可得知問題與 TopicSet 的設定有關,
    以下便針對 GetEventPropertiesResponse 內如何產生 TopicSet 作一討論

    2013年6月29日 星期六

    ONVIF -- Event by RTSP Stream 實作探討

    ONVIF 針對 Event 的傳送定義了三種方式,Basic Notification Interface,Real-time Pull-Point Notification Interface與 RTSP metadata stream 的方式。

    由於實作 ONVIF 與 RTSP 的開發人員可能並不相同,因此在實作RTSP metadata stream時溝通可能會有誤解。以下對這種情況提出一種簡單的合作開發方式。

    ONVIF:
    當使用者想要建立一個 RTSP Stream 時,會先透過 GetStreamUri 詢問對應的 RTSP URI。
    如果 GetStreamUri 的 Profile 內有定義 MetadataConfiguration,便表示後續使用者使用此 URI 建立 RTSP 時,RTSP 所回應的 SDP 內需要加入 metadata 的描述。 
    可以使用 IPC 的方式來通知 RTSP 加入 metadata。此處假設使用 shared memory,設定 gIsMetadata = TRUE。

    2013年6月12日 星期三

    ONVIF -- Event Topics

    I make a list of all event topics defined in ONVIF spec (version 2.3).

    I don't remove the duplicate topic name,  so that we can know different usage for the specific topic name.


    ONVIF-AccessControl-Service-Spec-v100.pdf
    • tns1:AccessControl/AccessGranted/
    • tns1:AccessControl/AccessTaken/
    • tns1:AccessControl/AccessNotTaken/
    • tns1:AccessControl/Denied/
    • tns1:AccessControl/Duress
    • tns1:AccessControl/Request/
    • tns1:AccessPoint/State/
    • tns1:Configuration/AccessPoint
    • tns1:Configuration/Area

    2013年5月28日 星期二

    ONVIF -- Multicast 問題分析經驗談

    在進行 ONVIF Device Test Tool v12.12 的測試過程中,當測試 ONVIF 的 startMulticast 命令時,送出 Audio 時總是無法通過測試工具的檢驗,後來釐清是因為 profile s中規定 audio需要設定為 PCM-ulaw 的關係,但因此也學習了許多與 multicast 有關的知識。

    以下將以 startMulticast 為例,整理幾個分析 multicast 的小技巧。

    預備知識

    StartMulticast 命令所做的事情,就是根據某個已經設定好的 profile,啟動 multicast streaming,可能同時包含 video 與 audio。原文摘錄如下:
    This command starts multicast streaming using a specified media profile of an NVT. Streaming continues until StopMulticastStreaming is called for the same Profile. The streaming shall continue after a reboot of the NVT until a StopMulticastStreaming request is received. The multicast address, port and TTL are configured in the VideoEncoderConfiguration, AudioEncoderConfiguration and MetadataConfiguration respectively. An NVT that supports video, audio or metadata multicast streaming shall support the starting of a multicast stream through the StartMulticastStreaming command. 

    2013年5月21日 星期二

    MTOM (Message Transmission Optimization Mechanism)


    當我們要在 xml 中傳送一組binary資料時,一般的作法是將此資料先使用Base64編碼,再送出,如此會使得此資料大小增加為原本的 4/3 倍。

    為此,W3C定義了MTOM方法,當傳送大量的資料時,可以減少所需的資料傳輸量。
    MTOM 的原理是使用 XOP (XML-binary Optimized Packaging) 來封裝 binary 資料,目前 XOP 只定義使用一種封裝方法,就是 MIME Multipart/Related。

    以下將介紹一個 MTOM 的例子,並介紹如何利用 gSOAP 取得 MTOM 資料

    2013年5月15日 星期三

    ONVIF -- Update System Firmware


    1. ONVIF 設計了兩個命令,可用來更新系統韌體,分別是 UpgradeSystemFirmware 與 StartFirmwareUpgrade。
    a. UpgradeSystemFirmware
    其作法是使用 HTTP Post 送出一個 UpgradeSystemFirmware Request,直接將 Firmware 以 MTOM 的編碼方式放在此 http 封包中,傳送給 IPCAM,進行韌體更新。MTOM簡介可參考這裡。

    2013年5月14日 星期二

    JPEG over RTP when resolution larger then 2040*2040


    參考 rfc2435,當使用 RTP 傳送封包時,此處定義的長寬最大值為2040。那麼當超過 2040 時,應該如何實作呢?? 以下提供幾種作法當作參考。


    一、參考 rfc5371,使用 JPEG2000 的作法
    作法是在 SDP 內加以描述,範例如下:
    m=video 49170/2 RTP/AVP 98
    a=rtpmap:98 jpeg2000/90000
    a=fmtp:98 sampling=YCbCr-4:2:0;width=128;height=128

    2013年5月13日 星期一

    ONVIF -- soap-env 的 namespace 問題


    問題描述
    在進行 NVR 互測時,發現彼此雙方對於 SOAP-ENV 的 namespace 認知不同。
    NVR針對 SOAP-ENV 只能看懂 "http://schemas.xmlsoap.org/soap/envelope/" (以下簡稱 A),卻不允許 "http://www.w3.org/2003/05/soap-envelope" (以下簡稱 B)

    根據 OVNIF 官方 spec 演進,看來是新舊版本的關係
    • (2011/02) Reference_of_ONVIF_Development_v1 01 02.pdf 使用 A 
    • (2011/06) ONVIF-Core-Spec-v210.pdf 使用 B 
    • (2012/01) ONVIF-Core-Specification-v211.pdf 使用 B 
    • (2012/12) ONVIF-Core-Specification-v221.pdf 使用 B

    2013年4月10日 星期三

    ONVIF -- Motion Detection



    ONVIF 規範支援 Motion Detection,並且在兩個規範書內分別加以定義。

    • ONVIF-Imaging-Service-Spec-v221.pdf
    • "tns1:VideoSource/tns1:MotionAlarm"
    • ONVIF-VideoAnalytics-Service-Spec-v221.pdf
    • "tns1:VideoAnalytics/tns1:MotionDetection"

    2013年2月27日 星期三

    ONVIF -- Profiles (S,G,C,Q,A)


    截至目前為止 (20160830),ONVIF針對不同功能共定義了5種 Profile
    • Profile S for encompasses video streaming
    • Profile G for video storage.
    • Profile C for access control. 
    • Profile Q for Out-of-the-box interoperability. 
    • Profile A for Physical Access Control System (PACS).

    2013年1月21日 星期一

    ONVIF -- 重現錯誤的方式

    在 client 與 server 的互通測試過程中,有時候客戶僅會使用我們所提供的client進行測試,但是卻不會想要讓我們擁有他們的server以自行進行測試。如此一旦遇到問題時,便只能夠靠 wireshark 封包來分析猜測可能原因。Debug工作將會變得非常不方便。

    下面介紹的便是如何藉著 wireshark 封包的內容,讓問題重現。

    2013年1月15日 星期二

    ONVIF -- audio channel

    許多 IPCAM 都支援了將聲音由 NVR 傳至IPCAM 的功能,ONVIF 組織針對此功能定義了一套標準作法,稱為 audio backchannel,首先會利用 AudioOutputConfiguration 內的 Send-Primacy 設定 audio in/out 方向,接著再使用 RTSP ,利用其擴充功能 "Require" 來傳送接收 audio stream。


    根據 ONVIF 規範,我們將其分成兩部分來討論

    2012年12月28日 星期五

    使用 gSoap 2.8.12 產生 ONVIF 程式碼


    20121229 更新

    1. gSOAP 最新版本為 2.8.12, 此版本在 FAQ 中註明了 ONVIF 程式產生時的 define namespace prefix and type bindings,如此在開發程式時可有一個統一的命名規則。如下:

    tds = "http://www.onvif.org/ver10/device/wsdl" tev = "http://www.onvif.org/ver10/events/wsdl" tls = "http://www.onvif.org/ver10/display/wsdl" tmd = "http://www.onvif.org/ver10/deviceIO/wsdl" timg = "http://www.onvif.org/ver20/imaging/wsdl" trt = "http://www.onvif.org/ver10/media/wsdl" tptz = "http://www.onvif.org/ver20/ptz/wsdl" trv = "http://www.onvif.org/ver10/receiver/wsdl" trc = "http://www.onvif.org/ver10/recording/wsdl" tse = "http://www.onvif.org/ver10/search/wsdl" trp = "http://www.onvif.org/ver10/replay/wsdl" tan = "http://www.onvif.org/ver20/analytics/wsdl" tad = "http://www.onvif.org/ver10/analyticsdevice/wsdl" tdn = "http://www.onvif.org/ver10/network/wsdl" tt = "http://www.onvif.org/ver10/schema"

    2012年11月6日 星期二

    ONVIF -- SIEMENS Vectis HX add a new device


    SIEMENS Vectis HX  add a new device (使用 ONVIF 規範)

    |Time     | 192.168.0.28                          |
    |         |                   | 192.168.0.10      |                
    |43.599738000|         POST /onvif/device_           |HTTP/XML: POST /onvif/device_service HTTP/1.1

    2012年9月12日 星期三

    The difference between ONVIF Test Tool 11.12 and 12.06

    在通過 ONVIF Test Tool 11.12 之後,便想試試看 ONVIF Test Tool 12.06,此時發現測試工具一開始定義 ipcam 的 features 便已經不正確了,無法進行正確的測試。茲將測試時,自己發現的差異處整理如下:

    1. 由於初始的 features define 有誤,因此後續的測試範例預期結果會與 11.12 將會不同。
    例如:DEVICE-1-1-17,若測試工具所偵測的 features 包含 imaging,則此測試範例預期要成功,否則預期此範例要失敗。