Page 1 of 1

Exporting with IN and OUT

Posted: 21 Jul 2009 14:30
by Gawain
I'm new at streaming with VLC but I was wondering if it is possible to export/stream a section of a video to a file by setting IN and OUT. I'm developing a software where I want to cut out different parts of a video and create a new file with only that parts. What would be the best way to do that using JVLC?
Thanks a lot for helping me!

Re: Exporting with IN and OUT

Posted: 21 Jul 2009 16:45
by thannoy
Note: I don't know about jvlc bindings, this is a more general idea based on VLC usages.

You can try to stream a playlist to a file with start-time and run-time or stop-time for each item.

Idea is as follow:
- add foo.ts with options :start-time=5 :stop-time=9
- add foo.ts with options :start-time=17 :stop-time=50
- add foo.ts with options :start-time=54 :stop-time=90

And sout all the playlist to a file (maybe giving this sout parameter to libvlc_new if you can do it with jvlc)
--sout=file/ts://output.ts

The same using a command line would be like this (for Linux):

Code: Select all

# Here, vlc will also quit when the work is done vlc --sout file/ts://output.ts foo.ts :start-time=5 :stop-time=9 foo.ts :start-time=17 :stop-time=50 ... vlc://quit
But I'm afraid that "--start-time" option is bugous (it was in summer '08 iirc) and does nothing. Hope it is no more the case.
If it is the case, inform about and I will create a ticket on the bug tracker.

Re: Exporting with IN and OUT

Posted: 22 Jul 2009 11:15
by Gawain
thanks for your help and the hint for using a playlist. I will try that out later!

Now I'm trying to find out where to put the start-time and stop-time in the option-string in JVLC. Has anyone used that before?
This is my current code, but it dosn't work :-(

Code: Select all

JVLC jvlc = new JVLC(JVLC_PARAMS); MediaDescriptor mediaDescriptor = new MediaDescriptor(jvlc, getPath()); mediaDescriptor.addOption(":sout=#duplicate{dst=std{access=file,dst=" + this.path + "}}:start-time=100:stop-time=1000"); MediaPlayer player = mediaDescriptor.getMediaPlayer(); player.play();

Re: Exporting with IN and OUT

Posted: 22 Jul 2009 11:45
by thannoy
give this a try (adding spaces):

Code: Select all

JVLC jvlc = new JVLC(JVLC_PARAMS); MediaDescriptor mediaDescriptor = new MediaDescriptor(jvlc, getPath()); mediaDescriptor.addOption(":sout=#duplicate{dst=std{access=file,dst=" + this.path + "}} :start-time=100 :stop-time=1000"); MediaPlayer player = mediaDescriptor.getMediaPlayer(); player.play();
NB1: start/stop time are in seconds from the beginning of the media.
NB2: Maybe a --sout-keep will be needed as a global VLC option to append the result in output file instead of overwriting it for each media.

Re: Exporting with IN and OUT

Posted: 22 Jul 2009 11:51
by Gawain
no, it's still exporting the whole video.

Re: Exporting with IN and OUT

Posted: 02 Sep 2009 12:27
by Gawain
@thannoy: I tried to export several section of one video just like you've told be. Either in Java but also with the command line. In both ways it only exports the last section I'm setting. I seams that the sections before are ignored or overwritten. It also only uses the start-time and doesn't really stop the export. Do you have any idea how to work around that problem?