OpenCut's video preview and audio playback both rely on mediabunny, which
in turn requires the WebCodecs API (VideoDecoder / AudioDecoder). On
browsers where WebCodecs is not exposed (e.g. Linux Chromium builds
without proprietary codec support), import and playback both throw
"codec not supported" errors and the editor becomes unusable.
This change makes the editor work on those browsers without sacrificing
the WebCodecs fast-path elsewhere:
- Add a server-side /api/convert-video route that transcodes incoming
videos to H.264 baseline 3.1 yuv420p via the system ffmpeg binary.
processMediaAssets uses it automatically when readVideoFile reports
canDecode=false so the asset stored is always something the browser
can play.
- Add HTMLVideoElementSink, a CanvasSink-shaped sink backed by a
hidden <video> element + canvas.drawImage. VideoCache.initializeSink
selects it only when WebCodecs VideoDecoder is unavailable; otherwise
it keeps using mediabunny's CanvasSink unchanged.
- Add FallbackAudioBufferSink, an AudioBufferSink-shaped sink backed by
AudioContext.decodeAudioData (which uses the platform's native audio
decoders, not WebCodecs). AudioManager and the import-time decode
path swap to it on canDecode=false. runClipIterator is wrapped in a
try/catch so a sink failure no longer leaves an unhandled rejection.
Tests cover frame timing, dispose semantics, FPS clamping, the
WebCodecs/AudioDecoder availability probes, AudioBuffer slicing, and
the fallback iterator contract.