I don’t know which to blame here, whether its VLC or the PulseAudio sound server’s fault or something else. Because whenever I’m playing a multimedia file in VLC (noticed it while using the newly installed Linux Mint 14 Cinnamon), according to the system monitor, the ‘PulseAudio’ process uses unnecessary amount of CPU cycles.
For example, if I were playing an audio file, then ‘PulseAudio’ uses even higher CPU cycles than VLC does!, despite the fact that it is VLC that is doing the decoding etc, therefore it should be the one that uses most of the CPU.
If I were playing a video, then VLC’s CPU usage goes higher than ‘PulseAudio’ process, and it is to be expected as playing both a video and audio codec requires more CPU power. But still, if I were to play the same file using another player such as ‘Totem’ then PulseAudio is using very little of the CPU.
I have an Intel Core i3-2330M CPU, and while using VLC, PulseAudio uses about 2-3% of total CPU power, where PulseAudio with ‘Totem’, only uses about 0.5%. If you have a powerful processor then this might not be a big deal. But if you are using something like a netbook, where the CPU isn’t really that powerful, then its effect might be even higher.
Note (Concerning the above image): like me, if you too have multiple CPU cores, then you should divide the CPU readings here, by the total number of cores to get the actual load on your CPU (more below) …
So as a way of fixing it, just out of curiosity, I changed the audio output to ‘ALSA’, restarted VLC and then played the same file (s) and it seems to have fixed the issue for me. If you think you are too having something similar, then follow the below steps.
Fixing the issue
Perhaps it is specific to my audio hardware, nevertheless, if you are someone who uses VLC heavily, then you can first identify whether you are having the same issue or not by using the below method.
Open your Terminal window and enter the below command (I’m using Linux Mint 14 but this tool comes installed by default with almost all distributions).
top -d 1
‘top’ is a simple but a powerful system monitor that (as the name denotes) lists the processes that consume most of your CPU. And by using it, we can easily see the CPU usage of ‘VLC’ and ‘PulseAudio’ processes, as they should be listed somewhere closer to the top on its list.
Then also open VLC and start playing something (video or an audio). Now as VLC plays the file, switch over to the ‘top’ utility and observe the CPU usage of the two processes called ‘vlc’ and ‘pulseaudio’ (as shown in the first screenshot).
Note: As mentioned above, if your processor have multiple cores, then please remember that in order to get the actual load when compared to your total CPU power, you have to divide the CPU reading of the process by the number of CPU cores that you have. As for me, because I have 4 cores, I have to divide whatever the CPU reading ‘top’ shows for a process by ‘4’.
Assuming that now you have a general idea of the CPU usage of ‘pulseaudio’ process, let’s us apply this ‘tweak’ and see if it decreases its CPU usage. If after applying the tweak, it does not decrease the CPU usage dramatically (when compared to the previous reading), then you know that you are not ‘affect’ by it, and can leave it with the original setting.
Now, again switch over to ‘VLC’ and from its menu go to: ‘Tools’ -> ‘Preferences’.
Then from the next window, click on the ‘Audio’ tab. Now under the sub heading ‘Output’ -> ‘Output module’: click on the drop-down menu and choose ‘ALSA audio output’ as shown below.
Now click on the ‘Save’ button at the bottom, and also close VLC as well.
Now reopen that same file with VLC and as it plays it, again switch over to ‘top’ utility and re-observe the CPU usage of ‘pulseaudio’. And as mentioned above, if you see a big reduction (also this case), then you know that now it’s fixed :).
Note: If someone is wondering, why ‘pulseaudio’ is running, even after selecting ‘ALSA’, then that is because, unless you have completely removed it, ‘PulseAudio’ still works as a ‘medium’. That’s it.