-
-
Notifications
You must be signed in to change notification settings - Fork 567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] ffmpeg exiting after 9 seconds #245
Comments
Good morning, I opened a bug report with FFMPEG the other day as I was thinking this was initially a problem with FFMPEG, but it turns out ifs a bug in the server. You can see the ffmpeg correspondence here: https://trac.ffmpeg.org/ticket/10565 One of developers uses a RTMP server called "SRS". It looks like this bug was also in SRS that was fixed very easily last nght: Here is the specific comment on the fix: Would it be possible for you to make this fix on your code so that we can properly use the -map command in ffmpeg as it's an import feature to ffmpeg and I would imagine anyone using ffmpeg with the -map option to send to your server will hit this error. Thanks! |
No, it is not a bug in the server. But I will make a workaround before it is fixed in FFmpeg. |
Fixed. Used ffmpeg command and media as you mentioned above to test:
And if you set log level above
|
Thank you very much for taking the time to look at this and put in a work around. As you saw above, I have a bug report open with ffmpeg. Could you explain what the bug is in ffmpeg and I can report that back to my open bug report and have them fix it? As you probably saw as well, the person from the ossrs RTMP server also put in a fix to address this, was his fix similar to what you did in that it's really a workaround for a bug in FFMPEG? |
FFmpeg sends a buggy AMF0 structure when
Yes. |
Hello, I would like to make a donation to your project for all of the work you do, if I send the money to the paypal account on your GitHub will that go directly to you? I integrated your code and for some reason I am still getting the error. When I run this command: ffmpeg -stream_loop -1 -re -i low.mp4 -map 0 -c copy -f flv rtmp://host/stream_key I do see your new message in our error_log: 2023/09/20 08:04:56 [warn] 2217895#2217895: *1 AMF malformed: type=0, length=4, ignored, client: 10.1.201.2, server: 0.0.0.0:1935 But right afterwards I see this: 2023/09/20 08:05:01 [error] 2217895#2217895: *1 live: drop idle publisher, client: 10.1.201.2, server: 0.0.0.0:1935 For some reason it also shows "drop idle publisher" in the logs. This is my ffmpeg which exits: av_interleaved_write_frame(): Broken pipeB time=00:00:09.64 bitrate= 22.7kbits/s speed= 1x At this point ffmpeg exits. I am running the latest ffmpeg 5 (but I tried 6 last week and it still fails). Here is our nginx: nginx version: nginx/1.24.0 My nginx config for RTMP: rtmp_auto_push on; rtmp {
... My nginx user nginx; Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.include /usr/share/nginx/modules/*.conf; events { Do you have any idea why my ffmpeg would fail but yours would work? |
This is interesting as your WARN message appears right when the ffmpeg process starts (see log at 8:42:20) and then 5 seconds later (8:42:25) the drop idle publisher appears (which I have set drop idle publisher set to 5 seconds in my config) and then about 5 seconds later ffmpeg fails almost like the server disconnected it or timed out (I have timeout set to 5 seconds as well if that has anything to do with this). 2023/09/20 08:42:20 [warn] 3899738#3899738: *1075 AMF malformed: type=0, length=4, ignored, client: 10.1.201.2, server: 0.0.0.0:1935 |
I confirmed if I comment out/remove the drop_idle_publisher the ffmpeg command does not fail so for some reason my ffmpeg command is getting killed from the server when the drop idle publisher feature is on. |
I think so. Thank you very much.
I reproduced the problem by setting:
While
is OK. Debug logs in nginx's |
Ok thanks for looking at this. I sent you money via Paypal can you confirm you received it?
From: winshining ***@***.***>
Date: Thursday, September 21, 2023 at 12:12 AM
To: winshining/nginx-http-flv-module ***@***.***>
Cc: streamingsystems ***@***.***>, Author ***@***.***>
Subject: Re: [winshining/nginx-http-flv-module] [bug] ffmpeg exiting after 9 seconds (Issue #245)
Hello,
I would like to make a donation to your project for all of the work you do, if I send the money to the paypal account on your GitHub will that go directly to you?
I think so. Thank you very much.
I integrated your code and for some reason I am still getting the error. When I run this command:
ffmpeg -stream_loop -1 -re -i low.mp4 -map 0 -c copy -f flv rtmp://host/stream_key
I do see your new message in our error_log:
2023/09/20 08:04:56 [warn] 2217895#2217895: *1 AMF malformed: type=0, length=4, ignored, client: 10.1.201.2, server: 0.0.0.0:1935
But right afterwards I see this:
2023/09/20 08:05:01 [error] 2217895#2217895: *1 live: drop idle publisher, client: 10.1.201.2, server: 0.0.0.0:1935 2023/09/20 08:05:01 [error] 2217897#2217897: *8 live: drop idle publisher, client: , server: 0.0.0.0:1935 2023/09/20 08:05:01 [error] 2217901#2217901: *14 live: drop idle publisher, client: , server: 0.0.0.0:1935 2023/09/20 08:05:01 [error] 2217898#2217898: *10 live: drop idle publisher, client: , server: 0.0.0.0:1935 2023/09/20 08:05:01 [error] 2217896#2217896: *5 live: drop idle publisher, client: , server: 0.0.0.0:1935 2023/09/20 08:05:01 [error] 2217899#2217899: *11 live: drop idle publisher, client: , server: 0.0.0.0:1935 2023/09/20 08:05:01 [error] 2217900#2217900: *15 live: drop idle publisher, client: , server: 0.0.0.0:1935 2023/09/20 08:05:01 [error] 2217894#2217894: *4 live: drop idle publisher, client: , server: 0.0.0.0:1935
For some reason it also shows "drop idle publisher" in the logs.
This is my ffmpeg which exits:
av_interleaved_write_frame(): Broken pipeB time=00:00:09.64 bitrate= 22.7kbits/s speed= 1x [flv @ 0x7fbfa8007a00] Failed to update header with correct duration. [flv @ 0x7fbfa8007a00] Failed to update header with correct filesize. Error writing trailer of rtmp://**** (my stream key) : Broken pipe frame= 306 fps= 30 q=-1.0 Lsize= 30kB time=00:00:10.08 bitrate= 24.0kbits/s speed= 1x video:433kB audio:396kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown Error closing file rtmp://**** (my stream key): Broken pipe Conversion failed!
I reproduced the problem by setting:
drop_idle_publisher 5s;
While
drop_idle_publisher 15s;
is OK.
Debug logs in nginx's error.log showed that FFmpeg indeed didn't send any messages in 5s after malformed AMF was sent.
[drop_idle_publiser_011036]<https://user-images.githubusercontent.com/3250905/269492615-f5e061fd-b9d8-4015-ae39-0ffd26fe45bc.png>
—
Reply to this email directly, view it on GitHub<#245 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AOI5PRK3FZYDMZTXXRNRE3DX3PEDPANCNFSM6AAAAAA434E3PA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Sorry to come back after a long time. |
***@***.***
From: winshining ***@***.***>
Date: Thursday, September 28, 2023 at 10:36 PM
To: winshining/nginx-http-flv-module ***@***.***>
Cc: streamingsystems ***@***.***>, Author ***@***.***>
Subject: Re: [winshining/nginx-http-flv-module] [bug] ffmpeg exiting after 9 seconds (Issue #245)
Ok thanks for looking at this. I sent you money via Paypal can you confirm you received it? From: winshining @.> Date: Thursday, September 21, 2023 at 12:12 AM To: winshining/nginx-http-flv-module @.> Cc: streamingsystems @.>, Author @.> Subject: Re: [winshining/nginx-http-flv-module] [bug] ffmpeg exiting after 9 seconds (Issue #245<#245>) Hello, I would like to make a donation to your project for all of the work you do, if I send the money to the paypal account on your GitHub will that go directly to you? I think so. Thank you very much. I integrated your code and for some reason I am still getting the error. When I run this command: ffmpeg -stream_loop -1 -re -i low.mp4 -map 0 -c copy -f flv rtmp://host/stream_key I do see your new message in our error_log: 2023/09/20 08:04:56 [warn] 2217895#2217895: 1 AMF malformed: type=0, length=4, ignored, client: 10.1.201.2, server: 0.0.0.0:1935 But right afterwards I see this: 2023/09/20 08:05:01 [error] 2217895#2217895: 1 live: drop idle publisher, client: 10.1.201.2, server: 0.0.0.0:1935 2023/09/20 08:05:01 [error] 2217897#2217897: 8 live: drop idle publisher, client: , server: 0.0.0.0:1935 2023/09/20 08:05:01 [error] 2217901#2217901: 14 live: drop idle publisher, client: , server: 0.0.0.0:1935 2023/09/20 08:05:01 [error] 2217898#2217898: 10 live: drop idle publisher, client: , server: 0.0.0.0:1935 2023/09/20 08:05:01 [error] 2217896#2217896: 5 live: drop idle publisher, client: , server: 0.0.0.0:1935 2023/09/20 08:05:01 [error] 2217899#2217899: 11 live: drop idle publisher, client: , server: 0.0.0.0:1935 2023/09/20 08:05:01 [error] 2217900#2217900: 15 live: drop idle publisher, client: , server: 0.0.0.0:1935 2023/09/20 08:05:01 [error] 2217894#2217894: 4 live: drop idle publisher, client: , server: 0.0.0.0:1935 For some reason it also shows "drop idle publisher" in the logs. This is my ffmpeg which exits: av_interleaved_write_frame(): Broken pipeB time=00:00:09.64 bitrate= 22.7kbits/s speed= 1x [flv @ 0x7fbfa8007a00] Failed to update header with correct duration. [flv @ 0x7fbfa8007a00] Failed to update header with correct filesize. Error writing trailer of rtmp:// (my stream key) : Broken pipe frame= 306 fps= 30 q=-1.0 Lsize= 30kB time=00:00:10.08 bitrate= 24.0kbits/s speed= 1x video:433kB audio:396kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown Error closing file rtmp:// (my stream key): Broken pipe Conversion failed! I reproduced the problem by setting: drop_idle_publisher 5s; While drop_idle_publisher 15s; is OK. Debug logs in nginx's error.log showed that FFmpeg indeed didn't send any messages in 5s after malformed AMF was sent. [drop_idle_publiser_011036]https://user-images.githubusercontent.com/3250905/269492615-f5e061fd-b9d8-4015-ae39-0ffd26fe45bc.png — Reply to this email directly, view it on GitHub<#245 (comment)<#245 (comment)>>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOI5PRK3FZYDMZTXXRNRE3DX3PEDPANCNFSM6AAAAAA434E3PA. You are receiving this because you authored the thread.Message ID: @.**>
Sorry to come back after a long time.
No, I haven't received anything. I don't know why.
—
Reply to this email directly, view it on GitHub<#245 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AOI5PRMDD4V4C3EBPWWXJWDX4Y63BANCNFSM6AAAAAA434E3PA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
* [fix] fixed a crash bug resulted from 'reload' * [fix] fixed 'proxy protocol not working' bug. * [fix] fixed a typo. * [fix] fixed an endian bug in mp4 vod. * [fix] worked around the buggy option `-map` in FFmpeg. * [fix] refactored (winshining#245) and fixed a compilation error on Mac.
We are playing a MP4 file from the filesystem from ffmpeg to this module. After 9.62 seconds (on Frame 307) ffmpeg exits due to the server having a problem. I went through the server logs in debug mode and could not see any errors.
We are using ffmpeg 5 but this also happens on ffmpeg 6.
When we run this same command against Wowza the error does not happen and the file continues infinitely from ffmpeg (because it's set to loop).
This is the error from ffmpeg:
av_interleaved_write_frame(): Broken pipeB time=00:00:09.62 bitrate= 22.7kbits/s speed= 1x
[flv @ 0x7f8352907d80] Failed to update header with correct duration. 26.1kbits/s speed= 1x
[flv @ 0x7f8352907d80] Failed to update header with correct filesize.
Expected behavior (期望行为)
It should just continue to play like Wowza does.
Actual behavior (实际行为)
It fails after 9.62 seconds.
OS and Nginx version (操作系统和 Nginx 版本号)
Centos, nginx version: nginx/1.24.0
Configuration file (配置文件)
We are investing RTMP and have HLS turned on and are creating 10s TS files. I can get you the config if needed.
Steps to reproduce the behavior (复现问题步骤)
This is very easy to reproduce:
If you download this file:
https://www.dropbox.com/scl/fi/5ybita2l41tr7tyhzgy25/low.mp4?rlkey=gzahw6wp6soytuyc2185zs4ef&dl=0
If you unzip this file you will have "low.mp4".
And then run this command:
ffmpeg -stream_loop -1 -re -i low.mp4 -map 0 -c copy -f flv rtmp://127.0.0.1:1935/
You will notice ffmpeg will exit.
Error log if any (错误日志)
The text was updated successfully, but these errors were encountered: