Technical Guide | SRG HTTP Streaming Remote Camera December17, 2014 RCTG004 Version 1.0.0 HTTP Streaming Technical Guide | SRG CONTENTS 1. Overview ............................................................................................. 3 1.1. About This Document ............................................................................. 3 2. HTTP Streaming Commands ............................................................ 3 2.1. Types of Request Command .................................................................. 3 2.2. Get Video Streaming .............................................................................. 4 2.3. Get Audio Streaming............................................................................. 10 2.4. Get Still Image ...................................................................................... 16 2.5. Server Error .......................................................................................... 17 3. User Data of H.264 and JPEG ......................................................... 18 3.1. User Data in H.264 ............................................................................... 18 3.2. User Data in JPEG ............................................................................... 20 Revision History..................................................................................... 22 Sony Remote Camera 2 Version 1.0.0 HTTP Streaming Technical Guide | SRG 1. Overview 1.1. About This Document This document defines the specification about HTTP Streaming of Sony SRG-300SE/301SE remote camera (this is called “camera” as described below). 2. HTTP Streaming Commands 2.1. Types of Request Command The following table shows the request commands to get video, audio and still image from camera. Table 2-1 /image1 Command Ver. 1.0 /image2 1.0 /image3 1.0 /audio 1.0 /audio-out/aac48_128.cgi /audio-out/aac16_64.cgi 1.0 /oneshotimage.jpg /oneshotimage1 1.0 /oneshotimage2 1.0 /oneshotimage3 1.0 1 Types of Request Command 1 Description This command allows getting video bit stream from according to the value of ImageCodec1. This command allows getting video bit stream from according to the value of ImageCodec2. This command allows getting video bit stream from according to the value of ImageCodec3. This command allows getting audio bit stream from according to the value of AudInCodec. These commands allow uploading audio data to a a camera a camera a camera a camera camera. These commands allow getting JPEG still image from a camera. The image size and quality setting is the same as ImageCodec1. This command allows getting JPEG still image from a camera. The image size and quality setting is the same as ImageCodec2. This command allows getting JPEG still image from a camera. The image size and quality setting is the same as ImageCodec3. To change the HTTP port, use /command/network.cgi?HttpPort=*. Sony Remote Camera 3 Version 1.0.0 HTTP Streaming Technical Guide | SRG 2.2. Get Video Streaming 2.2.1. TCP Bit Stream (Video) <Method> GET <Syntax> http://<camera_address>/image1 http://<camera_address>/image2 http://<camera_address>/image3 <Example 1> The following figure and list show an example to get the HTTP bit stream of H.264 data. “Content-Type:” header is “video/h264” when the image codec is H.264. Client Camera GET /image1 HTTP/1.1 HTTP/1.1 200 OK <H.264 data> Figure 2-1 Sony Remote Camera Sequence of Get Video Streaming (TCP bit stream) 4 Version 1.0.0 HTTP Streaming Technical Guide | SRG GET /image1 HTTP/1.1\r\n Host: <camera_address>\r\n Connection: Close\r\n \r\n HTTP/1.1 200 OK\r\n Content-Type: video/h264\r\n Cache-Control: no-cache\r\n Pragma: no-cache\r\n \r\n <H.264 data> <Example 2> The following list shows an example to get the HTTP bit stream of motion JPEG data. The motion JPEG bit stream is retrieved by the first GET command operation and will be sent as the sequential data. Therefore, an application should display the sequential data with dividing the data into a unit of JPEG image. In this case, boundary character string “----myboundary” is fixed as an index. GET /image1 HTTP/1.1\r\n Host: <camera_address>\r\n Connection: Close\r\n \r\n HTTP/1.1 200 OK\r\n Content-Type: multipart/x-mixed-replace;boundary=--myboundary\r\n Pragma: no-cache\r\n Cache-control: no-cache\r\n \r\n ----myboundary\r\n Content-Type: image/jpeg\r\n \r\n <JPEG data>\r\n ----myboundary\r\n Content-Type: image/jpeg\r\n \r\n <JPEG data>\r\n ----myboundary\r\n Content-Type: image/jpeg\r\n \r\n <JPEG data>\r\n Sony Remote Camera 5 Version 1.0.0 HTTP Streaming Technical Guide | SRG 2.2.2. UDP (RTP/RTCP) Unicast Bit Stream (Video) <Method> GET <Syntax> http://<camera_address>/image1?UdpMode=unicast&UdpPort=<UDP port number> http://<camera_address>/image2?UdpMode=unicast&UdpPort=<UDP port number> http://<camera_address>/image3?UdpMode=unicast&UdpPort=<UDP port number> <Remarks> It is required for a client application to send RTCP receiver report to camera periodically to keep streaming. To stop the streaming, send RTCP BYE packet to camera. Note that the camera stops sending the bit stream if it fails to receive RTCP receiver report from the client side for consecutive time specified by RtpExpire parameter. <Example> The following figure shows an example to get the UDP (RTP/RTCP) unicast bit stream. In this case, RTP and RTCP packets are sent from <UcVideoPort1> 2 and <UcVideoPort1+1> to <UdpPort> and <UdpPort+1> respectively. 2 If there are multiple clients, the camera also uses the available higher even port number as sender port. Sony Remote Camera 6 Version 1.0.0 HTTP Streaming Technical Guide | SRG Client Camera GET /image1?UdpMode=unicast&UdpPort=<UdpPort> HTTP/1.1 HTTP/1.1 204 No Content <UdpPort> RTP payload <UcVideoPort1> <UdpPort+1> SR: Sender Report RTCP Packet <UcVideoPort1+1> <UdpPort+1> RR: Receiver Report RTCP Packet <UcVideoPort1+1> <UdpPort> RTP payload <UcVideoPort1> <UdpPort+1> BYE: Goodbye RTCP Packet <UcVideoPort1+1> Figure 2-2 Sony Remote Camera Sequence of Get Video Streaming (UDP unicast) 7 Version 1.0.0 HTTP Streaming Technical Guide | SRG 2.2.3. UDP (RTP/RTCP) Multicast Bit Stream 3 (Video) <Method> GET <Syntax> http://<camera_address>/image1?UdpMode=multicast http://<camera_address>/image2?UdpMode=multicast http://<camera_address>/image3?UdpMode=multicast <Remarks> It is required for a client application to send RTCP receiver report to camera periodically to keep streaming. The camera stops streaming when all the BYE packets from requested clients were received. Note that the camera stops sending the bit stream if it fails to receive RTCP receiver report from the client side for consecutive time specified by RtpExpire parameter. In addition, it is allowed to change the Time-to-live value for multicast packets by using McTtl parameter. <Example> The following figure shows an example to get the UDP (RTP/RTCP) multicast bit stream. In this case, RTP and RTCP packets are sent to <McVideoPort1> and <McVideoPort1+1> of <McAddress1> respectively. 3 To enable the multicast streaming, send /command/camera.cgi?Multicast=on to the camera. Sony Remote Camera 8 Version 1.0.0 HTTP Streaming Technical Guide | SRG Client Camera GET /image1?UdpMode=multicast HTTP/1.1 HTTP/1.1 204 No Content IGMP Join IGMP Join RTP payload <McVideoPort1> RTP payload <McVideoPort1> SR: Sender Report RTCP Packet <McVideoPort1+1> RR: Receiver Report RTCP Packet <McVideoPort1+1> SR: Sender Report RTCP Packet <McVideoPort1+1> <McAddress1> RTP payload <McVideoPort1> RTP payload <McVideoPort1> BYE: Goodbye RTCP Packet <McVideoPort1+1> BYE: Goodbye RTCP Packet <McVideoPort1+1> IGMP Leave Figure 2-3 Sony Remote Camera RR: Receiver Report RTCP Packet <McVideoPort1+1> IGMP Leave Sequence of Get Video Streaming (UDP multicast) 9 Version 1.0.0 HTTP Streaming Technical Guide | SRG 2.3. Get Audio Streaming 2.3.1. TCP Bit Stream (Audio) <Method> GET <Syntax> http://<camera_address>/audio <Example> The following figure and list show an example to get the HTTP bit stream of audio data. The raw data of specified audio codec is included in <audio data>. “Content-Type:” header shows the audio codec mode and parameter (see the table below). Sony Remote Camera 10 Version 1.0.0 HTTP Streaming Technical Guide | SRG Client Camera GET /audio HTTP/1.1 HTTP/1.1 200 OK <audio data> Figure 2-4 Sequence of Get Audio Streaming (TCP bit stream) GET /audio HTTP/1.1\r\n Host: <camera_address>\r\n Connection: Close\r\n \r\n HTTP/1.1 200 OK\r\n Content-Type: audio/16kadpcm\r\n Cache-Control: no-cache\r\n Pragma: no-cache\r\n \r\n <audio data> Table 2-2 “Content-Type:” Header for Audio Streaming Audio Codec AAC (128kbps) AAC (64kbps) Sony Remote Camera Header Content-Type:⊔audio/128kaac Content-Type:⊔audio/64kaac 11 Version 1.0.0 HTTP Streaming Technical Guide | SRG 2.3.2. UDP (RTP/RTCP) Unicast Bit Stream (Audio) <Method> GET <Syntax> http://<camera_address>/audio?UdpMode=unicast&UdpPort=<UDP port number> <Remarks> It is required for a client application to send RTCP receiver report to camera periodically to keep streaming. To stop the streaming, send RTCP BYE packet to camera. Note that the camera stops sending the bit stream if it fails to receive RTCP receiver report from the client side for consecutive time specified by RtpExpire parameter. <Example> The following figure shows an example to get the UDP (RTP/RTCP) unicast bit stream of audio data. In this case, RTP and RTCP packets are sent from <UcAudioPort> <UcAudioPort+1> to <UdpPort> and <UdpPort+1> respectively. 4 4 and If there are multiple clients, the camera also uses the available higher even port number as sender port. Sony Remote Camera 12 Version 1.0.0 HTTP Streaming Technical Guide | SRG Client Camera GET /audio?UdpMode=unicast&UdpPort=<UdpPort> HTTP/1.1 HTTP/1.1 204 No Content <UdpPort> RTP payload <UcAudioPort> <UdpPort+1> SR: Sender Report RTCP Packet <UcAudioPort+1> <UdpPort+1> RR: Receiver Report RTCP Packet <UcAudioPort+1> <UdpPort> RTP payload <UcAudioPort> <UdpPort+1> BYE: Goodbye RTCP Packet <UcAudioPort+1> Figure 2-5 Sony Remote Camera Sequence of Get Audio Streaming (UDP unicast) 13 Version 1.0.0 HTTP Streaming Technical Guide | SRG 2.3.3. UDP (RTP/RTCP) Multicast Bit Stream 5 (Audio) <Method> GET <Syntax> http://<camera_address>/audio?UdpMode=multicast <Remarks> It is required for a client application to send RTCP receiver report to camera periodically to keep streaming. To stop the streaming, send RTCP BYE packet to camera. The camera stops streaming when all the BYE packets from requested clients were received. Note that the camera stops sending the bit stream if it fails to receive RTCP receiver report from the client side for consecutive time specified by RtpExpire parameter. In addition, it is allowed to change the Time-to-live value for multicast packets by using McTtl parameter. <Example> The following figure shows an example to get the UDP (RTP/RTCP) multicast bit stream of audio data. In this case, RTP and RTCP packets are sent to <McAudioPort> and <McAudioPort+1> of <McAudioAddress> respectively. 5 To enable the multicast streaming, send /command/camera.cgi?Multicast=on to the camera. Sony Remote Camera 14 Version 1.0.0 HTTP Streaming Technical Guide | SRG Client Camera GET /audio?UdpMode=multicast HTTP/1.1 HTTP/1.1 204 No Content IGMP Join IGMP Join RTP payload <McAudioPort> RTP payload <McAudioPort> SR: Sender Report RTCP Packet <McAudioPort+1> RR: Receiver Report RTCP Packet <McAudioPort+1> SR: Sender Report RTCP Packet <McAudioPort+1> <McAudioAddress> RTP payload <McAudioPort> RTP payload <McAudioPort> BYE: Goodbye RTCP Packet <McAudioPort+1> BYE: Goodbye RTCP Packet <McAudioPort+1> IGMP Leave Figure 2-6 Sony Remote Camera RR: Receiver Report RTCP Packet <McAudioPort+1> IGMP Leave Sequence of Get Audio Streaming (UDP multicast) 15 Version 1.0.0 HTTP Streaming Technical Guide | SRG 2.4. Get Still Image <Method> GET <Syntax> http://<camera_address>/oneshotimage.jpg http://<camera_address>/oneshotimage1 http://<camera_address>/oneshotimage2 http://<camera_address>/oneshotimage3 <Example> The following list shows an example to get a JPEG file as a still image. GET /oneshotimage1 HTTP/1.1\r\n Host: <camera_address>\r\n Connection: Close\r\n \r\n HTTP/1.1 200 OK\r\n Content-Type: image/jpeg\r\n Content-Length: <image size> \r\n <JPEG data> Sony Remote Camera 16 Version 1.0.0 HTTP Streaming Technical Guide | SRG 2.5. Server Error Following table shows the descriptions of status code for server error. Table 2-3 Status Code 400 Descriptions of Server Error Message Bad Request Description The request could not be understood by the server due to malformed syntax. In this case, confirm the parameters in syntax and/or the setting of video or audio. 500 Internal Server Error The server encountered an unexpected condition which prevented it from fulfilling the request. 503 Service Unavailable The server is currently unable to handle the request due to a temporary overloading of the server. In this case, confirm the operating condition such as the number of streaming request. Sony Remote Camera 17 Version 1.0.0 HTTP Streaming Technical Guide | SRG 3. User Data of H.264 and JPEG 3.1. User Data in H.264 3.1.1. Descriptions of bit stream The following figures show the each picture for H.264 bit stream (<H.264 data>). The “User Data Unregistered SEI (Supplemental Enhancement Information)” is used for the “user data”. 0x0000000127 Sequence Parameter Set 0x0000000128 Picture Parameter Set 0x000000010605 User Data Unregistered SEI 0x0000000125 IDR Picture Figure 3-1 IDR-Picture for H.264 bit stream 0x000000010605 User Data Unregistered SEI 0x0000000121 Picture Slice (P-Picture) Figure 3-2 P-Picture for H.264 bit stream 3.1.2. Descriptions of User Data The following table shows the “user data” in the H.264 bit stream (<H.264 data>) of camera. Sony Remote Camera 18 Version 1.0.0 HTTP Streaming Technical Guide | SRG Table 3-1 Field Byte Length Descriptions of User Data for H.264 Byte Offset 6 1 0 6 UUID Date Time 16 33 7 23 Frame Rate 13 56 Timestamp 22 PTZ position 26 Reserved 28 Auto Flip 13 117 145 1 158 “user data” Start Code Size Reserved Sony Remote Camera 69 91 Description This field is 0x000000010605. This field shows the total byte length of UUID and “user data”. This field shows the MAC address of the camera. This field shows the local time. [example] CamTim:⊔2012-01-01⊔Sun⊔15:15:15\r\n This field shows the current frame rate of the video bit stream. [example] FrmRate:⊔05\r\n This field shows the value which is incremented by 90kHz timer (about 11 microseconds per one increment). [example] TimStamp:⊔0000000001\r\n This field shows the pan, tilt and zoom position. [example] CamPos:⊔111ppppttttzzzzm\r\n If a camera supports PTZ, first 3 digits are 111. Next “pppp”, “tttt” and “zzzz” show the pan, tilt and zoom position respectively. The last “m” shows the status. “M” means the camera is moving and “S” means the camera is not moving. If the camera doesn’t support PTZ, this value is “000000000000000S”. This field is “AlmEvent:⊔0000000000000000\r\n”. This field shows the status of auto flip. 0: disabled / 1: enabled [example] AutoFlip:⊔0\r\n This field is 0x80. 19 Version 1.0.0 HTTP Streaming Technical Guide | SRG 3.2. User Data in JPEG 3.2.1. Description of JPEG Data The following figures show the descriptions of each JPEG image (<JPEG data>). The “Comment Segment”, inserted between SOI (Start of Image) and DQT (Define Quantization Table), is used for the “user data”. 0xFFD8 [SOI (Start of Image)] 0xFFFE COM (Comment) 0xFFDB DQT (Define Quantization Table) 0xFFC0 SOF0 (Start of Frame) 0xFFC4 DHT (Define Huffman Table) 0xFFDA SOS (Start of Scan) 0xFFD9 [EOI (End of Image)] Figure 3-3 Description of JPEG Data 3.2.2. Descriptions of User Data (Comment Segment) The following table shows the “user data” in the JPEG image (<JPEG data>) of camera. For the details, refer to the Table 3-1 also. Sony Remote Camera 20 Version 1.0.0 HTTP Streaming Technical Guide | SRG Table 3-2 Field Byte Length Byte Offset Marker Marker length 2 2 0 2 JPEG data length 19 4 Date Time 33 23 Frame Rate 13 56 Timestamp 22 69 PTZ position 26 91 Reserved Auto Flip 28 13 117 145 Reserved 2 158 Sony Remote Camera Description of User Data for JPEG Description This field is 0xFFFE. This field shows the total length of this segment except for the marker. This field shows the entire length of the JPEG image (<JPEG data>) in decimal. [example] DataLen:⊔01234567\r\n This field shows the local time. [example] CamTim:⊔2012-01-01⊔Sun⊔15:15:15\r\n This field shows the current frame rate of the video bit stream. [example] FrmRate:⊔05\r\n This field shows the value which is incremented by 90kHz timer (about 11 microseconds per one increment). [example] TimStamp:⊔0000000001\r\n This field shows the pan, tilt and zoom position. [example] CamPos:⊔111ppppttttzzzzm\r\n This field is “AlmEvent:⊔0000000000000000\r\n”. This field shows the status of auto flip. [example] AutoFlip:⊔0\r\n This field is 0x0000. 21 Version 1.0.0 HTTP Streaming Technical Guide | SRG Revision History Date Revision 2014/12/17 1.0.0 Sony Remote Camera Description First edition. 22 Version 1.0.0 Disclaimer This document, in whole or in part, may not be reproduced or transferred for any purpose without prior written approval from Sony Corporation. Sony Corporation reserves the right to make any modification to this document or the information contained herein at any time without notice. Sony Corporation shall not bear any responsibility or liability for any damage, lost earning, and third party claim, resulting from the products and related documents. Copyright This document contains registered trademarks and .trademarks that are owned by their respective companies. Sony Remote Camera Version 1.0.0