Skip to content

Record Live Stream

YouPHPTube edited this page Jan 2, 2018 · 38 revisions

This tutorial will guide you how to record your live stream and send it to the encoder.

For this tutorial you will need

  1. The plugin SendRecordedToEncoder
  2. Streamer and nginx Live Stream Server need to be on the same server

Step 1

Make sure you update your streamer and encoder. if you are not sure how to do this, check this tutorial

Step 2

Change your nginx.conf file

sudo nano /usr/local/nginx/conf/nginx.conf

and then add those lines on your file

recorder video{
    record video
    record_path /tmp;
    record_notify on;
    #will produce files of the form mystream-24-Apr-13-18:23:38.flv
    record_suffix -%d-%b-%y-%T.flv;
}

your rtmp section should look like this.

rtmp {
        server {
                listen 1935;
                allow play all;
                #creates our "live" full-resolution HLS videostream from our incoming encoder stream and $
                application live {
                        allow play all;
                        live on;
                        #record all;
                        #record_path /video_recordings;
                        #record_unique on;
                        hls on;
                        hls_nested on;
                        hls_path /HLS/live;
                        #hls_playlist_length 4s;
                        #hls_fragment 1s;
                        hls_fragment 10s;
                        on_publish http://192.168.25.16/YouPHPTube/plugin/Live/on_publish.php;
                        on_play http://192.168.25.16/YouPHPTube/plugin/Live/on_play.php;
                        on_record_done http://192.168.25.16/YouPHPTube/plugin/Live/on_record_done.php;
                        recorder video{
                            record video;
                            record_path /tmp;
                            record_notify on;
                            #will produce files of the form yourUserKey-24-Apr-13-18:23:38.flv
                            record_suffix -%d-%b-%y-%T.flv;
                        }

                }
        }
}

Check your on_record_done directive, it needs to be pointing to the live stream plugin, on_record_done.php file

Step 3

Restart your nginx server

 sudo /usr/local/nginx/sbin/nginx -s stop

 sudo /usr/local/nginx/sbin/nginx 

Step 4

Go to your plugin menu and enable SendRecordedToEncoder plugin

Clone this wiki locally