DEV Community

nRn World
nRn World

Posted on

Why seeking in Electron's video player stutters – and how I fixed it

I built a video player called Doggy Player because seeking in the players I tried always felt janky. When I moved to Electron, I hit the same problem in a new form: Chromium's <video> element is great at playing files and surprisingly bad at jumping around in some of them. This is what I found, and what I did about it.

Why seeking is slow

To show a frame at an arbitrary position, a decoder has to start from the previous keyframe (IDR) and decode forward from there. If keyframes are 8 seconds apart, a seek can mean decoding several seconds of video before anything appears.

In my measurements on files of identical size, the median seek took about 217 ms with an 8.3 s GOP and about 30 ms with a 1 s GOP.

Problem 1: ".mp4" files that are not MP4

Some files carry an .mp4 extension but are really MPEG-TS. Chromium plays them, but freezes for about a second on every seek.

The fix: probe the real container with ffprobe, and if it doesn't match, remux once with stream copy and -movflags +faststart. There is no quality loss, it takes seconds, and the result is cached so the next open is instant.

Problem 2: sparse keyframes

For long-GOP sources, the only way to get YouTube/VLC-class seeking is to re-encode with a dense keyframe interval. That is lossy and slow, so I only do it in the background for files shorter than 30 minutes, cache the result (capped at 10 GB) and clean up leftovers from interrupted conversions.

Problem 3: the seek controller

Even with good files, the UI layer matters. Early versions seeked on key-down and key-up, which replayed a fraction of a second after every press and was audible as a stutter. The rules I settled on:

  • one key press = exactly one seek
  • holding an arrow key scrubs smoothly and resumes playback on release
  • rapid presses coalesce (last one wins) instead of stacking decode jobs

A security note

Serving local files to the renderer over HTTP means any web page could try to read them. The local media server now requires a per-run random token, and file names are never passed through a shell when reading video length.

Try it

Doggy Player is source-available and free for personal use, with builds for Windows, macOS and Linux:

GitHub logo nRn-World / DoggyPlayer

🐶 Doggy Player a modern Electron video player for Windows with VLC-style gapless seeking, subtitles, playlists and IPTV.

Doggy Player logo

Doggy Player 🐶

A fast, dark, modern video player with VLC-style instant seeking, zoom & rotate, subtitles and built-in IPTV.
Source-available · Free for personal use · Windows · macOS · Linux

Download latest release

Latest release Downloads Stars License: CC BY-NC 4.0 Platforms Electron + React

Doggy Player main interface


Why Doggy Player?

  • Seeking that just works. Jump anywhere in a long film instantly — no stutter, no audio "vibration", no frozen frame. Files Chromium can't seek well are quietly converted once in the background and cached.
  • Zoom into the picture. Mouse-wheel zoom, click-to-pan, or hold Shift and draw a rectangle to zoom into a detail.
  • Fix bad videos on the fly. Rotate with Alt + Arrow, adjust brightness 50–150 %, and lock the setting per video so it comes back next time.
  • Everything in one place. Playlists, subtitles (.srt .vtt .ass), an equalizer and IPTV (Xtream Codes, M3U, EPG) — no plugins to hunt for.
  • Private by design. Nothing leaves your machine except an…




If you have a file that seeks badly, please open an issue. That's the best feedback I can get, and there are a few good first issue tasks if you'd like to contribute.

Top comments (0)