Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
execution of ffmpeg is taking more time in gentoo than other
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
rupeshforu3
n00b
n00b


Joined: 19 Aug 2024
Posts: 14

PostPosted: Thu Oct 24, 2024 2:57 pm    Post subject: execution of ffmpeg is taking more time in gentoo than other Reply with quote

Hi I am Rupesh from India and I brought a new PC with AMD Ryzen zen3 5500GT and Asus prime 450 MK2 motherboard. I installed four Linux Operating Systems including gentoo linux and one Windows 11 Operating System. I installed ffmpeg tool along with libaom. Everything is working fine except there is something wrong with ffmpeg execution in Gentoo Linux.

I love working with Linux and Unix Operating Systems and I have lot of disk space and so I have installed four Linux Operating Systems and they are

1) Debian Linux testing Trixie
2) Fedora 40
3) Arch Linux
4) Gentoo Linux with systemd and desktop stage 3

At first I have installed Zen kernel through genkernel utility passing the parameter all.

After installation I have compiled the same ffmpeg source code which is cloned from git and with the same options which includes the following

--enable opencl
--enable opengl
--enable libaom
--enable AMF
--enable gnutils
Etc.,

I have some h264 mp4 files and I want to convert them into aom codec through ffmpeg and libaom.

I tested to convert those same files into aom codec using the same ffmpeg script but ffmpeg in gentoo Linux is taking too much time compared to ffmpeg in remaining Linux Operating Systems.

During the compilation of ffmpeg in gentoo linux I have installed packages related to amdgpu and rocm but unfortunately rocm-opencl-headers failed in installation.

After that I installed clinfo and ran it and it is showing message as Full profile, platform AMD etc.,.

Ffmpeg in other distributions is taking 45 minutes to convert 110 MB h264 mp4 to aom codec mp4 but unfortunately ffmpeg in Gentoo Linux is taking more than 100 minutes.

I can't understand what's wrong with ffmpeg in Gentoo Linux.

Even I have installed amdgpu_top_gui and opened it and it is showing a lot of information about my APU.

If I have not installed anything which is required for ffmpeg to run properly it must fall in compilation but it compiled successfully but it is not working fine.

Kindly try to suggest how to make ffmpeg to work properly and I am ready to provide any diagnostic information of the commands provided by you.

Regards,
Rupesh.
_________________
Regards,
Rupesh.
Back to top
View user's profile Send private message
stefantalpalaru
n00b
n00b


Joined: 11 Jan 2009
Posts: 56
Location: Italy

PostPosted: Thu Oct 24, 2024 5:16 pm    Post subject: Reply with quote

Make sure you have this set up: https://wiki.gentoo.org/wiki/CPU_FLAGS_*

Since you manually built ffmpeg from source, instead of using an ebuild, I'm going to assume you're a beginner and tell you to also make sure you have sane CFLAGS and CXXFLAGS (like "-O3 -march=native").
Back to top
View user's profile Send private message
molletts
Tux's lil' helper
Tux's lil' helper


Joined: 16 Feb 2013
Posts: 129

PostPosted: Thu Oct 24, 2024 6:09 pm    Post subject: Reply with quote

Hi Rupesh,

From the magnitude of the difference, I doubt it's related to compiler flags unless you've built the system with "-O0"!

What CPU frequency governor are you using on Gentoo?

To check, use:
Code:
# cpupower -c all frequency-info

(If you get "command not found", you will need to install cpupower with 'emerge sys-power/cpupower'.) This will return a lot of information about your CPU clock frequency, including its current value, which driver is controlling it, which frequency governors are available and which one is in use.

I suspect you may be using the "powersave" governor, which locks the CPU at its slowest speed.

If so, you will need to switch to a different one. If "schedutil" is available, that generally works quite well:
Code:
# cpupower -c all frequency-set -g schedutil

