script for extracting fragment of a video

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
pbergon
New Cone
New Cone
Posts: 3
Joined: 16 Mar 2011 00:06

script for extracting fragment of a video

Postby pbergon » 16 Mar 2011 00:18

Dear all,

I´m sorry but I´ve just registered in the forum and it´s the first time I´m trying to develop a script with VLC.

For my degree project i need a script to extract a fragment of a video. The script would have as input the video and the time of beginning and ending of the fragment to extract. For instance as an input: (video.flv, beginning time: 0:25, ending time: 0:56)

Can anybody help me with a piece of useful information, some code would be perfect ;)?

I would be very very grateful.

Regards

pbergon
New Cone
New Cone
Posts: 3
Joined: 16 Mar 2011 00:06

Re: script for extracting fragment of a video

Postby pbergon » 16 Mar 2011 09:54

I´ve been reading the forum and i´ve not seen posts about how to extract video segments automatically with a script.

Please, please, can anybody give me some example code or some information about how to do that.

It is very important

Thank you all very very much.

mario123
New Cone
New Cone
Posts: 9
Joined: 08 Mar 2011 16:21

Re: script for extracting fragment of a video

Postby mario123 » 16 Mar 2011 15:49

Hi,

You can try something like this:
vlc "d:\source.avi" :start-time=140 :stop-time=160 :sout=#transcode{vcodec=h264}:file{dst=dest.mp4} vlc://quit

It starts your vlc player, starts playing source.avi from position 140 (seconds) until position 160 (seconds), dumps it in a file dest.mp4 and closes the vlc player.

pbergon
New Cone
New Cone
Posts: 3
Joined: 16 Mar 2011 00:06

Re: script for extracting fragment of a video

Postby pbergon » 16 Mar 2011 16:56

Hi Mario,

thank you very very much for your answer.

I´m sorry but I´m not sure about how using your code. I´m on my first steps with VLC and I still don´t know very well how it works... I think it is a command line to introduce in the console, but what I really need is a script. I´m working with Windows.

I mean, the situation would be:

I received a petition with some parameters (the video source, start-time and stop-time). My script generates the code with these parameters (similar to your code line) and finally returns the new file.

Could you help me a little more :)? Maybe a dummies handbook?

You can´t imagine how helpful would it be...

mario123
New Cone
New Cone
Posts: 9
Joined: 08 Mar 2011 16:21

Re: script for extracting fragment of a video

Postby mario123 » 17 Mar 2011 08:33

Hi pbergon.

I don't write scripts myself, I use VLC in C# and C++ programs. So I can't present you a working script. But I suppose you use the same activeX API like I do. And yes, my previous example is a command line. But you can use command line parameters with the vlc.playlist.add() function (use the option parameter of this function) or the setVariable() function in the old version of the VLC plugin. I tested the command line example, it works for me. I did not test it with the vlc.playlist.add() function. So I don't know that it works but in your case, I would try something like that.


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 7 guests