r/VIDEOENGINEERING • u/Smash-Gordon • 4d ago
VLC 4.0 finally has a "Previous Frame" function, twelve years after it was deemed impossible
https://gordonvidal.dev/why-vlc-cannot-step-backward/VLC 3 has E for Next Frame and nothing for going the other way. If you ever asked about that on the old VideoLAN forums, someone probably linked you Rémi Denis-Courmont saying reverse frame-by-frame is "not feasible within bound and reasonable computational, memory and bandwidth limits because video codecs and container formats are not meant to be played in reverse." Those threads usually got locked after a few pages of people bringing up MPC-HC, PotPlayer and YouTube, and it's been a running joke on here ever since.
The GitLab ticket is #10252. vadiav opened it on December 29, 2013, and Jean-Baptiste Kempf tagged it Difficulty::guru the same day. In January 2023 Rémi left this comment on it:
No way in hell such a difficult feature can be done in 4.0 and/or before buffering redesign (5.0.0). I thought people would know stop scope creep by no[w].
It made it into 4.0 anyway (still unreleased), through Thomas Guillem's MR !3263. The approach is about what you'd expect, and he calls it "BE PRAGMATIC" himself. Seek back a batch of frames (10 at first), decode forward into a LIFO, pop the frames off in reverse. When the stack is empty, it seeks again. Switching back to Next Frame or Play also means another seek.
Those re-seeks are what the second half of the post is about. I worked on the same problem in a player of my own. It keeps a bounded two-way frame cache in system RAM to avoid most of them, and it coalesces rapid scrub and step input so a burst of key presses doesn't turn into a burst of seeks. Frames get copied off the hardware decoder's GPU surfaces into RAM.
Very interested of course in other implementations for this rapid frame by frame seeking if anyone knows details of what the state of the art video players do.
Write-up is here: https://gordonvidal.dev/why-vlc-cannot-step-backward/
32
u/ConsumerDV 4d ago
Opinionated devs can ruin any product. Every NLE can scrub back, why could not VLC is beyond me. Sure, some technical tricks need to be involved, but this is what software dev is about. VLC is not a tiny superfast superefficient player anyway, on Windows this crown is held by Splash. But Splash is rather picky in the formats it plays.
7
u/mittelegna 4d ago
For Mac users, IINA can do it: https://iina.io/
2
u/videograndpa 4d ago
This is high on the things I’m thankful for list
1
u/this_knee 4d ago
🎉🎉🎉🎉
1
u/itanite 4d ago
I'm not a fuckin programmer but I mean.....framebuffer?
1
u/deadsound797 3d ago
LOL, I have found the Previous Frame issue comical over the years....The VLC dev's boxed themselves in with D3d11 and windows API/SDK'. AI comes out and BAM we have Previous Frame :)
1
u/thesmallterror 3d ago
Stepping backwards one frame is tricky in many codecs because those codecs encode changes between each frame in the forwards direction. The only way to go backwards is to to go to the previous keyframe (a frame where the whole image is encoded) and then replay all the delta frames until the one you wish to view. Now, you could buffer all the nearby frames on the off chance somebody wants to go back a few frames, but as I understand in VLC they integrated too tightly with directx's and your GPU's built in video decoding and acceleration. Adding a new behavior like this would have required rewriting a huge dependency of VLC.
1
u/Phill_P 3d ago
Meanwhile Mitti has done that since launch and I'm pretty sure good old Playback Pro could do it too.
-2
u/Warm-Bee-9360 3d ago
I didn't knew what one could gain from this, i asked chat, the answer:
A “previous frame” button moves a paused video backward by exactly one image. At 60 fps, that’s about 16.7 milliseconds.
The main benefit is precision. Suppose you pause a squash recording just after the ball hits the racket: you can step backward to find the exact contact frame, then move back and forth to examine it.
It’s useful for:
Without it, overshooting by one frame means rewinding farther and stepping forward again, which becomes tedious.
For ordinary movie watching, it adds little. For closely inspecting footage, it’s a handy precision control. The excitement in that discussion is partly because VLC already supported stepping forward, while backward stepping had been requested for years.