ffmpeg won't max CPU usage in jail

rudds

Dabbler
Joined
Apr 17, 2018
Messages
34
I'm using a jail in FreeNAS 11.3 to run an instance of ffmpeg as a listen server, which ingests a video feed over the LAN from my Windows machine and then both writes the feed out to file and also compresses it to send to Twitch.tv. This generally works fine, except that with higher bitrate source footage and a heavier encoder preset (i.e. more CPU workload, higher quality image), ffmpeg isn't able to encode fast enough to output the stream to Twitch in real time, causing the stream to pause frequently to buffer.

What's confusing me is that according to htop, ffmpeg isn't using anywhere near the max amount of available CPU. You can see this in action below (the machine is an i7 6700K with 16GB of memory), with the CPU's logical cores seeming to hover around 50-60% usage while the output speed at the bottom is well under 1x.

unknown.png


Presumably if ffmpeg was utilizing all available CPU resources it would do a better job keeping up with the input feed and streaming it out smoothly. I considered that network throughput might be the bottleneck here, but switching to a lighter encoding preset (i.e. less CPU workload) it was able to stream out the same source footage steadily, and the highest quality stream I've sent from the source is only about 5 MB/s anyway, which really doesn't seem like it should be hitting some kind of transfer ceiling.

Is there a reason ffmpeg might not be able to access all available compute headroom, perhaps some kind of arbitrary resource limit or process priority issue imposed by the jail system?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Top