Repository navigation
Description
Upstream obs-websocket bug, reported by cmack in obsproject/obs-websocket#1298 (OBS 30.1.2 on Linux, obs-websocket 5.4.2): GetSourceScreenshot with imageFormat: "jpg" returns a data URL labeled image/jpg, which is not a MIME type; with "jpeg" it is labeled image/jpeg. Two upstream PRs are open and unmerged: obsproject/obs-websocket#1337 (andrewsoncha, Qt's MIME database) and obsproject/obs-websocket#1354 (iibaranov-IG, jpg only). The bug is in this fork too.
Location
src/requesthandler/RequestHandler_Sources.cppGetSourceScreenshot(line 230) builds the URL as"data:image/%1;base64,"with the requested format name. The format names are Qt image writer names (GetVersionlists them assupportedImageFormats), which are file extensions. Onlyjpeg,pngandbmphappen to equal their MIME subtype.
Class
Wrong output. The screenshot works, but its data URL carries a MIME type that does not exist.
How it is reached
Any client that asks for jpg (the more common spelling), jfif, ppm, pgm, pbm, ico, cur, xbm or xpm, then uses the URL as is (an <img src>, a download, a check on the type). SaveSourceScreenshot writes a file and is not affected.
Reproduced in the current release
AppImage 33.0.0-beta6-799, headless over obs-websocket, GetSourceScreenshot of the default scene at 64 px wide. GetVersion lists bmp, cur, ico, jfif, jpeg, jpg, pbm, pgm, png, ppm, xbm and xpm.
| imageFormat | URL prefix today | Registered type |
|---|---|---|
| jpg | data:image/jpg |
image/jpeg |
| jpeg | data:image/jpeg |
image/jpeg |
| png | data:image/png |
image/png |
| bmp | data:image/bmp |
image/bmp |
| ppm | data:image/ppm |
image/x-portable-pixmap |
Proposed fix and failing test
Fix (in the obs-rust/obs-websocket fork, then a submodule update here): move the label into a helper, Utils::ImageFormat::MimeType(), that maps the writer format names to their registered MIME types (jpg, jpeg and jfif to image/jpeg; ico, cur, pbm, pgm, ppm, xbm, xpm, tif, tiff and svg to theirs) and keeps image/ plus the name otherwise. This is a fixed table and not Qt's MIME database (the approach in obsproject/obs-websocket#1337) because the database is read from the system's shared-mime-info: without it, every lookup answers application/octet-stream, and jpg would still come out wrong.
RED test (cmocka, test_ws_image_mime). It builds the plugin's helper on its own (no libobs, no Qt, no display) and checks:
- jpg, jfif:
image/jpeg; - ppm:
image/x-portable-pixmap; - ico:
image/vnd.microsoft.icon; - guard: jpeg, png and bmp stay
image/jpeg,image/pngandimage/bmp.
Today 4 of 5 fail in both libobs lanes. The guard passes.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 13, 2026
Claiming: this issue.
test_ws_image_mime(5 cases) builds obs-websocket's screenshot MIME helper: jpg and jfif come out asimage/jpgandimage/jfifinstead ofimage/jpeg, and ppm and ico are mislabeled too; a guard checks jpeg, png and bmp. 4 of 5 fail today.PR today.
obs-websocket: Label screenshots with the real MIME type
obs-websocket: Label screenshots with the real MIME type (#652)
rdoupe commentedon Oct 13, 2026
@cmack you reported this in obsproject/obs-websocket#1298 (
GetSourceScreenshotwithimageFormatjpgreturns adata:image/jpgURL, which isn't a valid MIME type), so a heads-up: it's fixed here in obs-rust (obs-rust/obs-websocket#6, moved into OBS by #652), with a regression test.Cause: the label was "image/" plus the requested format name, but those names are Qt image writer names, which are file extensions, so
jpgbecameimage/jpgandppmbecameimage/ppm. The format names are now mapped to their registered MIME types with a fixed table:jpgandjfifgiveimage/jpeg,ppmgivesimage/x-portable-pixmap, and so on, whilepng,bmpandjpegare unchanged. A fixed table rather than Qt's MIME database, because that database depends on the system's shared-mime-info and answersapplication/octet-streamwithout it. In the obs-rust releasejpggavedata:image/jpg; the regression test checks every format the writer offers.Workaround on stock OBS: request
jpeginstead ofjpg, which was already labelled correctly.It will be in the next obs-rust daily release after 0.1.0-beta.20261013: https://github.com/obs-rust/obs-studio/releases (Windows, macOS and Linux builds; on Arch it's
obs-studio-rust-gitin the AUR). obs-rust is an AI-assisted fork of OBS.If you get a chance to try it, a reply here on whether your client now gets
image/jpegwould really help.