Precision when seeking

This forum is about all development around libVLC.
lobster
Blank Cone
Blank Cone
Posts: 28
Joined: 03 Oct 2011 01:27

Precision when seeking

Postby lobster » 03 Oct 2011 01:37

I need a player that is very precise when seeking. Is VLC the wrong choice?

For example: the movie is paused and a call to libvlc_media_player_get_time is made. After that, a call to libvlc_media_player_set_time. Now the movie actually moves forward in time - when it should be standing still?

It also appears that libvlc_media_player_set_time doesn't seek to the exact same frame every time. I need that. If set_time is called while the movie plays, it tends to skip a bit of the audio from where it is positioned. The audio seems fine if paused, set and then played from that position.

I am working with avi/xvid files. Can something be done?

Another thing: if many calls are made too quickly to libvlc_media_player_next_frame, it just freezes.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Precision when seeking

Postby Jean-Baptiste Kempf » 03 Oct 2011 15:37

Yes, VLC is not very precise in seeking.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

tmoran
Blank Cone
Blank Cone
Posts: 38
Joined: 19 Dec 2007 22:32

Re: Precision when seeking

Postby tmoran » 22 Mar 2012 08:34

I start playing, wait 2 seconds, then use libvlc_media_player_set_time(44000) to go to the 44 second point. A call on libvlc_media_player_get_time returns 44000.
Then I wait another two seconds and call libvlc_media_player_get_time and it returns 36368, which appears to match the actual time of the video I see on the screen.
Doing this with different numbers than 44000, it always seems to seek to several seconds early. Is that perhaps due to something controllable (caching?) Or is libvlc_media_player_set_time inherently just a vague approximation of the desired point?

Rémi Denis-Courmont
Developer
Developer
Posts: 15266
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Precision when seeking

Postby Rémi Denis-Courmont » 22 Mar 2012 11:07

It depends on the file format.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Zingaro2002
Blank Cone
Blank Cone
Posts: 47
Joined: 30 May 2006 09:58

what are the best file formats for seeking with precision?

Postby Zingaro2002 » 22 Mar 2012 12:45

In you experience, what are the most precise-seeking file formats?

I am transcoding live streams (audio and video) to files (using libvlc and sout option), so I can choose codec and container for my files; what is your advice about them?
I absolutely need a good precision in seeking when I re-view those files (I mean: an error of 1 second is ok, not too much more).

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Precision when seeking

Postby Jean-Baptiste Kempf » 22 Mar 2012 13:43

mkv or mp4, probably.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

tmoran
Blank Cone
Blank Cone
Posts: 38
Joined: 19 Dec 2007 22:32

Re: Precision when seeking

Postby tmoran » 22 Mar 2012 17:32

>> In you experience, what are the most precise-seeking file formats?
>mkv or mp4, probably.
The file I was trying, that went to :36 instead of :44, was an mp4. So it sounds like some experimentation is needed.

Sébastien Escudier
Big Cone-huna
Big Cone-huna
Posts: 853
Joined: 06 Nov 2008 08:38
Operating System: linux

Re: Precision when seeking

Postby Sébastien Escudier » 23 Mar 2012 09:03

did you try with VLC directly ? like :
vlc my_movie.mp4 --start-time=10
It is precise here.

tmoran
Blank Cone
Blank Cone
Posts: 38
Joined: 19 Dec 2007 22:32

Re: Precision when seeking

Postby tmoran » 23 Mar 2012 19:38

> vlc myfile.mp4 --start-time=10
Also very far off. But the same command run with an old (0.8.6i) vlc worked correctly.

Sébastien Escudier
Big Cone-huna
Big Cone-huna
Posts: 853
Joined: 06 Nov 2008 08:38
Operating System: linux

Re: Precision when seeking

Postby Sébastien Escudier » 24 Mar 2012 16:41

would you have a sample ?
mp4 is very precise for me.

tmoran
Blank Cone
Blank Cone
Posts: 38
Joined: 19 Dec 2007 22:32

Re: Precision when seeking

Postby tmoran » 26 Mar 2012 20:48

Oops, you are right. I checked the file labeled .mp4 but it was actually mpeg, according to ffmpeg. A file that is truly mp4 does seems to be accurate about start-time, while the mpeg one is wrong. This is with the new vlc 2.0
The old vlc 0.8.6i was accurate for both files (though its video was corrupt for the mp4 file).

Rémi Denis-Courmont
Developer
Developer
Posts: 15266
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Precision when seeking

Postby Rémi Denis-Courmont » 26 Mar 2012 21:38

MPEG PS seeking was never accurate. That file format provides no indexing. Try to seek fast and accurately with your living room DVD player if you do not trust me...
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

sparkz
New Cone
New Cone
Posts: 3
Joined: 26 Mar 2012 09:42

Re: Precision when seeking

Postby sparkz » 27 Mar 2012 05:13

I was a little disappointed when I found out the "set_time" feature doesn't work that well.

I'm using WMP via MCI for a video library application. With WMP I step through my videos at fixed intervals, taking snapshots, to make an index card. It works very fast with WMP and accurately as far as I can tell. The only only downside is that it won't handle MP4 files via MCI.

So I've been trying VLC which works fine as far as the API goes. However using the same files which worked fine under WMP are slow to position under VLC and not very accurate. Where in WMP I can do it to the frame give or take one. In VLC, with the same files, it's slow to position and way out on accuracy. Although I did notice MP4 files were better, usually within the second although much slower to get there.

I can appreciate the challenges when doing this and the lack of proper indexing must make it difficult. There must be a better way of doing this if WMP can do it though?

Don't get me wrong me wrong. I think VLC is a great program, probably the best WMP alternative out there. The less Microsoft programs I use the better I feel. :D Just VLC seems lacking in this department.

Regards
Mark

sparkz
New Cone
New Cone
Posts: 3
Joined: 26 Mar 2012 09:42

Re: Precision when seeking

Postby sparkz » 28 Mar 2012 06:04

Is there any chance of having a new state so that when it's still trying to work out the position you can tell from the current state?

Currently, if I set a time and get the time back it just has the same time I just set. However after a few seconds this has usually changed so it's obviously still seeking. It would be great if it was possible to tell when it has finished seeking.

I did try looking at the stats but that doesn't seem to change between after the "set_time" and when the picture has finally settled.

Also, is there any way of speeding this up so it's as good as WMP? With WMP I get almost instant positioning and even if it's not it's easy to check when it's ready.

freesunshine
Blank Cone
Blank Cone
Posts: 32
Joined: 18 Mar 2012 13:37

Re: Precision when seeking

Postby freesunshine » 28 Mar 2012 16:11

set gop to a small value like 12 would make it better; gop=12 provides a 12/fps second Accuracy。

sparkz
New Cone
New Cone
Posts: 3
Joined: 26 Mar 2012 09:42

Re: Precision when seeking

Postby sparkz » 29 Mar 2012 02:29

Thanks I'll try that.

I assume that's the command:
#sout-switcher-gop=


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 19 guests