Running LibRaw, WebGL2 Color Grading, and Memory-Bounded Video Reversal in a Browser Tab (Zero Uploads)
DEV Community

Running LibRaw, WebGL2 Color Grading, and Memory-Bounded Video Reversal in a Browser Tab (Zero Uploads)

Every "free online RAW converter" or "online video cutter" follows the same playbook: upload your 40 MB Sony .ARW or 4 GB action-camera .MP4 to a remote bucket, wait in a server queue, and hope the output doesn't come back with a watermark or heavy recompression.

When you come back from a shoot with hundreds of camera RAWs and multi-gigabyte 4K clips, uploading gigabytes of personal footage just to cull keepers, grade colors, or trim a few clean subclips makes no sense. Modern browsers already ship WebAssembly SIMD, WebGL2 3D textures, WebCodecs, and Worker threads.

So I built CutCull - a free, watermark-free, zero-upload RAW photo developer and multi-subclip video trimmer that runs entirely inside a browser tab (as the instant-access web companion to our upcoming native macOS/Windows desktop culling app). Your original files never leave your device.

Here are the three core engineering problems we solved to make real sensor-level RAW development, real-time WebGL2 color grading, and multi-gigabyte video processing fast and stable inside browser memory limits.

1. Real Sensor Demosaicing for 20 Camera RAW Formats (Not Embedded JPEG Extraction)

Most lightweight browser "RAW viewers" cheat: they scan the file header for the embedded preview JPEG that cameras write for their rear LCD screen, extract that 1600px 8-bit preview, and call it a conversion. The moment you push shadows or recover bright sunset highlights, 8-bit banding falls apart.

To do genuine sensor-level RAW development in the browser, we compiled LibRaw plus the GoPro GPR SDK (for VC-5 compressed .GPR RAWs) to WebAssembly:

  • 20 camera-tested RAW extensions: Sony .ARW, Canon .CR3 / .CR2 / .CRW, Nikon .NEF / .NRW, Fujifilm .RAF (X-Trans & Bayer), DNG .DNG (DJI, Leica, Ricoh, phones), OM System / Olympus .ORF / .ORI, Panasonic .RW2, Leica .RWL, Hasselblad .3FR / .FFF, Phase One .IIQ, Pentax .PEF, Samsung .SRW, Minolta .MRW, GoPro .GPR, and Sigma .X3F (plus batch .HEIC conversion).
  • Worker isolation: Demosaicing a 45-60 MP Bayer or X-Trans sensor buffer takes hundreds of milliseconds of CPU work. Running the WASM decoder inside a dedicated Web Worker keeps UI scrubbing, filmstrip navigation, and slider drags responsive at 60 fps.
  • Batch export without opening every file: If you drop 20 .CR3 or .ARW files into the workspace, grade three hero shots, and hit batch export, unedited RAWs automatically decode and export at full sensor resolution (JPG quality 90 or lossless PNG) alongside your graded picks.

2. Shared Rust Color Math & a Single-Pass WebGL2 Grading Shader

Once demosaiced wide-gamut pixels arrive from WASM, running pixel math on the CPU in JavaScript is far too slow for interactive sliders. At the same time, chaining half a dozen separate WebGL passes wastes memory bandwidth on high-megapixel photos and 4K HDR frames.

We defined a single color math specification in Rust (cutcull-core) mirrored by a single-pass WebGL2 fragment shader in the browser (and matching export pipelines), so interactive preview and final export stay consistent across photos and video:

  • As-Shot Anchored Kelvin White Balance: Camera white balance coefficients from the RAW metadata anchor an intuitive Temperature (Kelvin) and Tint control alongside one-click Auto grade.
  • Highlight-Safe Tone & Presence Controls: Interactive Exposure, Contrast, Highlights, Shadows, Whites, Blacks, Dehaze, Vibrance, and Saturation math evaluated in linear/perceptual space within a single fragment pass, paired with non-destructive spatial aspect-ratio crop (Original, Free, 16:9, and social presets).
  • Hardware sampler3D .cube 3D LUTs: Built-in creative looks (Warm, Cool, Black & white, Teal + orange) plus custom user .cube 3D LUT files uploaded into a WebGL2 3D texture for single-fetch hardware trilinear interpolation.
  • Consumer HDR Pipeline & Strict Local Privacy: Preserves consumer HDR (HLG / PQ 10-bit video and gain-map photos) end to end - while zero media bytes, filenames, custom LUTs, or edit parameters ever touch a network socket.

3. Multi-Subclip Stream-Copy Cutting & Windowed Video Reversal Without OOM

Standard ffmpeg.wasm demos usually read an entire video into in-memory MEMFS, transcode it from start to finish, and crash the tab as soon as the input crosses a few hundred megabytes. For action-camera, drone, and vlog footage, we built two specialized local execution paths:

Instant Multi-Subclip Cutting (-c:v copy)

Instead of a heavy multi-track NLE timeline, CutCull gives you J / K / L shuttle keys and I / O markers to tag multiple independent keeper ranges on a single long source video, then exports every range as its own clean file via lossless stream copy - no re-encoding, zero generation loss, and near-instant output.

Memory-Bounded Video Reversal

Reversing a video (vf=reverse,af=areverse) normally requires decoding every frame of the entire clip into uncompressed RAM at once - a 3-minute 1080p clip easily exceeds the 2-4 GB Wasm32 heap ceiling. To make longer 1080p clips reverse reliably in a browser tab, CutCull splits the job into 2-second keyframe-aligned sliding windows:

  • Decode only one short keyframe-bounded window into raw frames inside worker memory.
  • Reverse video frames and audio samples for that window, encode the reversed segment, and immediately free the raw buffers.
  • Concatenate the reversed segments seamlessly into a single MP4 download.

Peak memory stays flat whether your clip is 10 seconds or several minutes long. We pair this with pitch-preserving 0.1x-10x speed control and instant one-click audio track muting without video re-encoding.

Try It in Your Browser (No Sign-Up, No Watermark)

You can drop a camera RAW photo (.ARW, .CR3, .CR2, .NEF, .RAF, .DNG, .ORF, .RW2, .GPR, …), an iPhone .HEIC, or an .MP4 / .MOV clip directly into https://cutcull.com - no account required, no watermarks, and zero uploads.

We are also building the native macOS & Windows desktop edition of CutCull for high-volume SD-card culling (hundreds to thousands of clips per shoot, Lightroom/Bridge-compatible .xmp sidecars, and one-click FCPXML / Premiere XML / EDL handoff to DaVinci Resolve, Premiere Pro, and Final Cut Pro).

If you work with WebAssembly media pipelines, WebGL2 color shaders, or camera RAW formats, I'd love to hear your feedback and edge cases!

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.