Skip to content

fix(video): add support for CMAF video format alongside DASH#506

Open
mtsz-pl wants to merge 1 commit into
redlib-org:mainfrom
mtsz-pl:fix-cmaf
Open

fix(video): add support for CMAF video format alongside DASH#506
mtsz-pl wants to merge 1 commit into
redlib-org:mainfrom
mtsz-pl:fix-cmaf

Conversation

@mtsz-pl
Copy link
Copy Markdown

@mtsz-pl mtsz-pl commented Nov 19, 2025

Reddit has transitioned from DASH to CMAF video format. This change adds support for both formats to maintain compatibility.

Changes:

  • Update REGEX_URL_VIDEOS to match both DASH and CMAF formats
  • Add format capture group to preserve DASH/CMAF in URL path
  • Add separate proxy endpoints for /vid/:id/dash/:size and /vid/:id/cmaf/:size
  • Update format_url to handle 3-segment video URLs (id/format/size)
  • Update tests to reflect new URL format with format segment

Video URLs now follow pattern: /vid/{id}/{format}/{size}.mp4
Example: /vid/abc123/cmaf/720.mp4

Fixes #503
Fixes #504

Reddit has transitioned from DASH to CMAF video format. This change adds
support for both formats to maintain compatibility.

Changes:
- Update REGEX_URL_VIDEOS to match both DASH and CMAF formats
- Add format capture group to preserve DASH/CMAF in URL path
- Add separate proxy endpoints for /vid/:id/dash/:size and /vid/:id/cmaf/:size
- Update format_url to handle 3-segment video URLs (id/format/size)
- Update tests to reflect new URL format with format segment

Video URLs now follow pattern: /vid/{id}/{format}/{size}.mp4
Example: /vid/abc123/cmaf/720.mp4
espacedev3019 added a commit to espacedev3019/redlib that referenced this pull request Jan 17, 2026
@rslay
Copy link
Copy Markdown

rslay commented May 17, 2026

Tested it locally, fixes video downloads (was previously getting HTML text in the files I'd try to download), but now the issue is that there's that whole limitation with reddit storing audio and video on different urls/streams, so at the moment downloaded videos have no audio with these changes, could be tricky to get it functioning and put lots of load/work on the server.

Again, still better than how it was before. simple enough modifications to the codebase, I think this is good to merge but thats up to the maintainers

@rslay
Copy link
Copy Markdown

rslay commented May 17, 2026

Thinking it over, there must be a way to make the browser construct the file via javascript, entirely client-side, using all the assembled audio chunks and video, and once its all nicely stored in memory, initiate a download of it as a blob. Looking into making a PR that does this

EDIT: Someone tried doing exactly this in #545 but it didn't work on my instance

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Bug Report: video download problem 🐛 Bug Report: Videos not loading

2 participants