Page 1 of 1

Help: Get video thumbnails without seek

Posted: 29 May 2012 10:28
by jichi
Hi,

I am using libvlc/libvlccore to build a player in C++. I want to add a function to be able to popup thumbnails of the video after the user hovers over the position slider.
In order to do that, I think I need some APIs from libvlc in order to get the thumbnail of a given time into memory without seeking.

I know libvlc_video_take_snapshot could take a thumbnail at the current time. But I will have to seek to the hovered time to get the thumbnail, which is not feasible while playing the same video.
I also looked into the source code of vlc, it seems that libvlc_video_take_snapshot will set up a timer/trigger in the current frame buffer, and then the next frame coming to that buffer will be saved on to the disk as image file. In order to get the frame into that buffer, seeking is still required. I wonder is there some other way to get thumbnails without seeking.

I know ffmpeg could achieve this. However, as I am using libvlc to play remote media stream rather than local file, I think it could involve so much work to add ffmpeg just for thumbnails. I really hope to solve this within vlc. Any suggestions are appreciated.

Thanks!

Re: Help: Get video thumbnails without seek

Posted: 29 May 2012 10:40
by RĂ©mi Denis-Courmont
I don't think ffmpeg can achieve this directly. Thing is, there is really no efficient and generic way to do this. I mean, there is no computationally efficient way to a specific frame from its time code.

I could be wrong, I believe YouTube precomputes the snapshots on the server side when the video is uploaded. Note how you only get a few snapshots at regular interval when hovering...

Re: Help: Get video thumbnails without seek

Posted: 29 May 2012 10:55
by jichi
Precomputing does make sense. Thanks for your quick reply!