←back to thread

1113 points Bluestein | 1 comments | | HN request time: 0.562s | source
Show context
lairv ◴[] No.41278203[source]
I use it to inspect video frames by frames, particularly being able to go back one frame. VLC doesn't support it, this thread about the feature is hilarious https://forum.videolan.org/viewtopic.php?t=120627
replies(19): >>41278382 #>>41278499 #>>41278639 #>>41278719 #>>41279342 #>>41279364 #>>41279561 #>>41279827 #>>41279842 #>>41279920 #>>41280125 #>>41281214 #>>41281733 #>>41282953 #>>41283275 #>>41284169 #>>41287180 #>>41289348 #>>41289743 #
sergiotapia ◴[] No.41278382[source]
i wonder why he's such an ass about it, and totally adamant that it's impossible when multiple players already do this fast. ego?
replies(4): >>41278485 #>>41278542 #>>41278658 #>>41278802 #
variadix ◴[] No.41278658[source]
I think technically he’s correct (I haven’t worked on media decoding code, but I understand how common video encoding formats work). If you have a long video with only a single key frame at the beginning then to step back you would need to, starting from the beginning of the video, decode every frame up to the previous frame you wanted to jump to in order to apply frame deltas, also assuming you have some sort of frame counter to determine when you’ve reached the target frame. In the worst case this does require a lot of compute, but this is an edge case if you primarily care about common video formats with normal encoding settings. I assume seeking backwards is also painfully slow on videos encoded in this manner, so why stepping back 1 frame is out of the question when compared to seeking backwards, I don’t fully understand, it must have something to do with precise frame counts being unavailable on some hardware decoders for some formats (and there being no good workaround) so you _may_ not actually go back 1 frame.

I don’t see any reason it couldn’t be supported for a set of formats with reasonable encoding/decoding settings, and provide some error message for other formats if a user attempts to step back, e.g. reverse frame stepping unavailable for current video due to format/encoding/decoding settings.

replies(7): >>41279035 #>>41279159 #>>41279175 #>>41279309 #>>41281273 #>>41281805 #>>41283553 #
hsbauauvhabzb ◴[] No.41279175[source]
Wouldn’t creating in-memory key frames for every nth frame resolve substantial computations on a frame-by-frame basis?
replies(2): >>41279868 #>>41281402 #
infofarmer ◴[] No.41279868[source]
you'd have to "rebase" all the other frames to be derived from those
replies(1): >>41279982 #
coryrc ◴[] No.41279982[source]
You wouldn't have to any more than you need 0 through N frames in memory to calculate frame N+1. Whatever your decoding state completes at frame N can be considered a key frame.
replies(1): >>41280583 #
infofarmer ◴[] No.41280583[source]
decoding state can be bulkier than a key frame and opaque to the CPU if hardware acceleration is used

I wonder if caching semi-compressed frames would be more efficient in either case (CPU or GPU)

replies(1): >>41314573 #
1. hsbauauvhabzb ◴[] No.41314573[source]
It doesn’t have to be every frame though. Pre calculate to 25%/50%/75%, then as I’m playing, save key frames for more incremental points, and if I start scrubbing, calculate more around that region.

Edit: this doesn’t have to happen synchronously either, it can occur in a background thread or passively.