datarhei / restreamer

The Restreamer is a complete streaming server solution for self-hosting. It has a visually appealing user interface and no ongoing license costs. Upload your live stream to YouTube, Twitch, Facebook, Vimeo, or other streaming solutions like Wowza. Receive video data from OBS and publish it with the RTMP and SRT server.
https://docs.datarhei.com/restreamer/
Apache License 2.0
3.66k stars 430 forks source link

ffmpeg encoding error with restreamer rtmp server #517

Open gaamaaresosa opened 1 year ago

gaamaaresosa commented 1 year ago

Describe the bug In my project I use ffmpeg to encoder live camera and push the stream to Restreamer rtmp server. With in 10 to 15 minutes, some time with in 1 hour, the ffmpeg encoding stops with error.

To Reproduce Steps to reproduce the behavior:

  1. Create Restreamer on Ubuntu server on cloud
  2. Run ffmpeg on Raspberry Pi 4, encode and push rtmp stream to Restreamer server.
  3. Wait for few minutes and will see ffmpeg fails.

Expected behavior I made my Raspberry Pi 4 clients as rtmp encoder and using it for more than 1 year. The stream was sent to youtube and other Wowza/nginx rtmp server without any issues. Last 1 weeks I am going mad as my encoder fails frequently. I suspected my client and my internet and did serveral hours of testing. Finaly today I realized only major change was using our restreamer server. Again same client I used youtube rtmp server. Which is running fine without any issues for several hours now.

If you are using ffmpeg then it is expected. Please try to analize.

Screenshots ReStreamer_ffmpeg_Error

Desktop (please complete the following information):

Smartphone (please complete the following information):

Restreamer version: Release: restreamer-v2.5.0

Additional context Last few lines of ffmpeg after failed: Stream #0:0: Video: h264 (High) ([7][0][0][0] / 0x0007), yuv420p(progressive), 1920x1080, q=2-31, 2500 kb/s, 30 fps, 30 tbr, 1 k tbn Stream #0:1: Audio: aac (LC) ([10][0][0][0] / 0x000A), 48000 Hz, stereo, fltp, 128 kb/s Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) av_interleaved_write_frame(): Connection reset by peer35.65 bitrate=2639.5kbits/s speed= 1x eed=0.999x Error writing trailer of rtmp://6xx.xxx.xxx.xx9/live/e1e55078-6c05-40e1-a75e-202e05e21f2d.stream?token=stream: Connection reset b y peer frame=13672 fps= 23 q=-1.0 Lsize= 146862kB time=00:07:35.80 bitrate=2639.5kbits/s speed=0.753x video:139078kB audio:7172kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.418836% Error closing file rtmp://6xx.xxx.xxx.xx9/live/e1e55078-6c05-40e1-a75e-202e05e21f2d.stream?token=stream: Broken pipe Conversion failed! av_interleaved_write_frame(): Broken pipe Last message repeated 3 times Error writing trailer of pipe:: Broken pipe frame=13680 fps= 23 q=-0.0 Lsize= 146917kB time=00:07:36.03 bitrate=2639.1kbits/s dup=0 drop=1 speed=0.751x video:139151kB audio:7176kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.402694% Error closing file pipe:: Broken pipe [aac @ 0x43c0b7c0] Qavg: 625.308 Conversion failed!

THESE ARE Restreamer LOGS:

ffmpeg version 5.1.2-datarhei Copyright (c) 2000-2022 the FFmpeg developers built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219 configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared libavutil 57. 28.100 / 57. 28.100 libavcodec 59. 37.100 / 59. 37.100 libavformat 59. 27.100 / 59. 27.100 libavdevice 59. 7.100 / 59. 7.100 libavfilter 8. 44.100 / 8. 44.100 libswscale 6. 7.100 / 6. 7.100 libswresample 4. 7.100 / 4. 7.100 libpostproc 56. 6.100 / 56. 6.100 rtmp://localhost/live/e1e55078-6c05-40e1-a75e-202e05e21f2d.stream?token=stream: Broken pipe

