Detailed development details of the live broadcast platform, providing the source code of the finished live broadcast system

The popularity of live broadcast has been burning from 2016 to 2018. The technology developed by the live broadcast platform - the source code of the live broadcast APP has gradually surfaced. Now that the live broadcast is on fire, do you also want a live broadcast platform that is unique to you? The editor will explain the development details of a simple live broadcast platform for you today.

1. Front-end push flow

1. You can use the command to push the stream: ffmpeg -i input -vcodec copy -acodec copy -f flv rtmp://127.0.0.1/live/cgstream0input It can be a real-time stream or a file. If it is a file, you need to add -re . In use, you need to replace 127.0.0.1 with the ip address of the machine where rtmp is located.

Pushing the timestamp information with commands cannot be modified arbitrarily. To achieve a satisfactory result, it is still necessary to use code.

The main method code is as follows:

1. Open the video stream, filename can be the file name or the live stream url.

2. Create an output context and an output stream. The format of the output stream needs to be set to flv

3. Read audio and video packets from the input stream

2. Server

The server can choose crtmpserver, crtmpserver is open source, and can run on both the windows platform and the linux platform.

With the improvement of people's requirements for video quality, basically the resolution of video is high-definition ( 1080p), and the bit rate will basically be above 4M. Imagine if the server network card chooses a Gigabit network card, a single network card can support more than 200 channels at most. Generally speaking, the CPU configuration of the server will be much higher than that of ordinary computers, and there will be no performance problems if it supports hundreds of concurrent channels.

3. Playback

If you play on the web page (IE), you can choose JwPlayer, and you can also use a plug-in. If the bottom layer of the Android player is based on ffmpeg, it can also play the audio and video stream forwarded by CrtmpServer (ffmpeg needs to import the librtmp library), and the same is true for the IOS system.

4. How to build

1. First download the CrtmpServer service, run crtmpserver.exe under the double-click folder, if there is no flashback, it means the operation is successful.

2. Download ffmpeg.exe, if you are streaming under linux, you need the linux version of ffmpeg. cgstream0 can be arbitrarily modified as needed. Under the Windows platform, if the streaming is successful, ffmpeg will always print information, and there will be corresponding prompts for errors.

3. Play: You can use ffplayer.exe or CGPlayer to play.

4. The above is just a simple live broadcast platform development process. If you need to enter the live broadcast platform development in the live broadcast market, this simple live broadcast platform is not applicable. It is recommended that you still find a professional live broadcast APP source code service provider to build it for you, yunbao Live is a good live APP source code service provider. It not only provides the source code, but also can build the live broadcast platform you need. If you need it, you may wish to go to the yunbao official website to have a closer look.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325348244&siteId=291194637