The most simple iOS push stream code, video capture, soft coding (FAAC, X264), hard coding (AAC, H264), beauty, FLV coding, RTMP protocol, updated code parsing, you want to learn the knowledge here, willing to understand live technology students come to see!!

Source: https://github.com/hardman/AWLive

Push the flow process

The flow of pushing a stream using the RTMP protocol (similar to other protocols) is as follows:

  1. Capture video and sound through the system camera, the beauty of the beauty of the face, the filter of the filter.
  2. The captured video frames are in YUV format and the captured audio frames are in PCM format.
  3. The captured audio and video data is passed into a serial queue (encoding queue) and encoded in the queue.
  4. Convert yuV format video data into H264 format video frames; Convert PCM format audio data to AAC format audio frame.
  5. Convert h264 and AAC data into FLV video frames. Put into the encoding buffer, ready to send. Continue to get the video frame and encode it.
  6. Establish the RTMP connection to the server and, upon success, create another serial queue (send queue).
  7. The RTMP protocol requires the sending of SPS/PPS and AudioSpecificConfig in the first frame.
  8. After the first frame is sent, the sending queue continuously fetches FLV video frames from the encoding queue and sends them to the RTMP server.
  9. End live stream, close push stream, release resources.

My code is written exactly as described above. This logic also applies to almost any push-stream code on the market.

I have drawn two diagrams of the above process and source code. It has detailed procedures and techniques to use.

Pusher flow chart

Code structure class diagram

The article lists

  1. 1 hour to learn: the simplest iOS live push stream (A) project introduction
  2. 1 hour learning: The simplest iOS Live Streams (II) Code Architecture Overview
  3. 1 hour to learn: the simplest iOS live push stream (3) Using the system interface capture audio and video
  4. 1 hour learning: the simplest iOS live push stream (4) how to use GPUImage, how to beauty
  5. 1 hour learning: the simplest iOS live stream push (5) yuV, PCM data introduction and acquisition
  6. 1 hour to learn: the simplest iOS live push stream (6) H264, AAC, FLV introduction
  7. Learn in 1 hour: The simplest iOS Live Stream push (7) H264 / AAC hard coding
  8. 1 hour to learn: The simplest iOS live Push stream (8) H264 / AAC soft coding
  9. Learn in 1 hour: The simplest iOS live stream push (nine) FLV encoding with audio and video timestamp synchronization
  10. 1 hour learning: The simplest iOS live push stream (10) Librtmp usage introduction
  11. Introduction to SPS&PPS and AudioSpecificConfig (End)