• 1. Streaming media protocol for the camera

  • What is a streaming media protocol

Streaming Media refers to a technology and process that compresses a series of Media data and sends the data in sections over the Internet, so that the video and audio can be instantly transmitted over the Internet for viewing. This technology enables data packets to be sent like water. Otherwise, the entire Media file must be downloaded before use.

The essence of watching a video or live broadcast is to watch pictures played in rapid succession. Each picture in this case is a frame. The number of pictures played per second is the playback speed called frame rate (FPS). According to the principle of visual residue, the human eye feels coherent at more than 24 frames per second, so live video or game frame rate (FPS) is usually greater than this value, which is 30 in most cases.

  • Streaming protocol for the camera

The commonly used streaming media protocols in the world include HTTP, RTSP and RTMP. Due to the nature of live broadcast, cameras have high requirements on real-time performance. Domestic camera manufacturers, such as Hikang and Dahua, mostly adopt RTSP protocol. The RTSP address varies with the camera brand, and its format is as follows.

Hai kang:

Dahua:

2. Streams are played over streaming media protocols

When you get the RTSP address of the camera, the first step is to test whether the RTSP address is valid. If the ADDRESS is Http, you can use a test tool such as Postman or SoapUI to send a request for verification. For an RTSP address, you can use either of the following methods to verify whether the address is available. I search the Internet to a usable for rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov RTSP address, if side doesn’t have a camera, the readers can be substituted for the address test for the time being.

  • VLC

    Download link: pan.baidu.com/s/1xbMjDuJo… Extraction code: bifr. The installation process is the same as that of other desktop software on the PC. The 100-word step is omitted.

    Open VLC player, choose Media (M)-> Open Network Streaming (N).

Select Network (N) in the open media window, enter the RTSP address of the camera in the Please Enter Network URL: input box, and click the Play (P) button in the lower right corner after confirming the error

If you can view the video of the camera, the RTSP address is normal.

  • EasyNVR

Official website to download address: easynvr-1257312146.cos.ap-shanghai.myqcloud.com/download.ht… Here I choose the latest version of EasynVR-4.2.1, download and move to the specified drive letter decompression is completed, I moved to D disk D:\ easynVR-Windows-4.2.1-2103010958

Enter the easynVR-Windows-4.2.1-2103010958 directory, find the easynvr. exe file, double-click to start EasyNVR, then the Dos window will open, as shown in the following figure

Browser using the default user name: enter EasyNVR service address http://192.168.10.3:10800 EasyNVR password: EasyNVR, access to the system; Access channel management -> Channel list, EasyNVR default initialization of 16 channels for us to configure (EasyNVR is a paid software, we are using a trial version, the maximum number of channels support 16, valid for a month), select one of the channels record edit.

On the Channel Management -> Channel List -> Channel Edit page, input the channel information and save it

Access the Video Square -> Device List -> Device Resources, you can see the channel just enabled. If the configuration channel is online, it indicates that the configuration is correct, and the RTSP address is valid.

3. Free open source FFmpeg

FFmpeg is a bridge between video stream and the back end, through FFmpeg command the back end can achieve stream capture, video recording, video compression transcoding and other functions

  • The software is introduced

FFmpeg is an open source computer program that can record, convert, and stream digital audio and video. Under LGPL or GPL license. It provides a complete solution for recording, converting and streaming audio and video. It includes a very advanced audio/video codec library called LibavCodec. In order to ensure high portability and codec quality, much of libavCodec code is developed from scratch.

  • Download and install

Download link: pan.baidu.com/s/1xaL-EB1K… Extraction code: DCPV. Download to the local decompression, if you need to modify the decompression file name, the author here to ffmpeg, as shown in the figure.

  • FFmpeg command
# RTSP video flow M3U8
D:\ffmpeg\bin\ffmpeg -I RTSP address -c copy -f hlS-hls_time 2.0 -hls_list_size 0 -hls_wrap 15 M3U8 file location
# RTSP video streams are transmitted to relay HTTP
D:\ffmpeg\bin\ ffmpeG-i RTSP address -q 0 -f MPEGts-codec :v mPEG1Video -s 1366x768 trunk HTTP
# Use hardware-accelerated RTSP video stream relay HTTP
D:\ ffmPEG \bin\ ffmPEG-hwaccel auto-rtSP_transport TCP -I RTSP address -f mPEGts-codec :v mPEG1video-bf 0-codec :a mp2-r 25 -b:v 1000K -S 960x520-an Trunk HTTP
# RTSP Video stream capture
D:\ffmpeg\bin\ ffmpeG-I RTSP address -ss 00:00:01 -vframes 1 -f image2 -vcodec PNG Image file location
# RTSP video streaming video
D:\ffmpeg\bin\ ffmpeg-y -i RTSP address -t 30 -vcodec copy-acodec copy -f MP4 Video file location
# Video compression
D:\ FFmpeg \bin\ FFmPEG-I Source MP4 File - Threads 2-R 25-B: V 1000K-S 960x520 Compressed MP4 file location
Copy the code