As it's a Zen system, however, there is an AMD-specific cpufreq driver available; I don't know whether this may take over the function of the governor too as the intel_pstate driver does. I don't have access to modern AMD hardware to test it so someone else may have to advise you on how to configure it if this is in use.

Let us know what you find.

Hope this helps,
Stephen
Back to top
View user's profile Send private message
rupeshforu3
n00b
n00b


Joined: 19 Aug 2024
Posts: 14

PostPosted: Fri Oct 25, 2024 11:07 am    Post subject: Reply with quote

Hi I am providing the outputs of the commands specified by you below

Code:

build@localhost ~ $ sudo cpupower -c all frequency-info
Password:
analyzing CPU 0:
  driver: amd-pstate-epp
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 400 MHz - 4.46 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 400 MHz and 4.46 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 4.44 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes
    Boost States: 0
    Total States: 3
    Pstate-P0:  3600MHz
    Pstate-P1:  1700MHz
    Pstate-P2:  1400MHz
analyzing CPU 1:
  driver: amd-pstate-epp
  CPUs which run at the same hardware frequency: 1
  CPUs which need to have their frequency coordinated by software: 1
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 400 MHz - 4.46 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 400 MHz and 4.46 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 4.44 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes
    Boost States: 0
    Total States: 3
    Pstate-P0:  3600MHz
    Pstate-P1:  1700MHz
    Pstate-P2:  1400MHz
analyzing CPU 2:
  driver: amd-pstate-epp
  CPUs which run at the same hardware frequency: 2
  CPUs which need to have their frequency coordinated by software: 2
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 400 MHz - 4.46 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 400 MHz and 4.46 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 4.44 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes
    Boost States: 0
    Total States: 3
    Pstate-P0:  3600MHz
    Pstate-P1:  1700MHz
    Pstate-P2:  1400MHz
analyzing CPU 3:
  driver: amd-pstate-epp
  CPUs which run at the same hardware frequency: 3
  CPUs which need to have their frequency coordinated by software: 3
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 400 MHz - 4.46 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 400 MHz and 4.46 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 4.44 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes
    Boost States: 0
    Total States: 3
    Pstate-P0:  3600MHz
    Pstate-P1:  1700MHz
    Pstate-P2:  1400MHz
analyzing CPU 4:
  driver: amd-pstate-epp
  CPUs which run at the same hardware frequency: 4
  CPUs which need to have their frequency coordinated by software: 4
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 400 MHz - 4.46 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 400 MHz and 4.46 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 4.43 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes
    Boost States: 0
    Total States: 3
    Pstate-P0:  3600MHz
    Pstate-P1:  1700MHz
    Pstate-P2:  1400MHz
analyzing CPU 5:
  driver: amd-pstate-epp
  CPUs which run at the same hardware frequency: 5
  CPUs which need to have their frequency coordinated by software: 5
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 400 MHz - 4.46 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 400 MHz and 4.46 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 4.44 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes
    Boost States: 0
    Total States: 3
    Pstate-P0:  3600MHz
    Pstate-P1:  1700MHz
    Pstate-P2:  1400MHz
analyzing CPU 6:
  driver: amd-pstate-epp
  CPUs which run at the same hardware frequency: 6
  CPUs which need to have their frequency coordinated by software: 6
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 400 MHz - 4.46 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 400 MHz and 4.46 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 4.44 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes
    Boost States: 0
    Total States: 3
    Pstate-P0:  3600MHz
    Pstate-P1:  1700MHz
    Pstate-P2:  1400MHz
analyzing CPU 7:
  driver: amd-pstate-epp
  CPUs which run at the same hardware frequency: 7
  CPUs which need to have their frequency coordinated by software: 7
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 400 MHz - 4.46 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 400 MHz and 4.46 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 4.44 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes
    Boost States: 0
    Total States: 3
    Pstate-P0:  3600MHz
    Pstate-P1:  1700MHz
    Pstate-P2:  1400MHz
analyzing CPU 8:
  driver: amd-pstate-epp
  CPUs which run at the same hardware frequency: 8
  CPUs which need to have their frequency coordinated by software: 8
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 400 MHz - 4.46 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 400 MHz and 4.46 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 4.44 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes
    Boost States: 0
    Total States: 3
    Pstate-P0:  3600MHz
    Pstate-P1:  1700MHz
    Pstate-P2:  1400MHz
analyzing CPU 9:
  driver: amd-pstate-epp
  CPUs which run at the same hardware frequency: 9
  CPUs which need to have their frequency coordinated by software: 9
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 400 MHz - 4.46 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 400 MHz and 4.46 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 4.44 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes
    Boost States: 0
    Total States: 3
    Pstate-P0:  3600MHz
    Pstate-P1:  1700MHz
    Pstate-P2:  1400MHz
analyzing CPU 10:
  driver: amd-pstate-epp
  CPUs which run at the same hardware frequency: 10
  CPUs which need to have their frequency coordinated by software: 10
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 400 MHz - 4.46 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 400 MHz and 4.46 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 4.44 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes
    Boost States: 0
    Total States: 3
    Pstate-P0:  3600MHz
    Pstate-P1:  1700MHz
    Pstate-P2:  1400MHz
analyzing CPU 11:
  driver: amd-pstate-epp
  CPUs which run at the same hardware frequency: 11
  CPUs which need to have their frequency coordinated by software: 11
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 400 MHz - 4.46 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 400 MHz and 4.46 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 4.44 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes
    Boost States: 0
    Total States: 3
    Pstate-P0:  3600MHz
    Pstate-P1:  1700MHz
    Pstate-P2:  1400MHz


Code:

build@localhost ~ $ sudo cpupower -c all frequency-set -g schedutil
Setting cpu: 0
Error setting new values. Common errors:
- Do you have proper administration rights? (super-user?)
- Is the governor you requested available and modprobed?
- Trying to set an invalid policy?
- Trying to set a specific frequency, but userspace governor is not available,
   for example because of hardware which cannot be set to a specific frequency
   or because the userspace governor isn't loaded?
build@localhost ~ $

_________________
Regards,
Rupesh.
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2159

PostPosted: Fri Oct 25, 2024 11:21 am    Post subject: Reply with quote

molletts wrote:
...
From the magnitude of the difference, I doubt it's related to compiler flags unless you've built the system with "-O0"!
...

ffmpeg is particularly sensitive to cpu flags, as there are lots of hardware instructions tailored for the sort of vector processing involved (SSE4.2, and host of other flags).
It's almost certainly worth (a) getting good CFLAGS suitable for the hardware and use-case (a whole discussion in itself, visible all over the forums), and (b) using the output of cpuid2cpuflags to tailor make.conf, as ffmpeg is dependent on them too.
_________________
Greybeard
Back to top
View user's profile Send private message
Ralphred
l33t
l33t


Joined: 31 Dec 2013
Posts: 621

PostPosted: Fri Oct 25, 2024 12:40 pm    Post subject: Reply with quote

molletts wrote:
As it's a Zen system, however, there is an AMD-specific cpufreq driver available; I don't know whether this may take over the function of the governor too as the intel_pstate driver does. I don't have access to modern AMD hardware to test it so someone else may have to advise you on how to configure it if this is in use.

For zen3 and later, when using the amd p-state driver you'll get the best results using the powersave governor.
It's worth enabling perfcore on the kernel command line too<< I don't know how many of the p-state features were backported to the 6.6 series of kernels, so I stick to >=6.9.1.
Do not enable any bios overclock of the CPU it gimps the drivers boost function, it will dynamically overclock each core to it's individual capabilities itself. The time boost frequencies can be applied is related to individual core temperature, so a well (thermally) connected cooler that can quickly remove thermal gradients becomes a performance factor (read: don't use the stock cooler for best results).
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum