ffplayout-frontend icon indicating copy to clipboard operation
ffplayout-frontend copied to clipboard

Help wanted

Open ronvanherk opened this issue 3 years ago • 81 comments

I am looking for someone to help me out in configuring ffplayout in combination with the frontend. It is not for setting up the installation, everything is set up and working. It is mainly for configuring rtmp output, preview, live ingest etc.

I can offer payment. This would be needed on a regular basis (whenever I want to make a change ;-) )

Best regards, Ron

ronvanherk avatar May 10 '22 07:05 ronvanherk

Hello Ron, I would suggest, that we try here together to fix your problem. Then maybe you will be able in the future to setup everything by your self and it can help others to.

For me is difficult at the moment to give payed support, because of the lack of time.

Can you describe your need a bit more? What are the target to that you want to stream? What is your preferred rtmp server, also for preview? Are you ok with SRS?

jb-alvarado avatar May 11 '22 07:05 jb-alvarado

Hi,

Thanks, yes that would work for me.

So I run a ffplayout server and have updated it to the latest version. Before, I used the hls output but because I want to use the new live ingest function, I have changed it to stream to get an rtmp output.

As a streaming server I use Nimble, running on a dedicated server as well. I am trying to send rtmp to that server, but it does not arrive.

SRS would be ok with me, as long as I create a) scheduled playlists and b) unlimited repeating playlists - and also be able to switch to an incoming live stream coming from my smartphone or laptop as well.

I can send you the login info by pm if that is ok, so you can take a look at the configuration?

Thanks in advance!

ronvanherk avatar May 11 '22 08:05 ronvanherk

I also can't get the preview window to work properly. Can you help?

ronvanherk avatar May 12 '22 07:05 ronvanherk

Just as a info: The next release will have live ingest in HLS mode to.

I think we should see first, that you are able to stream to your Nimble server, and when this is working we can add preview. I would suggest:

  1. deactivate preview
  2. try stream directly with ffmpeg to your server
  3. when 2. works take the command for ffplayout

After update did you replace the config with the new one? Because they are not compatible.

When this is still not working please post your output settings.

jb-alvarado avatar May 12 '22 07:05 jb-alvarado

Hi,

Ok so I deactivated preview which made no change. Then I streamed directly to my server using OBS with the same settings and that works.

I am using the following output settings:

-c:v libx264 -crf 23 -x264-params keyint=50:min-keyint=25:scenecut=-1 -maxrate 1300k -bufsize 2600k -preset faster -tune zerolatency -profile:v Main -level 3.1 -c:a aac -ar 44100 -b:a 128k -flags +global_header -f flv rtmp://10.13.37.253:1935/yourowntv/eyeonlinetv

ronvanherk avatar May 12 '22 07:05 ronvanherk

And this works not in ffplayout?

can you run /opt/ffplayout-engine/venv/bin/python /opt/ffplayout-engine/ffplayout.py -l none and post here the output?

jb-alvarado avatar May 12 '22 07:05 jb-alvarado

