Looping (part of) video using LibVLC

This forum is about all development around libVLC.
fishstyc
Blank Cone
Blank Cone
Posts: 40
Joined: 19 Oct 2010 12:39

Looping (part of) video using LibVLC

Postby fishstyc » 26 Jan 2011 10:38

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.

mangokm40
Cone that earned his stripes
Cone that earned his stripes
Posts: 130
Joined: 20 May 2010 20:00

Re: Looping (part of) video using LibVLC

Postby mangokm40 » 28 Jan 2011 19:05

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.

fishstyc
Blank Cone
Blank Cone
Posts: 40
Joined: 19 Oct 2010 12:39

Re: Looping (part of) video using LibVLC

Postby fishstyc » 30 Jan 2011 10:51

Absolutely.

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

Thanks a lot.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 10 guests