SDL3 Camera crashing on Windows (7)

I love the SDL3 Camera API, it’s working flawlessly* on a Lenovo laptop running ElementaryOS. I’ve written myself a GUI to enumerate cameras and their available formats, open a live window, save images to disk on demand.

*Well, 2 out of 3 cameras are working, the third returns an empty name and no formats, but it’s an old USB webcam (Logitech? 15+ years old?) and I’m not upset if ElementaryOS in 2025 is incompatible with it.

However the same code on Windows is giving me empty-black surfaces at best (usually if I leave targetspec NULL), or crashing at worst (Invalid Memory Access, usually if I specify a targetspec).

Details: It’s another Lenovo laptop running Windows 7 (old-ish, I know, but should work), I’m using the x86 SDL3.dll v3.2.0. Three webcams (integrated “Lenovo EasyCamera”, USB “Microsoft LifeCam Cinema”, and Logitech “USB Video Device”) and their formats all enumerate correctly. But upon opening them, I get crashes within seconds. I believe I also tried the x64 DLL and built 64-bit program, no success.

At first I was copying the “camera-read-and-draw” SDL3 example: open camera, acquire surfaces, apply them to texture, render in window. Works as expected on Linux/Elementary, crashing on Windows.

I progressively trimmed down the program: got rid of window and renderer and texture, even got rid of AcquireCameraFrame completely. My Windows program just crashes within seconds of OpenCamera.

I haven’t 100% proven this is an SDL problem or my own. Any advice? Unfortunately I am using the pre-compiled DLL and wrapping it in another language, so I don’t have much debugging access.

Could anybody with Windows (7?) and some webcams test the SDL3 Camera examples via the x86/x64 DLLs?

A final note, the in-browser “read-and-draw” web example is not working for me either, on that Lenovo Windows 7 laptop. I don’t get crashes, but I get “Couldn’t find any camera devices”. Whereas eg. webcamtests.com can enumerate, open, and render them.

Thanks for hearing me out.

Minor followup to this:

On Linux/ElementaryOS, where the Cameras work nicely, I solved my above “1 of 3 webcams not working” problem. That was a bug in my own wrapper code, I was stepping through the SDL_CameraIDs as if they were 64-bit, rather than 32-bit.

On the Windows 7 laptop, nothing has changed, I still get blank black frames or crashes, after successful OpenCamera to any of 3 webcams, even if I never call AcquireCameraFrame. For what it’s worth, all webcams successfully “activate”, as indicated by their LEDs, before soon crashing.

I’m increasingly convinced it’s an internal SDL issue rather than my own, mainly because the examples.libsdl.org “read-and-draw” fails too (compared to other working websites), which rules out fault of my wrapper code.

If I can collect some diagnostics and confirm or deny on other Windows machines, I’ll submit a proper bug report…

MS dropped support for windows 7 years ago. I think you shouldn’t care about it working there.

I understand, I wouldn’t have bothered asking about it if SDL3’s supported platforms didn’t start with “Windows XP and later” (!)

2 Likes