@1677737973 ffmpeg version 5.1.2-datarhei Copyright (c) 2000-2022 the FFmpeg developers @1677737973 built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219 @1677737973 configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared @1677737973 libavutil 57. 28.100 / 57. 28.100 @1677737973 libavcodec 59. 37.100 / 59. 37.100 @1677737973 libavformat 59. 27.100 / 59. 27.100 @1677737973 libavdevice 59. 7.100 / 59. 7.100 @1677737973 libavfilter 8. 44.100 / 8. 44.100 @1677737973 libswscale 6. 7.100 / 6. 7.100 @1677737973 libswresample 4. 7.100 / 4. 7.100 @1677737973 libpostproc 56. 6.100 / 56. 6.100 @1677737973 rtmp://localhost/live/e1e55078-6c05-40e1-a75e-202e05e21f2d.stream?token=stream: Broken pipe

PROCESS LOG:

{ "about": { "id": "2e79abdf-ccbd-4db3-bfca-2f6eecb7ab7c", "name": "yellow-bread-3239", "created_at": "2023-02-27T14:06:21.000Z", "version": { "number": "16.12.0", "repository_commit": "431d013e3ec9a6f42d47cd168bcb9cc1ad39feed", "repository_branch": "main", "build_date": "2023-02-23T10:50:01Z", "arch": "linux/amd64", "compiler": "go1.20.1" }, "auths": [ "localjwt" ], "app": "datarhei-core", "uptime_seconds": 231160 }, "ffmpeg": { "version": "5.1.2", "compiler": "gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219", "configuration": "--extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared", "libraries": [ { "name": "libavutil", "compiled": "57. 28.100", "linked": "57. 28.100" }, { "name": "libavcodec", "compiled": "59. 37.100", "linked": "59. 37.100" }, { "name": "libavformat", "compiled": "59. 27.100", "linked": "59. 27.100" }, { "name": "libavdevice", "compiled": "59. 7.100", "linked": "59. 7.100" }, { "name": "libavfilter", "compiled": "8. 44.100", "linked": "8. 44.100" }, { "name": "libswscale", "compiled": "6. 7.100", "linked": "6. 7.100" }, { "name": "libswresample", "compiled": "4. 7.100", "linked": "4. 7.100" }, { "name": "libpostproc", "compiled": "56. 6.100", "linked": "56. 6.100" } ] }, "config": { "created_at": "2023-02-27T14:06:20.314489987Z", "version": 3, "id": "2e79abdf-ccbd-4db3-bfca-2f6eecb7ab7c", "name": "yellow-bread-3239", "address": ":8080", "update_check": true, "log": { "level": "info", "topics": [], "max_lines": 1000 }, "db": { "dir": "/core/config" }, "host": { "name": [ "[anonymized]" ], "auto": true }, "api": { "read_only": false, "access": { "http": { "allow": [], "block": [] }, "https": { "allow": [], "block": [] } }, "auth": { "enable": true, "disable_localhost": false, "username": "[anonymized]", "password": "[anonymized]", "jwt": { "secret": "[anonymized]" }, "auth0": { "enable": false, "tenants": [ "[anonymized]" ] } } }, "tls": { "address": ":8181", "enable": false, "auto": false, "email": "cert@datarhei.com", "cert_file": "", "key_file": "" }, "storage": { "disk": { "dir": "/core/data", "max_size_mbytes": 0, "cache": { "enable": true, "max_size_mbytes": 0, "ttl_seconds": 300, "max_file_size_mbytes": 1, "types": { "allow": [], "block": [ ".m3u8", ".mpd" ] } } }, "memory": { "auth": { "enable": true, "username": "[anonymized]", "password": "[anonymized]" }, "max_size_mbytes": 0, "purge": false }, "s3": [], "cors": { "origins": [ "*" ] }, "mimetypes_file": "./mime.types" }, "rtmp": { "enable": true, "enable_tls": false, "address": ":1935", "address_tls": ":1936", "app": "[anonymized]", "token": "[anonymized]" }, "srt": { "enable": false, "address": ":6000", "passphrase": "", "token": "", "log": { "enable": false, "topics": [] } }, "ffmpeg": { "binary": "ffmpeg", "max_processes": 0, "access": { "input": { "allow": [], "block": [] }, "output": { "allow": [], "block": [] } }, "log": { "max_lines": 50, "max_history": 3 } }, "playout": { "enable": false, "min_port": 0, "max_port": 0 }, "debug": { "profiling": false, "force_gc": 0, "memory_limit_mbytes": 0 }, "metrics": { "enable": false, "enable_prometheus": false, "range_sec": 300, "interval_sec": 2 }, "sessions": { "enable": true, "ip_ignorelist": [ "[anonymized]", "[anonymized]" ], "session_timeout_sec": 30, "persist": false, "persist_interval_sec": 300, "max_bitrate_mbit": 0, "max_sessions": 0 }, "service": { "enable": false, "token": "[anonymized]", "url": "https://service.datarhei.com" }, "router": { "blocked_prefixes": [ "/api" ], "routes": {}, "ui_path": "/core/ui" } }, "process": { "id": "restreamer-ui:ingest:e1e55078-6c05-40e1-a75e-202e05e21f2d", "type": "ffmpeg", "reference": "e1e55078-6c05-40e1-a75e-202e05e21f2d", "created_at": 1677511656, "config": { "id": "restreamer-ui:ingest:e1e55078-6c05-40e1-a75e-202e05e21f2d", "type": "ffmpeg", "reference": "e1e55078-6c05-40e1-a75e-202e05e21f2d", "input": [ { "id": "input_0", "address": "rtmp://[anonymized]", "options": [ "-fflags", "+genpts", "-thread_queue_size", "512", "-analyzeduration", "3000000" ] } ], "output": [ { "id": "output0", "address": "{memfs}/e1e55078-6c05-40e1-a75e-202e05e21f2d{outputid}.m3u8", "options": [ "-dn", "-sn", "-map", "0:0", "-codec:v", "copy", "-map", "0:1", "-codec:a", "copy", "-metadata", "title=http://[anonymized]", "-metadata", "service_provider=datarhei-Restreamer", "-f", "hls", "-start_number", "0", "-hls_time", "2", "-hls_list_size", "6", "-hls_flags", "append_list+delete_segments+program_date_time+temp_file", "-hls_delete_threshold", "4", "-hls_segmentfilename", "{memfs}/e1e55078-6c05-40e1-a75e-202e05e21f2d{outputid}_%04d.ts", "-master_pl_name", "e1e55078-6c05-40e1-a75e-202e05e21f2d.m3u8", "-master_pl_publish_rate", "2", "-method", "PUT" ], "cleanup": [ { "pattern": "memfs:/e1e55078-6c05-40e1-a75e-202e05e21f2d", "max_files": 0, "max_file_age_seconds": 0, "purge_ondelete": true }, { "pattern": "memfs:/e1e55078-6c05-40e1-a75e-202e05e21f2d{outputid}.m3u8", "max_files": 0, "max_file_age_seconds": 24, "purge_ondelete": true }, { "pattern": "memfs:/e1e55078-6c05-40e1-a75e-202e05e21f2d{outputid}_.ts", "max_files": 12, "max_file_age_seconds": 24, "purge_on_delete": true }, { "pattern": "memfs:/e1e55078-6c05-40e1-a75e-202e05e21f2d.m3u8", "max_files": 0, "max_file_age_seconds": 24, "purge_on_delete": true } ] } ], "options": [ "-err_detect", "ignore_err", "-y" ], "reconnect": true, "reconnect_delay_seconds": 15, "autostart": true, "stale_timeout_seconds": 30, "limits": { "cpu_usage": 0, "memory_mbytes": 0, "waitfor_seconds": 0 } }, "state": { "order": "start", "exec": "failed", "runtime_seconds": 14, "reconnect_seconds": 0, "last_logline": "rtmp://[anonymized] Broken pipe", "progress": { "inputs": [], "outputs": [], "frame": 0, "packet": 0, "fps": 0, "q": 0, "size_kb": 0, "time": 0, "bitrate_kbit": 0, "speed": 0, "drop": 0, "dup": 0 }, "memory_bytes": 0, "cpu_usage": 0, "command": [ "-err_detect", "ignore_err", "-y", "-fflags", "+genpts", "-thread_queue_size", "512", "-analyzeduration", "3000000", "-i", "rtmp://[anonymized]", "-dn", "-sn", "-map", "0:0", "-codec:v", "copy", "-map", "0:1", "-codec:a", "copy", "-metadata", "title=http://[anonymized]", "-metadata", "service_provider=datarhei-Restreamer", "-f", "hls", "-start_number", "0", "-hls_time", "2", "-hls_list_size", "6", "-hls_flags", "append_list+delete_segments+program_date_time+temp_file", "-hls_delete_threshold", "4", "-hls_segment_filename", "http://[anonymized]", "-master_pl_name", "e1e55078-6c05-40e1-a75e-202e05e21f2d.m3u8", "-master_pl_publish_rate", "2", "-method", "PUT", "http://[anonymized]" ] }, "report": { "created_at": 1677737928, "prelude": [ "ffmpeg version 5.1.2-datarhei Copyright (c) 2000-2022 the FFmpeg developers", " built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219", " configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared", " libavutil 57. 28.100 / 57. 28.100", " libavcodec 59. 37.100 / 59. 37.100", " libavformat 59. 27.100 / 59. 27.100", " libavdevice 59. 7.100 / 59. 7.100", " libavfilter 8. 44.100 / 8. 44.100", " libswscale 6. 7.100 / 6. 7.100", " libswresample 4. 7.100 / 4. 7.100", " libpostproc 56. 6.100 / 56. 6.100", "rtmp://[anonymized] Broken pipe" ], "log": [ [ "1677737928", "ffmpeg version 5.1.2-datarhei Copyright (c) 2000-2022 the FFmpeg developers" ], [ "1677737928", " built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219" ], [ "1677737928", " configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared" ], [ "1677737928", " libavutil 57. 28.100 / 57. 28.100" ], [ "1677737928", " libavcodec 59. 37.100 / 59. 37.100" ], [ "1677737928", " libavformat 59. 27.100 / 59. 27.100" ], [ "1677737928", " libavdevice 59. 7.100 / 59. 7.100" ], [ "1677737928", " libavfilter 8. 44.100 / 8. 44.100" ], [ "1677737928", " libswscale 6. 7.100 / 6. 7.100" ], [ "1677737928", " libswresample 4. 7.100 / 4. 7.100" ], [ "1677737928", " libpostproc 56. 6.100 / 56. 6.100" ], [ "1677737928", "rtmp://[anonymized] Broken pipe" ] ], "history": [ { "created_at": 1677737883, "prelude": [ "ffmpeg version 5.1.2-datarhei Copyright (c) 2000-2022 the FFmpeg developers", " built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219", " configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared", " libavutil 57. 28.100 / 57. 28.100", " libavcodec 59. 37.100 / 59. 37.100", " libavformat 59. 27.100 / 59. 27.100", " libavdevice 59. 7.100 / 59. 7.100", " libavfilter 8. 44.100 / 8. 44.100", " libswscale 6. 7.100 / 6. 7.100", " libswresample 4. 7.100 / 4. 7.100", " libpostproc 56. 6.100 / 56. 6.100", "rtmp://[anonymized] Broken pipe" ], "log": [ [ "1677737883", "ffmpeg version 5.1.2-datarhei Copyright (c) 2000-2022 the FFmpeg developers" ], [ "1677737883", " built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219" ], [ "1677737883", " configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared" ], [ "1677737883", " libavutil 57. 28.100 / 57. 28.100" ], [ "1677737883", " libavcodec 59. 37.100 / 59. 37.100" ], [ "1677737883", " libavformat 59. 27.100 / 59. 27.100" ], [ "1677737883", " libavdevice 59. 7.100 / 59. 7.100" ], [ "1677737883", " libavfilter 8. 44.100 / 8. 44.100" ], [ "1677737883", " libswscale 6. 7.100 / 6. 7.100" ], [ "1677737883", " libswresample 4. 7.100 / 4. 7.100" ], [ "1677737883", " libpostproc 56. 6.100 / 56. 6.100" ], [ "1677737883", "rtmp://[anonymized] Broken pipe" ] ] }, { "created_at": 1677737898, "prelude": [ "ffmpeg version 5.1.2-datarhei Copyright (c) 2000-2022 the FFmpeg developers", " built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219", " configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared", " libavutil 57. 28.100 / 57. 28.100", " libavcodec 59. 37.100 / 59. 37.100", " libavformat 59. 27.100 / 59. 27.100", " libavdevice 59. 7.100 / 59. 7.100", " libavfilter 8. 44.100 / 8. 44.100", " libswscale 6. 7.100 / 6. 7.100", " libswresample 4. 7.100 / 4. 7.100", " libpostproc 56. 6.100 / 56. 6.100", "rtmp://[anonymized] Broken pipe" ], "log": [ [ "1677737898", "ffmpeg version 5.1.2-datarhei Copyright (c) 2000-2022 the FFmpeg developers" ], [ "1677737898", " built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219" ], [ "1677737898", " configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared" ], [ "1677737898", " libavutil 57. 28.100 / 57. 28.100" ], [ "1677737898", " libavcodec 59. 37.100 / 59. 37.100" ], [ "1677737898", " libavformat 59. 27.100 / 59. 27.100" ], [ "1677737898", " libavdevice 59. 7.100 / 59. 7.100" ], [ "1677737898", " libavfilter 8. 44.100 / 8. 44.100" ], [ "1677737898", " libswscale 6. 7.100 / 6. 7.100" ], [ "1677737898", " libswresample 4. 7.100 / 4. 7.100" ], [ "1677737898", " libpostproc 56. 6.100 / 56. 6.100" ], [ "1677737898", "rtmp://[anonymized] Broken pipe" ] ] }, { "created_at": 1677737913, "prelude": [ "ffmpeg version 5.1.2-datarhei Copyright (c) 2000-2022 the FFmpeg developers", " built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219", " configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared", " libavutil 57. 28.100 / 57. 28.100", " libavcodec 59. 37.100 / 59. 37.100", " libavformat 59. 27.100 / 59. 27.100", " libavdevice 59. 7.100 / 59. 7.100", " libavfilter 8. 44.100 / 8. 44.100", " libswscale 6. 7.100 / 6. 7.100", " libswresample 4. 7.100 / 4. 7.100", " libpostproc 56. 6.100 / 56. 6.100", "rtmp://[anonymized] Broken pipe" ], "log": [ [ "1677737913", "ffmpeg version 5.1.2-datarhei Copyright (c) 2000-2022 the FFmpeg developers" ], [ "1677737913", " built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219" ], [ "1677737913", " configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared" ], [ "1677737913", " libavutil 57. 28.100 / 57. 28.100" ], [ "1677737913", " libavcodec 59. 37.100 / 59. 37.100" ], [ "1677737913", " libavformat 59. 27.100 / 59. 27.100" ], [ "1677737913", " libavdevice 59. 7.100 / 59. 7.100" ], [ "1677737913", " libavfilter 8. 44.100 / 8. 44.100" ], [ "1677737913", " libswscale 6. 7.100 / 6. 7.100" ], [ "1677737913", " libswresample 4. 7.100 / 4. 7.100" ], [ "1677737913", " libpostproc 56. 6.100 / 56. 6.100" ], [ "1677737913", "rtmp://[anonymized] Broken pipe" ] ] } ] } } }

ioppermann commented 1 year ago

Thanks for the extensive report.

Which cloud provider are you using? Do they impose any traffic volume or bandwidth limit? Did you try out a different cloud provider?

We are trying to reproduce this issue.

gaamaaresosa commented 1 year ago

Which cloud provider are you using?

godaddy, which is super fast and no bandwidth capping. I use nginx also on another godaddy cloud. Which is stable, but no UI. I love Restreamer UI and I can run 2 to 3 rtmp streaming server on the same cloud for testing lab.

Did you try out a different cloud provider?

No other cloud with Restreamer, but Youtube is runing fine for long duration from my same client.

gaamaaresosa commented 1 year ago

@ioppermann jstabenow As you know I am working on this for last few weeks and today again I got a clue that Restreamer rtmp server is not stable enough for 24x7 streaming. (I expect this on every ffmpeg based servers by default no proper flags set on it)

Every day I get my test results proving Restreamer rtmp server is not stable. But I should't conclude it soon. So I did several tests locally. 1) I made direct streaming from my usb captures card to Restreamer rtmp server and stops after 10 to 30mins. 2) I made piped restreaming from my usb captures card to Restreamer rtmp server and stops after 10 to 30mins. 3) I made fifo file restreaming from my usb captures card to Restreamer rtmp server and stops after 10 to 30mins. 4) Finally today I made local rtmp restreaming from my usb captures card to Restreamer rtmp server and stops after 10 to 30mins.

The intersting part is that : A) My local rtmp to preview still running smoothly for ever. B) My local rtmp to another rtmp (Wowza) server (ffmpeg) process still running smoothly for ever. C) Where as my local rtmp to Restreamer rtmp server (ffmpeg) process only stops every 10 to 30 mints.

Once this happened I can't restart immediately (ffmpeg) process as the remote Restreamer rtmp server seems busy or not ready to accept new incoming stream. After few seconds (30 os 60) I could restart (ffmpeg) process and it will run again for 10 to 30 mins.

I get below error if I keep on trying when failed for few seconds. Seems some connection issue, but I ping -t of my cloud which is success.

Press [q] to stop, [?] for help av_interleaved_write_frame(): Connection reset by peer00.00 bitrate=N/A speed= 0x [out#0/flv @ 0x1f6f4a0] Error muxing a packet [out#0/flv @ 0x1f6f4a0] Error writing trailer: Connection reset by peer frame= 1 fps=0.0 q=-1.0 Lsize= 23kB time=00:00:01.51 bitrate= 124.2kbits/s speed=45.4x video:55kB audio:22kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown Conversion failed! pi@raspberrypi:~ $

Please check some special flags need on your Restreamer rtmp server ffmpeg code.. -attempt_recovery 1 -max_recovery_attempts 20 -recover_any_error 1 -recovery_wait_time 5 -flags +global_header -flvflags no_duration_filesize -movflags +faststart

gaamaaresosa commented 1 year ago

This is my current update as on today. The issue I had pointed regarding my ffmpeg encoding stops every 10 to 30 mints And I strongly doubted your great Restreamer rtmp server.

But that may be 99% wrong. Restreamer rtmp server is always best !

I am much closer to the issues I found with ffmpeg (v5.1/v6.0) And the hopeless h264_v4l2m2m encoder. Could reproduce the issue with any other rtmp servers too.

Analazing to fix it from my side.

So there is no such issue is there with Restreamer rtmp server.

I am really sorry to suspect Restreamer rtmp server. Should I remove this post ?

ioppermann commented 1 year ago

I was also doing a test with a long running stream to the RTMP and I could stream more than 7 hours without any interruption.

OK, then the encoder seems to make some trouble.

I was about to ask you to send the stream to one of our server so we could see why the RTMP server was closing the connection. But this is not necessary anymore.

We shouldn't remove this post because it might be interesting for other who are using the h264_v4l2m2m encoder.

In case you find a working solution, please share it here.