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

Reencoding video is failing on studio.blender.org_en_open-movies #386

Open
benoit74 opened this issue Jan 27, 2025 · 10 comments
Open

Reencoding video is failing on studio.blender.org_en_open-movies #386

benoit74 opened this issue Jan 27, 2025 · 10 comments

Comments

@benoit74
Copy link
Collaborator

See openzim/zim-requests#1261 for details.

Looks like a specific video has issue with audio reencoding.

One should try to:

@Rancho-rachit
Copy link

Rancho-rachit commented Feb 13, 2025

I've followed the steps mentioned above, here are my observations -

Specific video causing the problem -
https://www.youtube.com/watch?v=YE7VzlLtp-4&list=PLav47HAVZMjnTFVZL-aImCQIC0uLZtNCz&index=15

Q) Why this specific video is causing a problem?
A) Because this video has 5.1 Surround sound in compare with other having stereo

And that's why libvorbis audio encoder struggles to encode 5.1 channel audio at a very low 48kbps bitrate.

Solutions: (all tested)

  • Increase the bitrate (>=84kbps)
  • [Suggested] Reencode 5.1 Surround Sound audio into stereo to fit under the defined bitrate limit of 48kbps using the -ac: 2 flag.
    • Even if video has mono audio this flag upmixes it to "fake" stereo (duplicate mono).

@benoit74
Copy link
Collaborator Author

Thank you @Rancho-rachit for the great analysis and the great solutions proposed

I'm biased towards setting -ac: 1 since we are willing to make small ZIMs and I suspect mono audio is sufficient in 99% of the cases and would save space. I'm not a big audiophile tbh, but is really stereo a big game changer when you are fighting to have access to online resources? At the same time, it is not like audio is a big contributor to final ZIM size, but bits always pile up ^^ @kelson42 @rgaudin @Popolechien any views on this not-so-technical question?

@Popolechien
Copy link

I've watched the short, there is no audio effect warranting the extra volume.

@benoit74
Copy link
Collaborator Author

My question is not for this specific video for both all videos of all scrapers who reencode the videos with standard scrapers settings (youtube and ted ATM)

@Popolechien
Copy link

Educational content is pretty light as far as sound effects go, we should be fine with standards settings.

@benoit74
Copy link
Collaborator Author

we should be fine with standards settings

I don't know what standards settings are.

Let me rephrase my original question: we currently do not mind about the number of audio channels in our videos while reencoding. This causes the side-effect that when the source has too many channel, e.g. 5.1 but could be anything else, reencoding to our settings (libvorbis with audio bitrate of 48kbps max) fails (impossible to respect this limit with so many channels).

We probably do not want to increase the max bitrate because we want to keep video size as small as possible (at least in low settings).

We can set the number of audio channels to use. We have the choice between 1 or 2 channels. 1 channel means mono sound, forcing the encoder to mux stereo and more channels into a single one. This is my preference because it helps to keep ZIM size small. 2 channels means that even for videos which are mono at the source we will "fake/upmix" to stereo channels.

Hence my original question: do we agree that we should force mono sound on all our reencoded videos?

This morning I did some tests and they are not conclusive at all. Mono videos regularly takes more space than stereo ones. And resulting sound is ... very comparable. I hence propose to always force stereo, since it is probably the best compromise in terms of size and quality.

@Popolechien
Copy link

yes

@Rancho-rachit
Copy link

I also ran some tests and noticed that even if a video originally had mono channel audio preprocessing, re-encoding it with stereo audio reduced its size by about 5% while maintaining similar quality.

@benoit74
Copy link
Collaborator Author

Thank you, closing this in favor of openzim/python-scraperlib#250, I will hopefully do and release this today or early next week, and then release youtube as well.

@benoit74 benoit74 reopened this Feb 14, 2025
@benoit74
Copy link
Collaborator Author

In fact, let's keep this open until upstream issue is fixed and merged into this scraper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants