Jump to content

ffmpeg CPU Usage


matthewul

Recommended Posts

matthewul

Hi,

 

I'm running MB server on a Lenovo ThinkServer TS140 with a quad-core Xeon E3-1225 v3, with Windows Server 2012 R2 Standard.  I'm still a bit new with configuring the media server and clients, but I noticed that Task Manager shows ffmpeg using around 50% cpu when streaming a 720p DVD rip to my browser.  It jumps to 80-90% when streaming video taken with my home video HD camcorder in 1080p and gets choppy at times.  This is just testing 1 stream at a time, not concurrent streams.  Although I'd like a server that could handle probably a max of two 720p or 1080p concurrent streams to the local network devices such as Chromecast, Roku, SmartTV, etc.

 

Is this normal for the ffmpeg process to consume so much CPU?  I thought a new quad Xeon would be able to handle at least a couple streams without problems, but it doesn't seem like that is going to be the case.  I need to check some of the transcoding settings, but they should be the defaults.  

 

Should I try running MB server on Linux?  Or should I switch to a CPU that supports hyperthreading?  I thought I read somewhere that the ffmpeg process can only utilize up to 2 cores though.

 

Anyway, thanks for any suggestions.

 

**Edit** - So I'm testing 3 concurrent streams now: 1 DVD rip to browser, 1 home video to browser, and 1 home video to Android phone, and they're all pretty smooth.  ffmpeg process is staying around 13% for CPU utilization.  Maybe the process just spikes initially then settles down.  But I'm still open to any suggestions or tweaks I could do for this type of setup.  Thanks.

Edited by matthewul
Link to comment
Share on other sites

JeremyFr79

Ok so a few things here, first is that when transcoding mbserver transcodes as much as possible as quickly as possible thus leading to actual transcoding finishing well before playback ends (of course this depends on CPU Power) Many things can effect CPU usage as well though, Bitrate of source files and bitrate of transcoded file. i.e. if you're transcoding from a high bitrate file to a lowbit rate file this will use more CPU since you're compressing the video more thus requiring more hardware.  Of course this depends on the quality settings set in MB Server as well.  What I can say from my own experience is that on my server I'm running older E-5420 CPU's (45nm 2.5Ghz Quad no hyper threading 12MB Cache 1333 bus) and I can usually transcode 3 - 4 1080p MKV's and still have room to spare on cpu usage.

Edited by JeremyFr79
Link to comment
Share on other sites

JeremyFr79

If you open the Server Interface while it's transcoding you can hover your mouse over each movie playing and it will display the FPS that it's transcoding that file at currently, as well as a progress bar for playback, and the cached transcode.

Link to comment
Share on other sites

matthewul

Thanks for the information.  As a comparison, I installed MB server on my other PC - which has an i7-2600 w/ hyperthreading, and fired up the same 3 streams to the same clients.  On the i7 computer, there are 2 ffmpeg processes that stay around 33% utilization each.  The video playback for all 3 streams seems pretty decent, but not a huge improvement (if any) over the Xeon E3-1225 cpu.  I need to dig into the settings and understand what types of files will require more transcoding, thus cpu.  I think I'd be happy if I could 2-3 HD streams on my local network.  I'm also trying to determine which formats work best for streaming different types of media (DVDs vs home videos, etc.)

Link to comment
Share on other sites

jrwalte

Also consider that on computers where you are using the web browser, can you use Media Browser Classic instead? This will skip transcoding and the computer will pull the file directly from file location instead of going through media browser server.

Edited by jrwalte
Link to comment
Share on other sites

matthewul

Thanks for the tip.  I'll try that out.  I've also setup Path Substitution for my media files, although I need to read up on it more to see which clients could take advantage of mounting a network path directly, vice streaming the content.

Link to comment
Share on other sites

  • 2 weeks later...
oldschool

Any way to take advantage of DXVA or a GPU during transcoding? I don't have an Intel chip on my current server, so I can't take advantage of the Intel solution, but the processor I have does have DXVA2, or I could stick in a decent graphics card to help out. Sometimes my processor maxes out when transcoding on my lan at anything more than 1-2MBPS 720p. Sometimes with my iPhone, I can't get anything over 360 resolution using liveTV (although I think that streams from my ServerWMC and transcodes from that machine, right)?

Link to comment
Share on other sites

  • 5 months later...

no, but you can try taking the command line from the log and changing it and running it locally.

Link to comment
Share on other sites

Concept211

no, but you can try taking the command line from the log and changing it and running it locally.

 

Awesome...thanks for the tip.

 

So I went ahead and tested it out manually and the sweet spot is:

-threads 1

The overall CPU usage hovers around 70-92% and never tops out. 

 

I tried threads 2, 3, 4 (and the default 0) and they all cause 100% usage.

 

It would be great if you could give us a config file or advanced settings interface where we can specify the number of threads to set the parameter to. I'm guessing the current config is hard-coded into the system?

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...