begeekmyfriend / yasea

RTMP live streaming client for Android
MIT License
4.86k stars 1.32k forks source link

Heavy pixelated video #860

Open tolew1 opened 1 year ago

tolew1 commented 1 year ago

I am using Nginx RTMP and transcoding my stream into other qualities but for some reason I get pixelated output. It user to work fine and I don't know what's wrong now. Any idea what could be causing this?

My server works fine if I use OBS or some other kind of encoder.

Phone: PIXEL 6a NGINX 1.18.0

nginx settings

server {
                        listen 2935; # Listen on standard RTMP port
                        listen 2936 proxy_protocol;
                        chunk_size 4096;
                        #buflen 2000ms;

                        # This application is to accept incoming stream

                        application public {
                                notify_method get;
                                live on; # Allows live input
                                idle_streams off;
                                interleave on;
                                on_publish http://127.0.0.1:4443/crons/broadcast.php;
                                on_update http://127.0.0.1:4443/crons/broadcast.php;
                                on_publish_done http://127.0.0.1:4443/crons/broadcast.php;

                                exec_push ffmpeg -i rtmp://localhost:2935/$app/$name -c:a libfdk_aac -b:a 92k -c:v libx264 -b:v 768k -force_key_frames:v 'expr:gte(t,n_forced*2)' -preset superfast -pix_fmt yuv420p -tune zerolatency -f flv rtmp://localhost:2935/hls/$name_mid -c:a libfdk_aac -b:a 128k -c:v libx264 -b:v 1152k -force_key_frames:v 'expr:gte(t,n_forced*2)' -preset superfast -pix_fmt yuv420p -tune zerolatency -f flv rtmp://localhost:2935/hls/$name_hi -c:a libfdk_aac -b:a 128k -c:v libx264 -b:v 2252k -force_key_frames:v 'expr:gte(t,n_forced*2)' -preset superfast -pix_fmt yuv420p -tune zerolatency -f flv rtmp://localhost:2935/hls/$name_hd720 -c:a libfdk_aac -b:a 128k -c:v libx264 -b:v 3072k -force_key_frames:v 'expr:gte(t,n_forced*2)' -preset superfast -pix_fmt yuv420p -tune zerolatency -f flv rtmp://localhost:2935/hls/$name_hd1080 -vf fps=1/6 -ss 00:00:01.000 -vframes 1 /data/broadcast/preview/$name.jpeg -c:v copy -c:a copy -tune zerolatency -pix_fmt yuv420p -hls_flags single_file -hls_segment_type fmp4 -hls_list_size 0 -f hls /data/broadcast/rec/public/$name.m3u8 2>>/usr/local/nginx/logs/ffmpeg-$name.log;
                        }

                         application hls {
                                live on;
                                hls on; # Enable HTTP Live Streaming
                                hls_fragment 2s;
                                hls_nested off;
                                hls_playlist_length 6s;
                                hls_cleanup on;
                                hls_continuous on;

                                # Pointing this to an SSD is better as this involves lots of IO
                                hls_path /data/broadcast/public;
                                hls_variant _mid BANDWIDTH=768000;
                                hls_variant _hi  BANDWIDTH=1152000;
                                hls_variant _hd720 BANDWIDTH=2252000;
                                hls_variant _hd1080 BANDWIDTH=3072000;
                        }

                }

image