Jump to content

FFMPEG at 50-60% of 10-core CPU whenever I launch a new recording


sward
 Share

Recommended Posts

sward

Why is FFMPEG running at 50-60% utilization on my 10-core CPU whenever I launch a new recording, and is there a way to prevent that? Seems to last 5-6 minutes for a one hour recording.

Link to comment
Share on other sites

HI, if it has to be transcoded to play then this might be normal. Are you trying to play in the web app?

Link to comment
Share on other sites

sward

There is no need for transcoding - most of my recordings are 1080i MPEG2 transport streams, and I use the Windows 10 Emby Theater app to play them back. But this behavior seems to occur regardless of video format. It needs to stop.

Link to comment
Share on other sites

Hi, is this purely a DVR recording with no one watching it?  The only reason I would think you should see a spike like that in ffmpeg is if the stream needs converting.

If you like PM me the m3u file you're using as well as a specific channel number or two you see this with and I'll try it on a test server to duplicate your results and determine for you why this happens and if possible how to avoid it.

If I can't duplicate what you see then we can setup a remote session to get a better look on your system.

Carlo

Link to comment
Share on other sites

10 hours ago, sward said:

There is no need for transcoding - most of my recordings are 1080i MPEG2 transport streams, and I use the Windows 10 Emby Theater app to play them back. But this behavior seems to occur regardless of video format. It needs to stop.

Hi there @sward, if it is transcoding, have you explored the stats feature in the video player to learn why it was transcoding?

Link to comment
Share on other sites

sward

@Luke - I have not explored the stats feature. How would I do that?

@cayars - this spike in ffmpeg happens when playing any DVR recording locally via the Windows 10 Emby Theater app. No streaming is taking place. Does Emby Theater need to transcode 1080i MPEG2 transport stream files? I could perhaps do a remote session tomorrow (Wednesday) afternoon at 6PM EST if that works for you.

Link to comment
Share on other sites

Quote

I have not explored the stats feature. How would I do that?

Click the gear icon in the video player, then stats for nerds. Let us know what it says.

Link to comment
Share on other sites

sward

OK - that explains it, it's transcoding b/c of "unsupported container" which in my case is wtv files. This is surprising since the video content is still plain old MPEG2. Any chance of supporting wtv files natively? They contain a lot more metadata than ts files (which basically contain no metadata).

Link to comment
Share on other sites

 

Here's a few examples of playing back and NFL game I recorded Sunday in a couple clients.

Chrome Web Browser
image.png.7a6e7721e8f7c964b37835fc6c0858ac.png

Windows Theater Store version
image.png.d12b7cbad45372ef3ff548811689fcd4.png

Emby Theater for Desktop
image.png.e6487af4f7d9fe2c854291356003cd48.png

As you can see for my quick tests the Desktop version of Emby Theater is more robust and can direct play the video.

So I'm going to recommend if you haven't tried the Desktop version to give this a try as it might be a better solution for you.

https://emby.media/emby-theater.html

Can you give that a try and let us know how you make out?

Link to comment
Share on other sites

sward

So I tried the desktop version of Emby Theater, and you are correct that it doesn't need to transcode, however CPU utilization remains at ~15% for the duration of video playback, as I'm unable to enable hardware acceleration despite selecting "gpu" as my video output, and "D3D" as my hardware acceleration mode. I'm therefore left with the following choice: using Emby Theater app which needs to transcode for 5 minutes at 60% utilization (after which utilization drops to ~1%), or using desktop version of Emby Theater which doesn't need to transcode, but uses ~15% of my CPU for the duration of playback. Any chance of switching to VLC player which doesn't have these (and other) issues?

Link to comment
Share on other sites

Doesn't seem like there is much to think about based on that info as the Desktop version is much better than the store version for Live TV.

Are you running Theater desktop on the server machine? Is your server already setup to use the GPU for transcoding to clients?
If so you might not be able to share the GPU with both the server and a client.

You can use VLC or any other player in Theater for Desktop if you like.
You won't have the OSD (on screen display) of course like you would in the Emby Player but you can certainly do this pretty easily.
image.png.5d9f7d6de43bdd2a128c6b1b2a6069e6.png

Link to comment
Share on other sites

sward

I definitely want the OSD, so that rules out VLC.

Regarding the desktop version of Emby Theater, I played around with it some more and discovered that HW acceleration works but only with H.264 recordings. I can't get it to work with MPEG2 recordings, which are the vast majority of my recordings. Any ideas why?

Regarding the store version, I read elsewhere on the forums that it uses WMP as the underlying player, yet WMP can play wtv files natively (i.e. without transcoding), whereas the store version of Emby Theater cannot. Why is that?

