(Add the teacher WeChat to receive a full set of courseware materials and video tutorials for free)
1. The role of video surveillance
2. If you just want to check the situation of the room in the living room, no complicated agreement is needed
As programmers, we need to write 2 programs:
- On the ARM board connected to the camera, implement a server program: it reads camera data while waiting for the client to connect and send data
- On the mobile phone or computer, write the client program, it will get the data from the ARM board and display it
- There is no need to implement complex protocols between these two programs
-
- Conventional data format
-
- Transmit one frame of data
In fact, we can use ready-made programs:
- mjpg-streamer, which runs on the ARM board
- Use the browser on your phone to watch the video directly
advantage:
- The program is simple, all the source code is clear at a glance, easy to learn
- The performance requirements of the ARM board are not high, and the ARM chip with a main frequency of 200MHz can also be realized
Disadvantages:
- Can only realize video surveillance in LAN
- To achieve Internet video surveillance, additional intranet penetration is required
- mjpg-streamer does not implement sound transmission
- The mjpg-streamer project is no longer maintained, it is only recommended for learning
Three, use streaming media
As programmers, we need to write 3 programs:
-
On the ARM board connected to the camera, a push program is implemented: it reads the camera data while pushing the data to the server
-
On the server, implement the "streaming media server" program: it receives the data sent by the ARM board, converts the data format, and sends it to the mobile phone and other clients
-
On the mobile phone and other clients, the pull program is implemented: it pulls data from the server and displays it
In fact, we can remove the Internet function:
-
The "push program" and "streaming media server" programs are all running on the ARM board; clients such as mobile phones can only watch videos in the same LAN
-
Or use intranet penetration technology to realize Internet video surveillance
We do not need to implement these functions from scratch:
-
Push program: ffmpeg
-
Streaming media server program: Nginx
-
Client program: VLC browser
We need to understand some agreements:
-
There are more procedures, everyone must follow some agreements to work together
-
There are many streaming protocols
-
STMP、HTTP-FLV、HLS
Four, several streaming media protocols
Reference materials:
A preliminary study on HTTP-FLV live broadcast
https://www.cnblogs.com/saysmy/p/7851911.html
Understand the correct posture of RTMP, HttpFlv and HLS
https://www.jianshu.com/p/32417d8ee5b6
RTMP:
-
Real Time Messaging Protocol
-
Produced by Adobe, you need Flash player to watch
-
Small delay, suitable for live broadcast
HttpFlv:
-
Realize RTMP on HTTP, the transmitted data is flv file like RTMP
-
B station open sourced flv.js, realized pure HTML5 to watch live broadcast, no longer need Flash player
-
Small delay, suitable for live broadcast
-
HttpFlv can only do live broadcast, while RTMP can achieve more operations
-
But HttpFlv is transmitted through Http 80 port, which has strong penetrability
HLS:
-
HTTP Live Streaming
-
Apple listing
-
Large delay, suitable for watching video, not suitable for live broadcast
5. Streaming media service: plus one server at both ends
note:
-
RTMP can be used on both ends
-
HTTPFLV and HLS can only be used on the streaming side
Receive free courseware video tutorials
Video tutorial catalog
Chapter 1: Introduction to Video Surveillance Solution
Chapter 2: Implementation of MJPG-streamer Solution
Chapter 3: Implementation of Streaming Media Solution: ffmpeg
Chapter 4: Implementation of Streaming Media Solution: Nginx
Chapter 5: Camera and Sound Card Interface
VI Chapter_Intranet Penetration
collection method
(Add teacher WeChat to receive for free)
WeChat ID: baiwenwang02
Technology Exchange Group (Hongmeng Development/Linux/Embedded/Driver/Data Download)
QQ group: 869222007
MCU-Embedded Linux Exchange Group
QQ group: 536785813