Jump to content


Photo

transcoding, seeking and orphan ffmpeg processes consuming CPU

transcode transcoding ffmpeg cpu

  • Please log in to reply
5 replies to this topic

#1 lifespeed OFFLINE  

lifespeed

    Advanced Member

  • Members
  • 465 posts
  • Local time: 02:48 PM
  • LocationSan Jose, CA, USA

Posted 23 June 2017 - 05:55 PM

I am CPU transcoding to Android mobile client over the internet (LTE).  When I seek using the scrub bar server CPU utilization goes from 90% to 100% and stays there for at least several minutes.  When I look at the running processes in task manager, I see a second ffmpeg process was started, I presume to support transcoding from the new seek location.  Yet the previous ffmpeg process was not shut down - the two ffmpeg processes are hogging 100% CPU, at 50% each.  When I stop playing the Android client one ffmpeg process stops, while the second ffmpeg lingers at 10% CPU for several minutes before terminating.

 

I did check transcoding without seeking through the movie, in this case the server and transcoding are well behaved with ffmpeg using the typical 90% CPU (i7-6800K, slow and 22 quality settings).  If I stop playing at the client, the single ffmpeg process terminates immediately.

 

It seems the server would be much more responsive if the unneeded second ffmpeg process were terminated promptly.  I suspect this unnecessary server load is degrading the user experience.  Perhaps it is not that hard to track down and resolve?  Please let me know if there is anything further I can do to help troubleshoot besides the attached logs.  Android client is 3.8.x.x beta within the past two days, not sure where to find the version number in the app.

 

Thanks!

Attached Files



#2 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 153470 posts
  • Local time: 05:48 PM

Posted 23 June 2017 - 11:31 PM

Why do you think they were orphan processes? Each time you seeked, these showed up in the server log:

2017-06-23 14:35:04.1815 Info App: Stopping ffmpeg process with q command for C:\Users\Clay\AppData\Roaming\Emby-Server\transcoding-temp\b2ba8e65f5316701ad403d4ec460c994.mkv
2017-06-23 14:35:04.9697 Info App: FFMpeg exited with code 0


#3 lifespeed OFFLINE  

lifespeed

    Advanced Member

  • Members
  • 465 posts
  • Local time: 02:48 PM
  • LocationSan Jose, CA, USA

Posted 24 June 2017 - 02:39 AM

 

Why do you think they were orphan processes? Each time you seeked, these showed up in the server log:

2017-06-23 14:35:04.1815 Info App: Stopping ffmpeg process with q command for C:\Users\Clay\AppData\Roaming\Emby-Server\transcoding-temp\b2ba8e65f5316701ad403d4ec460c994.mkv
2017-06-23 14:35:04.9697 Info App: FFMpeg exited with code 0

When I stopped play in the client without seeking, ffmpeg on the server shut down instantly.  When I seeked, a second ffmpeg process would start, and the first would stay running for several minutes.  I am assuming that there should not be two ffmpeg processes running for a long time, certainly this maxes the CPU.

 

Have you tried reproducing this?  It is easy for me to recreate, but I don't know if it happens across all windows 10 Emby server and Android mobile client setups.



#4 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 153470 posts
  • Local time: 05:48 PM

Posted 24 June 2017 - 01:41 PM

I cannot reproduce it, no. When I seek the first one is terminated quickly.



#5 lifespeed OFFLINE  

lifespeed

    Advanced Member

  • Members
  • 465 posts
  • Local time: 02:48 PM
  • LocationSan Jose, CA, USA

Posted 24 June 2017 - 10:30 PM

If I use an iPad instead of Android mobile, both set to 1080p 5Mbps stream rate in the client, there is no second ffmpeg process on the server bogging down the CPU while seeking.  In fact, when using the iPad client the CPU utilization is about 60% compare to 90% for the android client even though the same bitrate is requested.

 

The second ffmpeg process runs for about 5 minutes before stopping.  Maybe this is related to the something in the android client?



#6 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 153470 posts
  • Local time: 05:48 PM

Posted 25 June 2017 - 03:43 PM

Thanks for the feedback. We will do more testing.







Also tagged with one or more of these keywords: transcode, transcoding, ffmpeg, cpu

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users