Fast integrated iOS based RTMP video streaming

Design sketch

ITools has a card, but pushed to the server is very fast.

Fast integrated iOS based RTMP video streaming
push flow


This is the first glimpse of blog iOS live video: < meow sowing a supplement. APP> because the prequel to no integrated video on GitHub in the project. Ask me to push the push flow how to achieve flow this part of many friends Jane and micro-blog. So, I re integrated push flow RTMP before, incorporated into the project.

Download link

GitHub (full version live video)

Blog detailed (we recommend this together to see)

Mac build nginx+rtmp server

My personal computer inside long ago to build a nginx+rtmp server, but to build on the company computer yesterday, when the manual input command, or bug (so, suggest that you don’t directly copy the command, manual input command). So a detailed record of building steps, prevent again jump pit
this… Tutorial reference: Mac build nginx+rtmp server push cool

  • Open the terminal to see if the Homebrew has been installed, direct terminal input command
Man brew

If Mac is already installed, it will show some help information for the command. When you enter Q, you can go directly to the second step. Otherwise, if
is not installed, the command is executed

Ruby -e "$(curl -fsSL"

If installed, want to uninstall

Ruby -e "$(curl -fsSL"
  • 2 install nginx

First clone nginx project to local

Brew tap homebrew/nginx

Perform installation:

Brew install nginx-full --with-rtmp-module

At this point, the nginx and RTMP modules are installed on the
input command:


In the browser to open http://localhost:8080
if the following figure shows that the installation is successful

Fast integrated iOS based RTMP video streaming
installed successfully

If the terminal prompt

Nginx: [emerg] bind (to) failed (48: Address already in use nginx: [emerg] bind (
) (to) failed 48: Address already in use nginx: [emerg] bind (
) (to) failed 48: Address already in use nginx: [emerg] bind (
) (to) failed 48: Address already in use

Indicates that the 8080 port is occupied, view port PID

Lsof -i tcp:8080

According to the port PID, the kill drops (9603 of this is replaced with your own PID port 8080)

Kill 9603

Then re execute nginx, open http://localhost:8080

  • 3 configure nginx and ramp
    first we see where nginx is installed
Brew info nginx-full

As shown, find the location of the nginx.conf file

Fast integrated iOS based RTMP video streaming

Through VIM or click Finder-> go to -> go to folder -> enter /usr/local/etc/nginx/nginx.conf-> use Notepad tool (recommended Sublime Text) to open the nginx.conf.

Direct roll to the last line in the last} (no {} is the last blank, added later)

# node in HTTP followed by RTMP configuration: RTMP {server {listen 1935; application rtmplive {live on; record off;}}}

Then restart the nginx (which 1.10.1 to replace your own version of the nginx version of the installation, see the version number can be used with the nginx -v command)

/usr/local/Cellar/nginx-full/1.10.1/bin/nginx -s reload

Yesterday, when executing this command, the pit appeared. (if you command executed successfully, restart successfully, without any exception, please jump directly to the next step)
execution time, report abnormal

Nginx: [emerg] directive RTMP in unknown /usr/local/etc/nginx/nginx.conf:119

RTMP became the unknown command. I hurried to Google, which will be the answer to all try again, this bug taoshengyijiu. Finally there is no way that the brew list view all installed modules, that is when you manually typing commands, nginx-full will become nginx -full.

Upper solution:
uninstall nginx

Brew uninstall nginx

Install nginx again

Brew install nginx-full --with-rtmp-module
  • Install ffmpeg

Execute command

Brew install ffmpeg

Install the ffmpeg time is a little longer. If the speed is too slow, but also suggested that only more than and 50 M over the wall. What a little patience is good. In the time of waiting, and then install a RTMP protocol video player VLC

  • Ffmpeg push the flow of
    to my desktop a loginmovie.mp4 (to prepare a video file, you can use my GitHub project in the Resource file under the two video files), for example, the implementation of the push command

Ffmpeg -re -i -vcodec -acodec AAC -2 -f -strict flv /Users/sunlin/Desktop/loginmovie.mp4 libx264 rtmp://localhost:1935/rtmplive/room

After the video is pushed to the server, open the VLC, and then File-> open network-> input:


The effect is shown in figure

Fast integrated iOS based RTMP video streaming
push flow

Fast integrated live push


  • Go to the GitHub to download the latest meow project
  • Configure the nginx+rtmp server according to the above tutorial

To achieve your own original live streaming, but today when technology group chat, a friend recommended Youku potatoes’s crazy live down shortly before the open source iOS push flow framework LFLiveKit. is written in OC, very suitable for learning (and I am ready to dig into this framework, what questions we can discuss together) also, the integration is very simple, a few code on OK.

Download I write meow after sowing direct search, ShowTimeViewController Xcode in the bottom left, enter the ShowTimeViewController.m. search – (IBAction) living: (UIButton * sender), which will replace the stream.url into your own RTMP address.

Tip: LFLiveKit has integrated GPUImage, if the project has integrated GPUImage, you need to remove the previous and integrated LFLiveKit need to turn off Bitcode.

Closing statement

Now the broadcast is meow is a relatively complete live video project, although with a lot of the third party, but also saves the development time, improve the efficiency of development. Constantly improve the
later this project I will, if you have a good idea or what effect, if micro-blog can contact me. Can I fix, as soon as I added.

GitHub Download

Full version of live video: meow broadcast download address

Contact me


Jane book