Link to comment
Share on other sites

It's a Microsoft provided player. We are working on unifying the two though and will ultimately have the best of both.

Link to comment
Share on other sites

HW acceleration should work for any video type your hardware supports.
MPEG2 isn't an advanced codec and isn't compressed like AVC or HEVC so there really isn't much to assist with in GPU.

Theater for desktop can direct play DVR recordings just fin. This is playing back an NFO football game.

image.png.28b9c3713eaab29a8e028099b1140255.png

Link to comment
Share on other sites

GrimReaper

Phew, luckily you know that FPS to the 14th decimal. And that Aspect Ratio on 16th decimal surely comes in handy (yes, I counted them 🤭). Can't imagine what would one do without that. 😉

Edited by GrimReaper
Typo
  • Haha 1
Link to comment
Share on other sites

Can't make this guy jealous image.png.44528ec5166177faff917b09f2f3544b.png :)

Gotta have those decimal places. LOL

I think aspect ratio could be rounded to 2 decimal places and fps at 1.
Would make it a little cleaner looking.

  • Agree 1
Link to comment
Share on other sites

sward

@cayarsYour screenshot clearly shows "hardware acceleration: no" during MPEG2 direct play, so you have the same issue.

@LukeWhen you unify the two (Microsoft?) players, will you support wtv natively? 

Link to comment
Share on other sites

1 hour ago, sward said:

@cayarsYour screenshot clearly shows "hardware acceleration: no" during MPEG2 direct play, so you have the same issue.

@LukeWhen you unify the two (Microsoft?) players, will you support wtv natively? 

Yes it will be.

Link to comment
Share on other sites

6 hours ago, sward said:

@cayarsYour screenshot clearly shows "hardware acceleration: no" during MPEG2 direct play, so you have the same issue.

Doesn't really matter. I manually selected libmpv vs auto or GPU.

image.png.4d9293f1f1e436b35f23f7a51d401f23.png

Link to comment
Share on other sites

BTW, with the store version I can direct play TS files that were already recorded.
image.png.948206e0de50f4312c58ccfc890065b6.png

For live TV with the store version I can't direct play.

Link to comment
Share on other sites

sward

@cayars I agree - according to your screenshots MPEG-2 hardware acceleration isn't working regardless of whether you select gpu or libmpv, which confirms what I'm experiencing with the desktop version of Emby Theater. More to come on this after I've conducted some additional testing this evening, but it appears to be unrelated to container type...

Link to comment
Share on other sites

sward

So here are my findings after conducting some additional testing this evening:

Emby Theater desktop version: uses HW acceleration for H.264 content, but not MPEG-2 content or HEVC 4k content. These results hold true regardless of container type (i.e. holds true for both wtv and ts files).

Emby Theater Windows store app: in this case behavior seems to be completely driven by container type. I can direct play MPEG-2, H.264 and HEVC 4k ts files. With this player there's no "hardware acceleration" entry in stats for nerds, but judging from 3-4% CPU utilization, it appears to be using HW acceleration. However all wtv files require transcoding; this holds true for both MPEG-2 and H.264. I don't currently have any HEVC 4k wtv files, but assume that transcoding would likewise take place.

BTW, I don't see Intel QuickSync as an option under Video HW acceleration types, although it is listed as an option in the transcoding section.

Link to comment
Share on other sites

That is actually not correct as it will depend on your specific setup.

Here's an example of HEVC playback with option set to GPU mode.
image.png.cf5456801d14f46b2644e3a17b25bc36.png

image.png.1eb97616a74047a41ade169c37c2bdc9.png

Here you can see it using the hardware decoder as well.

Now get this.  I change the option to AUTO and it auto selected libmpv

image.png.5e75f91539bc9144df869fb635ce3047.png

image.png.2db1e8a198150f240f825bc5bafed832.png

However it's using more resources on my system this way.  Could be different on someone else's computer.
That is why I set Desktop Theater on my notebook to GPU mode.

MPEG2 is simple codec compared to AVC or HEVC and doesn't need decode assistance.

Link to comment
Share on other sites

sward

"MPEG2 is simple codec compared to AVC or HEVC and doesn't need decode assistance." Then why is playback of MPEG-2 achieving 15% utilization of my Core i9-11900 CPU? Furthermore, seems to me that if your system supports HW acceleration for H.264, it should also support HW acceleration for MPEG-2 since it is less complex as you correctly pointed out. BTW the vast majority of cable broadcasts are still using MPEG2, and since I have a cable-card recorder, that means most of my recordings are MPEG2. 

Link to comment
Share on other sites

Because the CPU has work to do handling any video moving it around the different busses perhaps?

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
 Share

×
×
  • Create New...