Page 1 of 1

jump to a specific frame

Posted: 26 Mar 2012 15:17
by andreahmed
Is it possible to jump to a specific frame ?

Re: jump to a specific frame

Posted: 27 Mar 2012 07:52
by freesunshine
it is not easy especially when the frame is not a key frame. you should jump forward and decode.
unfortunately vlc do not provide such functions so you should write by yourself.

Re: jump to a specific frame

Posted: 27 Mar 2012 08:36
by andreahmed
Thanks for your reply.

Is it possible to use libvlc_media_player_get_length and libvlc_media_player_get_fps to get the number of frames and then use set_pos to jump to a specific frame?

Re: jump to a specific frame

Posted: 27 Mar 2012 13:02
by freesunshine
it's absolutely possible,but difficult. it depends on video format a lot.
ffmpeg provides a function seek by frame ( av_seek_frame),but i have not tried;
in vlc,you can calculate the specific frame's time stamp and set_time to the nearest key frame,then get next frame until the time stamp is the nearest to your expectation