Jump to content

Transcoding contines on server after you stop video on iOS


chrisoldroyd

Recommended Posts

dcrdev

Last night my server unexpectedly cut power due to overheating - I had an unusual amount of processing going on, not just Emby; but it did lead me to investigate. One thing I noticed was that at the time the server cut power there were an unusual amount of ffmpeg processes.

 

Today I've been playing around with the iOS app and I've noticed that if you put the device to sleep i.e. hit the power button - ffmpeg continues to run on the server.

Link to comment
Share on other sites

Deihmos

I was messing with this yesterday to see if it was fixed. I don't think it continues forever like it used to but stops after a while but I don't k ow exactly how long it takes to timeout. The developers are really quiet about this issue.

Link to comment
Share on other sites

I think this issue is much improved but yes there are still some scenarios that need to be worked out

Link to comment
Share on other sites

dcrdev

Just a thought here, but could you start keeping track of which pid each instance of ffmpeg spawns as and then have a listener to kill off that process when a clients websocket connection is killed?

Link to comment
Share on other sites

It's not that simple because the web socket can disconnect anytime. Then people will be reporting issues of playback randomly stopping

Link to comment
Share on other sites

Deihmos

How is it Kodi does not have this issue at all ? I installed Kodi on my iOS device and regardless of how I close it ffmpeg stops immediately.

Link to comment
Share on other sites

Angelblue05

I always found it weird the client controls when to terminate the transcode process. Would it not be easier to make the server control this aspect, maybe by associating it with the playback stopped api?

"{server}/emby/Sessions/Playing/Stopped"

With sessions, the server should already have the device Id associated and the playback method used which should be enough info to have the server terminate the transcode process. :)

Edited by Angelblue05
Link to comment
Share on other sites

How is it Kodi does not have this issue at all ? I installed Kodi on my iOS device and regardless of how I close it ffmpeg stops immediately.

 

it's not in the appstore, right? it may have capabilities that app store apps are not allowed to have, like for example, background processes (outside of ios fetch). that kind of thing gives it more ability to know when the app is closed or not. There's a lot of things that ios apps are capable of that prevent you from being able to submit to the apps store. anyway i do have something new i'm going to try for this that I think will work.

Link to comment
Share on other sites

I always found it weird the client controls when to terminate the transcode process. Would it not be easier to make the server control this aspect, maybe by associating it with the playback stopped api?

"{server}/emby/Sessions/Playing/Stopped"

With sessions, the server should already have the device Id associated and the playback method used which should be enough info to have the server terminate the transcode process. :)

 

It's not that simple. With HLS, clients download 3 seconds of video at a time. If the client stops downloading for a little while, it could be for any number of reasons, including user paused the video, or the client buffer is sufficiently full, or the app crashed. the server has no way of knowing the reason why it has stopped downloading. the app in most cases is able to know but there are other cases where it does not get notified of certain user events.

  • Like 1
Link to comment
Share on other sites

  • 2 years later...
ddurdle

Was this ever implemented.  I'm seeing my ffmpeg transcode sessions for live tv persist after stopping the stream on iOS but I'm not sure if that is because I'm using my own ffmpeg install on the server instead of the ffmpeg bundled with Emby.  I suspected Emby handles shutting down it's own ffmpeg process, but then I saw this thread exists.  Was this implemented?

Link to comment
Share on other sites

Was this ever implemented.  I'm seeing my ffmpeg transcode sessions for live tv persist after stopping the stream on iOS but I'm not sure if that is because I'm using my own ffmpeg install on the server instead of the ffmpeg bundled with Emby.  I suspected Emby handles shutting down it's own ffmpeg process, but then I saw this thread exists.  Was this implemented?

 

How are you stopping the video? If you're just closing the app then this could cause the ffmpeg process to remain running for a few minutes, and then eventually the server will realize that the app is gone.

 

If you're using the back arrow in the video player and you're still seeing this happen, then yes it could be related to your custom version.

Link to comment
Share on other sites

mrfaulk

speaking ffmpeg, this is used for transcoding only and not when using the mpv player / desktop app, right? when i use the web client both the browser (chrome or edge) and ffmpeg each show around 39% cpu usage for a combined total of almost 80% in task manager... when i use the desktop app i don't see ffmpeg at all and the mpv cpu usage is very low, playing the same file.

Link to comment
Share on other sites

mrfaulk

Correct, ffmpeg is for sever transcoding.

 

thanks.... so can ffmpeg be configured? or is that what happens when you make changes to dashboard > transcoding, i.e. you're making changes to, configuring, ffmpeg?

Link to comment
Share on other sites

ddurdle

I'm stopping the stream from the phone by hitting back.

 

How does emby communicate this to ffmpeg?  Does it send an signal interrupt?  It is most likely possible my custom ffmpeg is not detecting the signal interrupt, if one is being sent.

Link to comment
Share on other sites

ddurdle

It sends the q key code

 

Thx.  I added a piece to capture the SIGQUIT and now everything seemingly works.  When I hit the back arrow in the app, I see the ffmpeg processes exit within a few moments after.

 

Thanks again for your help.

Link to comment
Share on other sites

  • 3 weeks later...

Emby for iOS 1.5 has been released with the new video player, wake on lan, and more. Enjoy.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...