Play any video format inside VS Code — including HEVC / H.265 camera feeds
(the reason the built-in viewer shows a black screen) — by transcoding to H.264 on
the fly with ffmpeg.
Why the built-in viewer fails
VS Code's built-in media preview renders video through Electron/Chromium, which has
no H.265/HEVC decoder. This extension probes each file with ffprobe and:
- H.264 / VP8 / VP9 / AV1 in mp4/mov/webm → plays the original file natively.
- Everything else (HEVC/H.265, MPEG-4, mkv, avi, ts, mxf, …) → transcodes to
H.264 + AAC with
ffmpeg and plays the result.
Supported containers: mp4, mkv, avi, mov, m4v, webm, ts, flv, wmv, mts, m2ts, 3gp, mpeg, mpg, vob, ogv, mxf.
Requirements
ffmpeg and ffprobe must be available in your PATH.
| OS |
Install |
| Windows |
winget install ffmpeg or download from gyan.dev and add to PATH |
| macOS |
brew install ffmpeg |
| Linux |
sudo apt install ffmpeg |
Restart VS Code after installing ffmpeg so the extension host picks up the updated PATH.
- An NVIDIA GPU with
h264_nvenc is auto-detected and preferred when available;
otherwise it falls back to libx264 (CPU) automatically.
How to use
- Install the extension from the Marketplace and reload VS Code.
- Right-click a video file in the Explorer → Any-Format Video Player.
- Or: Open With… → Any-Format Video Player
- Or run the command Any-Format Video Player: Open Video...
- If the codec isn't Chromium-compatible, wait for the progress bar to finish,
then press play.
How it works
Each file is inspected with ffprobe. Native codecs stream directly; everything
else is transcoded to a temporary H.264 file which is loaded through
webview.asWebviewUri() (the same mechanism the built-in player uses, so it works
over Remote-SSH as well).
Troubleshooting
- "needs ffmpeg in your PATH" — install ffmpeg, then restart VS Code.
- Slow first frame — the first transcode of a large file takes a few seconds
(faster with NVENC, longer on CPU).
- No audio on some files — the source stream has no audio track.
Build from source
npm install -g @vscode/vsce
vsce package
code --install-extension any-format-video-player-1.0.0.vsix
License
MIT