Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High CPU usage when built against ffmpeg 5.x #24855

Closed
xvitaly opened this issue Aug 1, 2022 · 24 comments
Closed

High CPU usage when built against ffmpeg 5.x #24855

xvitaly opened this issue Aug 1, 2022 · 24 comments
Labels

Comments

@xvitaly
Copy link
Contributor

xvitaly commented Aug 1, 2022

Steps to reproduce

  1. Build Telegram Desktop against packaged ffmpeg 5.x (5.0 or 5.1, doesn't matter).
  2. Run built app.
  3. Join supergroup/channel with a lot of video stickers/avatars.
  4. Check CPU usage in top/htop.

Expected behaviour

Standard CPU usage.

Actual behaviour

100% CPU usage on all CPU cores. The official binary is not affected yet, but it will after upgrading from ffmpeg 4.4 to 5.x.

Downstream bug report with some logs: https://bugzilla.rpmfusion.org/show_bug.cgi?id=6273

Operating system

Fedora 36

Version of Telegram Desktop

4.0.2

Installation source

Other (unofficial) source

Logs

No response

@xvitaly xvitaly added the bug label Aug 1, 2022
@ilya-fedin
Copy link
Contributor

ffmpeg 5 is not supported yet. Please switch to ffmpeg 4 or fix ffmpeg 5 on your own.

@Aokromes Aokromes closed this as completed Aug 1, 2022
@xvitaly
Copy link
Contributor Author

xvitaly commented Aug 1, 2022

@Aokromes Why did you close this issue? The official package will be affected too after upgrading from ffmpeg 4.4 to 5.x. It should be opened for tracking purposes.

@ilya-fedin
Copy link
Contributor

It will be upgraded to ffmpeg 5 only after precise testing and fixing any obvious bugs. Until then, this is an unsupported configuration.

@xvitaly
Copy link
Contributor Author

xvitaly commented Aug 1, 2022

Please switch to ffmpeg 4

Impossible. Most distributions already moved to 5.1. 4.x branch will reach EOL very soon.

@ilya-fedin
Copy link
Contributor

Well, if you need it, implement it.

@xvitaly
Copy link
Contributor Author

xvitaly commented Aug 1, 2022

@ilya-fedin Please stop being so rude.

@ilya-fedin
Copy link
Contributor

ilya-fedin commented Aug 1, 2022

You can't requisite something on GitHub and then saying someone is rude just because one doesn't want to implement something you want. People implement what they want. You want ffmpeg 5? Go ahead, implement it. You can't force anyone else to do the work you're interested in.

@xvitaly
Copy link
Contributor Author

xvitaly commented Aug 1, 2022

@ilya-fedin Flatpak runtime 22.08 will have ffmpeg 5. Two weeks left.

@ilya-fedin
Copy link
Contributor

ilya-fedin commented Aug 1, 2022

It won't be used until preston would like to migrate to ffmpeg 5. Or until someone else implement the support.

@john-preston
Copy link
Member

@xvitaly BTW did you report it to ffmpeg bug tracker?

Looks like an ffmpeg regression when the same code works fine with ffmpeg 4.4 and works bad with ffmpeg 5.x 🙄

@GeorgesStavracas
Copy link

@ilya-fedin first please allow me to apologize for the confusion above. The fact that the FreeDesktop runtime 22.08 will ship with FFmpeg 5 is only a minor inconvenience, since Telegram can bundle the precise FFmpeg version it needs to (OBS Studio needs to ship a patched version of FFmpeg, so there's precedent for it.)

I see that you're actively committing to this repository, and maintaining the Flathub build, so you're probably in position to determine which version of FFmpeg the Flathub build will ship. So for the sake of clarity, do you think you or anyone could document this strict FFmpeg 4 dependency somewhere? REAME.md perhaps? So that least other packagers will know what to expect from this app's dependencies.

@ilya-fedin
Copy link
Contributor

ilya-fedin commented Aug 1, 2022

Looks like an ffmpeg regression when the same code works fine with ffmpeg 4.4 and works bad with ffmpeg 5.x

There was a big API break, maybe the code is not valid anymore?

So for the sake of clarity, do you think you or anyone could document this strict FFmpeg 4 dependency somewhere?

There's no place where supported versions are documented, the only way is to look at the Dockerfile the official binary is created from

@ilya-fedin
Copy link
Contributor

ilya-fedin commented Aug 1, 2022

since Telegram can bundle the precise FFmpeg version it needs to (OBS Studio needs to ship a patched version of FFmpeg, so there's precedent for it.)

I don't like to build ffmpeg manually due to all that configuration argument hell. I would rather prefer to stick with 21.08 until tdesktop starts working with ffmpeg 5.

@GeorgesStavracas
Copy link

Sticking to 21.08 is absolutely fine too

@ilya-fedin
Copy link
Contributor

ilya-fedin commented Aug 1, 2022

@GeorgesStavracas do you know what openssl version will be in 22.08, btw? openssl 3 is also a blocker, group calls don't work with it.

@GeorgesStavracas
Copy link

According to their GitLab project, that'll be openssl 3.0.5

@xvitaly
Copy link
Contributor Author

xvitaly commented Aug 1, 2022

do you know what openssl version will be in 22.08, btw?

From changelog:

Update openssl to openssl-3.0.5.

since Telegram can bundle the precise FFmpeg version it needs

Don't forget to resolve licensing issues, like paying patent royalties to MPEG LA for H.264, H.265 and AAC.

@GeorgesStavracas
Copy link

Sure

@ilya-fedin
Copy link
Contributor

Telegram is residing in a country where codec patents don't exist

@xvitaly
Copy link
Contributor Author

xvitaly commented Aug 1, 2022

Telegram is residing in a country where codec patents don't exist

But US/AU users can still download and use it.

Looks like an ffmpeg regression when the same code works fine with ffmpeg 4.4 and works bad with ffmpeg 5.x roll_eyes

There are a lot of ffmpeg deprecation warnings due compilation.

@ilya-fedin
Copy link
Contributor

No one would pay royalties. I also don't think flathub pays any royalties.

@xvitaly
Copy link
Contributor Author

xvitaly commented Aug 1, 2022

I also don't think flathub pays any royalties.

It depends on where they are legally registered. Also they don't provide ffmpeg-full by default. org.freedesktop.Platform.ffmpeg-full is a separate extension.

@ilya-fedin
Copy link
Contributor

It's still provided 🤷‍♂️

@xvitaly
Copy link
Contributor Author

xvitaly commented Aug 1, 2022

It's still provided

This is a very interesting question. I will ask Flathub admins.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants