-
Notifications
You must be signed in to change notification settings - Fork 6
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
[Workaround for] OOM / memory "502 Bad Gateway" crashes w/ large videos' playback or download-to-client [SEE ALSO #37 & #53] #51
base: master
Are you sure you want to change the base?
Conversation
Use native HTML5 video player
Play video directly using native HTML5 player
Co-authored-by: A Holt <[email protected]>
Co-authored-by: A Holt <[email protected]>
Original problem:
Question copied to its own ticket: |
Downloads is now optimized with this PR. The previously 4GB video is redownloaded and it's now 210.8MB. Tested on Ubuntu 22.04.3. Should work with most YouTube videos assuming a video+audio stream, with 720p resolution and vp9 codec exists for the URL. |
Smoke-tested together with #57 on Ubuntu 24.04 (Noble Numbat) |
Improve video path and align with nginx
if file.endswith(".webm") or file.endswith(".mp4"): | ||
video_file = os.path.join(video_path, file) | ||
# align with nginx path | ||
video_file = video_file.replace(config.config_calibre_dir, "/books-direct") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aligned with iiab/iiab#3680
@deldesir this looks great!
|
cps/web.py
Outdated
for file in os.listdir(video_path): | ||
if file.endswith(".webm") or file.endswith(".mp4"): | ||
video_file = os.path.join(video_path, file) | ||
# align with nginx path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# align with nginx path | |
# align with nginx path (e.g. "books-direct") specified on Lines ~24 and ~29 of: | |
# https://github.com/iiab/calibre-web/blob/master/scripts/calibre-web-nginx.conf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deldesir can you take the above suggestion seriously — or if not explain why?
In lieu of soft-coding (or posting constants on top of files, as is traditional to make software more maintainable...) please at least consider clear documentation explaining how to maintain de facto global constants.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get it. Definitely useful adding context in comments.
Co-authored-by: A Holt <[email protected]>
Co-authored-by: A Holt <[email protected]>
QUESTION: I'd love to understand the Root Cause better (#37 and corollary #53) — before we merge this PR and its companion PR (#57) — which together risk papering over a deeper problem? Hopefully @deldesir can explain better the Root Cause in coming days, or at least what's understood about it so far! BACKGROUND:
🙏 Either way let's articulate & clarify the likeliest road forward, as precisely as we can anyway. 🙏 |
Calibre-Web tends to load the entire video file to RAM before playing, making it challenging when only large videos are available due to oom-killer restrictions on excessive memory usage. This PR will fix this.