Skip to content
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

Deleting or clearing a crashed RTMP stream #175

Closed
shoaibmerchant opened this issue Aug 12, 2020 · 11 comments
Closed

Deleting or clearing a crashed RTMP stream #175

shoaibmerchant opened this issue Aug 12, 2020 · 11 comments
Labels
bug Confirmed as bug

Comments

@shoaibmerchant
Copy link

Describe the bug

I was testing ffmpeg -> rtmp using dshow from within my application . Below is my ffmpeg command -

ffmpeg -y -f dshow -video_size 1280x720 -rtbufsize 100M -framerate 60 -i video="Decklink Video Capture (8)" -c:v libx264 -preset veryfast -b:v 2048k -maxrate 2600k -bufsize 2600k -vf "scale=1280:-1,format=yuv420p" -g 24 -f flv rtmp://X.X.X.X/app/stream12

The streaming went on for 5 hours, but after 5 hours I get the below error on FFMPEG, which I think means that the connection is dropped

av_interleaved_write_frame(): Unknown errorime=00:00:00.76 bitrate=  46.3kbits/s speed= 1.5x
[flv @ 000002e833452800] Failed to update header with correct duration.
[flv @ 000002e833452800] Failed to update header with correct filesize.
Error writing trailer of rtmp://X.X.X.X:1935/app/stream12: Error number -10053 occurred

Now I can work around the FFMPEG error and auto-restart my application to start streaming but when I try to do now I get an error thrown from OvenMediaEngine that the stream already exists.

Based on the code I could identify that the pointer for the stream name is not cleared yet, hence the above error. I can't change stream names as they are mapped to specific devices.

Expected behavior
When the ffmpeg has crashed, OME should automatically clear the stream name and make it re-available for use. Or there should be a way to remove it.

Logs

[2020-08-12 07:09:51.811] I 31265 Provider | stream.cpp:49   | Unknown/(85) has been started stream
[2020-08-12 07:09:51.811] I 31265 RtmpProvider | rtmp_provider.cpp:93   | A RTMP client has connected from 85 - <ClientSocket: 0x7fc62c9eab90, #85, state: 4, TCP, 203.109.69.98:1242>
[2020-08-12 07:09:52.515] W 31254 RtmpProvider | rtmp_stream.cpp:520  | AmfMeta has incompatible codec information. - stream(#default#app/stream12) id(0/85) video(h264) audio(unknown)
[2020-08-12 07:09:52.979] I 31254 RtmpProvider | rtmp_application.cpp:42   | Reject #default#app/stream12 stream it is a stream with a duplicate name.
[2020-08-12 07:09:52.979] I 31254 RtmpProvider | rtmp_provider.cpp:118  | The RTMP client has disconnected: [Unknown/stream12], remote: <ClientSocket: 0x7fc62c9eab90, #85, state: 4, TCP, 203.109.69.98:1242>
[2020-08-12 07:09:52.980] I 31254 Provider | stream.cpp:55   | Unknown/stream12(85) has been stopped playing stream
[2020-08-12 07:09:52.980] E 31254 RtmpProvider | rtmp_stream.cpp:962  | Input create fail -  stream(#default#app/stream12)

Server (please complete the following information):

  • OS: Ubuntu
  • OvenMediaEngine Version: 0.10.1
  • Branch: Release

Player (please complete the following information):

  • Demo OvenPlayer
@getroot
Copy link
Sponsor Member

getroot commented Aug 18, 2020

Could you please let me know if the same problem occurs with the latest version? (0.10.7 release or master branch)

@getroot
Copy link
Sponsor Member

getroot commented Aug 18, 2020

And it is better to set bframes=0 as an option.

@nangavar
Copy link

Hi getroot!

I can confirm similar behaviour with RTMP on v0.10.7. If a RTMP stream is interrupted by a connection drop it becomes unavailable, OME does not clear it.

Hope it helps

@getroot
Copy link
Sponsor Member

getroot commented Sep 11, 2020

I kept trying to reproduce this, but couldn't.
Please help me how to reproduce it well.

@shoaibmerchant
Copy link
Author

@getroot - can you try to crash the streaming process, maybe disconnecting a camera or killing the process?

@getroot
Copy link
Sponsor Member

getroot commented Sep 11, 2020

I kept trying to reproduce this problem by killing the encoder's process, but it doesn't reproduce. And it is difficult to crash the encoder.

@getroot getroot added the bug Confirmed as bug label Sep 11, 2020
@nangavar
Copy link

In my case I found this problem during an ISP failure.

We were streaming a few streams trough RTMP, after the ISP failure we had to restart OME since all RTMP streams coming from this ISP became unavailable.
Hope it helps

@nangavar
Copy link

Maybe just try to unplug the network cable on the encoder side. The encoder should never send the stop command in order to reproduce this issue.

@getroot
Copy link
Sponsor Member

getroot commented Sep 14, 2020

I was able to reproduce the problem by unplugging the LAN cable. Thanks, I'll analyze it and fix it soon!

dimiden added a commit that referenced this issue Sep 23, 2020
@dimiden
Copy link
Member

dimiden commented Sep 23, 2020

When the network was forcibly isolated, there was a problem that the server did not recognize because the TCP keep-alive option was not turned on. This problem was resolved in c035d08.

Thank you!

@dimiden dimiden closed this as completed Sep 23, 2020
@lee-hammer99
Copy link
Member

@shoaibmerchant

Hello!
I'm the PR manager of OvenMediaEngine.
And thank you for your contribution!

I'd like to collect your experiences about the use of OvenMediaEnigne and introduce them to users.
Would you please email me at hammer99@airensoft.com?

Thank you for using OvenMediaEngine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed as bug
Projects
None yet
Development

No branches or pull requests

5 participants