yourowntv@eyeonlinetv:~$ /opt/ffplayout-engine/venv/bin/python /opt/ffplayout-engine/ffplayout.py -l none
[2022-05-12 09:52:15,411][WARNING]  Ingest stream is experimental, use it at your own risk!
[2022-05-12 09:52:15,412][DEBUG]    Server CMD: "ffmpeg -hide_banner -nostats -v level+error -f live_flv -listen 1 -i rtmp://localhost:1936/live/stream -filter_complex [0:v]fps=25,scale=1280:720,setdar=dar=1.778[v];[v]null[vout1] -map [vout1] -map 0:a -pix_fmt yuv420p -r 25 -c:v mpeg2video -g 1 -b:v 92160.0k -minrate 92160.0k -maxrate 92160.0k -bufsize 46080.0k -c:a s302m -strict -2 -ar 48000 -ac 2 -f mpegts -"
[2022-05-12 09:52:15,413][DEBUG]    Encoder CMD: "ffmpeg -v level+error -hide_banner -nostats -re -thread_queue_size 160 -i pipe:0 -c:v libx264 -crf 23 -x264-params keyint=50:min-keyint=25:scenecut=-1 -maxrate 1300k -bufsize 2600k -preset faster -tune zerolatency -profile:v Main -level 3.1 -c:a aac -ar 44100 -b:a 128k -flags +global_header -f flv rtmp://10.13.37.253:1935/yourowntv/eyeonlinetv"
[2022-05-12 09:52:15,611][ERROR]    Playlist not exists: /playlists/2022/05/2022-05-12.json
[2022-05-12 09:52:15,612][ERROR]    Clip nodes are empty!
[2022-05-12 09:52:15,612][DEBUG]    delta: -0.000025
[2022-05-12 09:52:15,613][DEBUG]    total_delta: 86399.731967
[2022-05-12 09:52:15,614][WARNING]  No filler clipt is set! Add dummy...
[2022-05-12 09:52:15,614][INFO]     Play: color=c=#121212:s=1280x720:d=59.999:r=25,format=pix_fmts=yuv420p
[2022-05-12 09:52:15,614][DEBUG]    Decoder CMD: "ffmpeg -v level+error -hide_banner -nostats -f lavfi -i color=c=#121212:s=1280x720:d=59.999:r=25,format=pix_fmts=yuv420p -f lavfi -i anoisesrc=d=59.999:c=pink:r=48000:a=0.05 -filter_complex [0:v]null[v];[v]null[vout1] -map [vout1] -map 1:a -pix_fmt yuv420p -r 25 -c:v mpeg2video -g 1 -b:v 92160.0k -minrate 92160.0k -maxrate 92160.0k -bufsize 46080.0k -c:a s302m -strict -2 -ar 48000 -ac 2 -f mpegts -"

ronvanherk avatar May 12 '22 07:05 ronvanherk

Does the playout continue running, or does it break?

For me it looks like, that this issue is not related to ffplayout.

jb-alvarado avatar May 12 '22 07:05 jb-alvarado

There is no output. The rtmp server is not receiving anything.

ronvanherk avatar May 12 '22 08:05 ronvanherk

When the command from above runs for longer and don't stop, it streams some where.

You can simulate this with:

ffmpeg -v level+error -hide_banner -nostats -re -thread_queue_size 160 -i <INPUT.mp4> -c:v libx264 -crf 23 -x264-params keyint=50:min-keyint=25:scenecut=-1 -maxrate 1300k -bufsize 2600k -preset faster -tune zerolatency -profile:v Main -level 3.1 -c:a aac -ar 44100 -b:a 128k -flags +global_header -f flv rtmp://10.13.37.253:1935/yourowntv/eyeonlinetv

jb-alvarado avatar May 12 '22 08:05 jb-alvarado

It was running all the time (the command), when I stopped it, this is what it said:

[2022-05-12 10:09:55,460][ERROR]    Playlist not exists: /playlists/2022/05/2022-05-12.json
[2022-05-12 10:09:55,462][INFO]     Loop playlist
[2022-05-12 10:09:55,463][ERROR]    Playlist not exists: /playlists/2022/05/2022-05-12.json
[2022-05-12 10:09:55,463][ERROR]    Clip nodes are empty!
[2022-05-12 10:09:55,464][DEBUG]    delta: -0.000088
[2022-05-12 10:09:55,465][DEBUG]    total_delta: 85339.880078
[2022-05-12 10:09:55,466][WARNING]  No filler clipt is set! Add dummy...
[2022-05-12 10:09:55,467][INFO]     Play: color=c=#121212:s=1280x720:d=59.999:r=25,format=pix_fmts=yuv420p
[2022-05-12 10:09:55,468][DEBUG]    Decoder CMD: "ffmpeg -v level+error -hide_banner -nostats -f lavfi -i color=c=#121212:s=1280x720:d=59.999:r=25,format=pix_fmts=yuv420p -f lavfi -i anoisesrc=d=59.999:c=pink:r=48000:a=0.05 -filter_complex [0:v]null[v];[v]null[vout1] -map [vout1] -map 1:a -pix_fmt yuv420p -r 25 -c:v mpeg2video -g 1 -b:v 92160.0k -minrate 92160.0k -maxrate 92160.0k -bufsize 46080.0k -c:a s302m -strict -2 -ar 48000 -ac 2 -f mpegts -"
[2022-05-12 10:10:35,733][ERROR]    [Decoder] av_interleaved_write_frame(): Broken pipe
[2022-05-12 10:10:35,736][ERROR]    [Server] [rtmp @ 0x55a4cfd97400] Cannot open connection tcp://localhost:1936?listen&listen_timeout=-1000
[2022-05-12 10:10:35,736][ERROR]    [Server] rtmp://localhost:1936/live/stream: Immediate exit requested
[2022-05-12 10:10:35,768][WARNING]  Program terminated

ronvanherk avatar May 12 '22 08:05 ronvanherk

I tried with the ffmpeg command:

yourowntv@eyeonlinetv:~$ ffmpeg -v level+error -hide_banner -nostats -re -thread_queue_size 160 -i <INPUT.mp4> -c:v libx264 -crf 23 -x264-params keyint=50:min-keyint=25:scenecut=-1 -maxrate 1300k -bufsize 2600k -preset faster -tune zerolatency -profile:v Main -level 3.1 -c:a aac -ar 44100 -b:a 128k -flags +global_header -f flv rtmp://10.13.37.253:1935/yourowntv/eyeonlinetv -bash: INPUT.mp4: No such file or directory yourowntv@eyeonlinetv:~$

ronvanherk avatar May 12 '22 08:05 ronvanherk

Better disable the ingest server for now, but I still think ffplayout is not the problem :-).

You have to replace <INPUT.mp4> with a real file.

jb-alvarado avatar May 12 '22 08:05 jb-alvarado

This works ok with a real mp4 file:

yourowntv@eyeonlinetv:~/mp4s$ ffmpeg -v level+error -hide_banner -nostats -re -thread_queue_size 160 -i cocacola.mp4 -c:v libx264 -crf 23 -x264-params keyint=50:min-keyint=25:scenecut=-1 -maxrate 1300k -bufsize 2600k -preset faster -tune zerolatency -profile:v Main -level 3.1 -c:a aac -ar 44100 -b:a 128k -flags +global_header -f flv rtmp://10.13.37.253:1935/yourowntv/eyeonlinetv

The screenshot is the incoming Nimble rtmp server

Screenshot 2022-05-12 at 10 22 09

ronvanherk avatar May 12 '22 08:05 ronvanherk

You can create a valid playlist and see if it works better with that. You can also post for ffplayout.yml here.

jb-alvarado avatar May 12 '22 08:05 jb-alvarado

ok it is now sending a playlist after I put 2 videos in there and selected infinity.

Could we continue with fixing the preview and activating ingest?

ronvanherk avatar May 12 '22 10:05 ronvanherk

Do you run ffplayout in a local environment? When yes you could expose the ingest directly to your network.

When not I would continue with the preview:

  1. add to your /etc/hosts: 127.0.0.1 preview.local
  2. install SRS from source, I think you can use the 4.0release branch

Maybe you can follow the SRS install process from here: https://github.com/ffplayout/ffplayout-installer/blob/main/scripts/srs.sh. Are you able to understand this?

jb-alvarado avatar May 12 '22 10:05 jb-alvarado

"Do you run ffplayout in a local environment? When yes you could expose the ingest directly to your network."

How would I do that? The settings are these currently:

-s 512x288 -c:v libx264 -crf 24 -x264-params keyint=50:min-keyint=25:scenecut=-1 -maxrate 800k -bufsize 1600k -preset ultrafast -tune zerolatency -profile:v Main -level 3.1 -c:a aac -ar 44100 -b:a 128k -flags +global_header -f flv rtmp://preview.local/live/stream

ronvanherk avatar May 12 '22 12:05 ronvanherk

You ask me about live ingest? Because your settings you post is for preview.

jb-alvarado avatar May 12 '22 12:05 jb-alvarado

No I would like to fix the preview first, then look at the live ingest - so step by step

ronvanherk avatar May 12 '22 12:05 ronvanherk

Ok, then try to install SRS in the way I wrote it. Or have you install it with the installer already?

jb-alvarado avatar May 12 '22 13:05 jb-alvarado

OkI will install SRS first

ronvanherk avatar May 12 '22 14:05 ronvanherk

I have used the script in the link you sent to install SRS.

Now should I enable the preview and that's it? Are the preview params correct the way they are? What should the value for the player url be?

ronvanherk avatar May 12 '22 14:05 ronvanherk

When srs is correct setup and running, you need this preview address in ffplayout config: http://<IP or URL>/preview/stream.flv

And nginx needs this location:

location /preview/stream.flv {
        proxy_pass                  http://preview.local:8080/live/stream.flv;
    }

jb-alvarado avatar May 12 '22 15:05 jb-alvarado

So I can set it up like this? Screenshot 2022-05-12 at 17 08 22

ronvanherk avatar May 12 '22 15:05 ronvanherk

No, take the network IP, then you can use it from any machine.

jb-alvarado avatar May 12 '22 15:05 jb-alvarado

No luck yet, I tried several options. What would be the correct URL enter? The server's local IP address is 10.13.37.213

ronvanherk avatar May 12 '22 22:05 ronvanherk

What would be the correct URL enter? The server's local IP address is 10.13.37.213

The correct URL would be: http://10.13.37.213/preview/stream.flv

Ok lets check if everything is in place:

  1. have you add the entry in /etc/hosts
  2. can you check if SRS is running? systemctl status srs
  3. does ffplayout running, without error?
  4. have you set the location in the nginx config from /etc/nginx/site-enable/ffplayout.conf and restart nginx

When all this works, but there is still no preview, please post here the configs from SRS, nginx and ffplayout.

jb-alvarado avatar May 13 '22 06:05 jb-alvarado

I create a documentation for the preview stream: https://github.com/ffplayout/ffplayout-engine/blob/master/docs/preview_stream.md

jb-alvarado avatar May 13 '22 07:05 jb-alvarado

I tried all the steps in the new document, but still no video in the preview window. So here are the different settings:

yourowntv@eyeonlinetv:~$ systemctl status srs
● srs.service - SRS
   Loaded: loaded (/etc/systemd/system/srs.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2022-05-13 16:08:52 CEST; 17min ago
     Docs: https://github.com/ossrs/srs/wiki
  Process: 465 ExecStartPre=/usr/local/srs/objs/srs -t -c /etc/srs/srs.conf (code=exited, status=0/SUCCESS)
  Process: 487 ExecStart=/usr/local/srs/objs/srs -c /etc/srs/srs.conf (code=exited, status=0/SUCCESS)
 Main PID: 490 (srs)
    Tasks: 1 (limit: 4654)
   Memory: 5.9M
   CGroup: /system.slice/srs.service
           └─490 /usr/local/srs/objs/srs -c /etc/srs/srs.conf

May 13 16:08:52 eyeonlinetv srs[465]: [2022-05-13 16:08:52.173][Trace][465][0] devices, intranet enp0s3 10.13.37.213, intranet enp0s
May 13 16:08:52 eyeonlinetv srs[465]: [2022-05-13 16:08:52.173][Warn][465][0][0] stats network use index=0, ip=10.13.37.213
May 13 16:08:52 eyeonlinetv srs[465]: [2022-05-13 16:08:52.173][Warn][465][0][0] stats disk list: sda vda xvda xvdb
May 13 16:08:52 eyeonlinetv srs[465]: [2022-05-13 16:08:52.173][Trace][465][0] write log to console
May 13 16:08:52 eyeonlinetv srs[465]: [2022-05-13 16:08:52.174][Trace][465][0] config file is ok
May 13 16:08:52 eyeonlinetv srs[487]: [2022-05-13 16:08:52.214][Trace][487][0] XCORE-SRS/3.0.170(OuXuli)
May 13 16:08:52 eyeonlinetv srs[487]: [2022-05-13 16:08:52.215][Trace][487][0] config parse complete
May 13 16:08:52 eyeonlinetv srs[487]: [2022-05-13 16:08:52.215][Warn][487][0][0] transform: vhost.mix_correct to vhost.play.mix_corr
May 13 16:08:52 eyeonlinetv srs[487]: [2022-05-13 16:08:52.215][Trace][487][0] write log to console
May 13 16:08:52 eyeonlinetv systemd[1]: Started SRS.
lines 1-22/22 (END)

nginx:

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
	worker_connections 768;
	# multi_accept on;
}

http {

	##
	# Basic Settings
	##

	sendfile on;
	tcp_nopush on;
	tcp_nodelay on;
	keepalive_timeout 65;
	types_hash_max_size 2048;
	# server_tokens off;

	# server_names_hash_bucket_size 64;
	# server_name_in_redirect off;

	include /etc/nginx/mime.types;
	default_type application/octet-stream;

	##
	# SSL Settings
	##

	ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
	ssl_prefer_server_ciphers on;

	##
	# Logging Settings
	##

	access_log /var/log/nginx/access.log;
	error_log /var/log/nginx/error.log;

	##
	# Gzip Settings
	##

	gzip on;

	# gzip_vary on;
	# gzip_proxied any;
	# gzip_comp_level 6;
	# gzip_buffers 16 8k;
	# gzip_http_version 1.1;
	# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

	##
	# Virtual Host Configs
	##

	include /etc/nginx/conf.d/*.conf;
	include /etc/nginx/sites-enabled/*;
}


#mail {
#	# See sample authentication script at:
#	# http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
# 
#	# auth_http localhost/auth.php;
#	# pop3_capabilities "TOP" "USER";
#	# imap_capabilities "IMAP4rev1" "UIDPLUS";
# 
#	server {
#		listen     localhost:110;
#		protocol   pop3;
#		proxy      on;
#	}
# 
#	server {
#		listen     localhost:143;
#		protocol   imap;
#		proxy      on;
#	}
#}

ffplayout: yourowntv@eyeonlinetv:/etc/nginx/sites-enabled$ cat ffplayout.conf

server {
    listen 8085;

    server_name yourowntv.europe.cymtv.world;
access_log  /var/log/nginx/ffplayout_access.log;
error_log /var/log/nginx/ffplayout_error.log;

    gzip on;
    gzip_types text/plain application/xml text/css application/javascript;
    gzip_min_length 1000;

    charset utf-8;

    client_max_body_size 7000M; # should be desirable value

    add_header X-Frame-Options SAMEORIGIN;
    add_header X-Content-Type-Options nosniff;
    add_header X-XSS-Protection "1; mode=block";
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;

    location / {
        if ($http_origin ~ '^https?://(localhost|ffplayout\.local)') {
            add_header 'Access-Control-Allow-Origin' "$http_origin" always;
            add_header 'Access-Control-Allow-Credentials' 'true' always;
            add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
            add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always;
        }

        if ($request_method = OPTIONS ) {
            add_header 'Access-Control-Max-Age' 1728000;
            add_header 'Content-Type' 'text/plain charset=UTF-8';
            add_header 'Content-Length' 0;
            return 204;
        }

        root /var/www/ffplayout-frontend/dist/;

    }

    location ~ ^/(api|admin|auth|api-auth) {
        if ($http_origin ~ '^https?://(localhost|ffplayout\.local)') {
            add_header 'Access-Control-Allow-Origin' "$http_origin" always;
            add_header 'Access-Control-Allow-Credentials' 'true' always;
            add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
            add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always;
        }

        add_header Last-Modified $date_gmt;
        add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
        if_modified_since off;
        expires off;
        etag off;

        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 36000s;
        proxy_connect_timeout 36000s;
        proxy_send_timeout 36000s;
        proxy_buffer_size 128k;
        proxy_buffers 4 256k;
        proxy_busy_buffers_size 256k;
        send_timeout 36000s;
        proxy_no_cache 1;
        proxy_pass http://127.0.0.1:8001;

    }

    location /static/ {
        alias /var/www/ffplayout-api/ffplayout/static/;
    }
    
     location /live/ {
        alias /var/www/srs/live/;
    }

     location /preview/stream.flv {
     proxy_pass http://preview.local:8080/live/stream.flv;
}
}

ronvanherk avatar May 13 '22 14:05 ronvanherk