Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Isolate FFMPEG on a dedicated CPU
12-01-2020, 17:13
Post: #1
Isolate FFMPEG on a dedicated CPU
Hi Simon,

I'm still working on tests with Minimserver and Linux, with the main purpose to test anything I'm think about.

Recently, after having installed a RT kernel, fix CPU freq and latency using frequtils, I got a real improvement on the sound.

Today I tried to use taskset to assign specific CPUs to minimserver and ffmpg.

So I had "isolcpus=2,3" to grub conf reserve the 2 last cores of my CPU to this purpose.
Then it was easy to set minimserver to use cpu 3 using "taskset -cp 3 MinimServer_ID"

Problems comes when I wanted to dedicate cpu 2 to ffmpeg. Because ffmpeg is launched at each song, with a different ID each time.

so I'd like to know if there is way to force ffmpeg to always use CPU2, whatever happen ?

Also, I didn't look at the way to get minim running on CPU 3 at each boot. Is this possible ?

Last thing : do you think that this is the right thing to do ?

Thank,
Manu
Find all posts by this user
Quote this message in a reply
12-01-2020, 17:33 (This post was last modified: 12-01-2020 17:35 by lafuente.)
Post: #2
RE: Isolate FFMPEG on a dedicated CPU
Per default, when minimserver run on an "affected" CPU, FFMPEG sometime use the same core due to it PPID. If I assign 2 CPUs to minim, FFMPEG still use the same CPU than Minim, or not...

Maybe can I "pass" an option from minim when it launch FFMPEG ?
Find all posts by this user
Quote this message in a reply
12-01-2020, 17:42
Post: #3
RE: Isolate FFMPEG on a dedicated CPU
From a quick look at the taskset commend, you can use it to change the affinity of a running process, so you could try changing the affinity of the ffmpeg process while it is transcoding a song to see if you can hear any difference between running FFmpeg on the same CPU as MinimServer and running FFmpeg on a different CPU. If the song is quite long, you can switch back and forth to confirm your impressions. I think this should be the first step before trying anything else.

I think it is possible that processor affinity might make a difference to sound quality and I think it is useful for you to try these experiments.
Find all posts by this user
Quote this message in a reply
12-01-2020, 18:45 (This post was last modified: 12-01-2020 18:48 by lafuente.)
Post: #4
RE: Isolate FFMPEG on a dedicated CPU
Thank Simon,

I must admit that there is no gap here. I will test at a colleague home because he have a better audio system than mine. Mine is correct, but not high-end.

The fixed processor speed is more noticeable with his system than with mine. So maybe the CPUs affectation is the same...

I'll update the post when I'll fixed about this.

Last : to allow the CPU choice to be fixed at startup without typing any command line, I have to add

Code:
[Service]
CPUAffinity=3

to the miniserver service script. Where do I need to add this please ?

Regards,
Manu
Find all posts by this user
Quote this message in a reply
12-01-2020, 19:25
Post: #5
RE: Isolate FFMPEG on a dedicated CPU
Correction : I didn't apply the correct CPU isolation at begining of the tests.

Using it in the correct way improve sound (not many, but anything is good to grab).

Difficult to me to explain the impress in English, but the flow is more soft...
Find all posts by this user
Quote this message in a reply
12-01-2020, 22:45
Post: #6
RE: Isolate FFMPEG on a dedicated CPU
The service file is located at /usr/lib/systemd/system/minimserver.service
Find all posts by this user
Quote this message in a reply
13-01-2020, 13:31
Post: #7
RE: Isolate FFMPEG on a dedicated CPU
(12-01-2020 22:45)simoncn Wrote:  The service file is located at /usr/lib/systemd/system/minimserver.service

In my debian 10, there is not such a file at this location. If I use "find" I have files here :

Code:
root@audio:/usr/lib/systemd/system# find / -name minimserver.service

/sys/fs/cgroup/memory/system.slice/minimserver.service
/sys/fs/cgroup/devices/system.slice/minimserver.service
/sys/fs/cgroup/systemd/system.slice/minimserver.service
/sys/fs/cgroup/unified/system.slice/minimserver.service
/run/systemd/generator.late/minimserver.service
/run/systemd/generator.late/graphical.target.wants/minimserver.service
/run/systemd/generator.late/multi-user.target.wants/minimserver.service
Find all posts by this user
Quote this message in a reply
13-01-2020, 13:52
Post: #8
RE: Isolate FFMPEG on a dedicated CPU
How did you enable automatic startup for MinimServer? If you do this using the minimserver/bin/setup command on a system that supports systemd, it should put a minimserver.service file at the location I described.
Find all posts by this user
Quote this message in a reply
13-01-2020, 14:10
Post: #9
RE: Isolate FFMPEG on a dedicated CPU
I think I used "startc" script rather than "setup". Unsure...
Find all posts by this user
Quote this message in a reply
13-01-2020, 14:13
Post: #10
RE: Isolate FFMPEG on a dedicated CPU
(13-01-2020 14:10)lafuente Wrote:  I think I used "startc" script rather than "setup". Unsure...

I redo my setup and confirm that I used ./setup
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)