Page 1 of 1

Looping (part of) video using LibVLC

Posted: 26 Jan 2011 10:38
by fishstyc
Hello,

I am looking for a nice way to loop video, or a part of a video using LibVLC.

What I did until now, was call play again, as soon as the status was libvlc_ended. This pauses the video for a few ms, while vlc starts to play again.

Then there's also the options
  • --input-repeat=
  • --start-time=
  • --stop-time=
  • --run-time= (I don't really know what this does yet)
This works to a certain extent, because If I add start and stop-times, and I set input repeat to 5 for example, there is no problem, but for some reason the thing stops responding when I set input-repeat to 50 or more. Is there an option that means 'infinite'?

Another option would be for me to count the frames myself, and then do a seek when needed, but this is not so easy (also because the length reported by media_get_length for video files is often less than what player_get_position returns when reaching the end of the video file. I suppose this is a bug, but working around that is not easy, obviously).

Anyway, I am just searching for the best option to implement seamless looping. Any ideas are welcome.

Re: Looping (part of) video using LibVLC

Posted: 28 Jan 2011 19:05
by mangokm40
When I tried this:

libvlc_media_add_option(vlcMedia, "input-repeat=-1");

The video looped. I let the 14-second test clip run for about 5 minutes.

I don't know if that's what you want.

Re: Looping (part of) video using LibVLC

Posted: 30 Jan 2011 10:51
by fishstyc
Absolutely.

I thought I tried that, but appearantly I didn't.

Thanks a lot.