Page 1 of 1

Selecting part of an MPEG file

Posted: 11 Dec 2005 21:15
by highlysceptical
Is there any way to trim parts of an MPEG file - for example, to trim unwanted bits from the beginning and the end?

Posted: 12 Dec 2005 18:44
by fkuehne
There is an option in the streaming-wizard which let's do that. It does also exist for the command-line. Have a look at ./VLC --longhelp --advanced to get the complete syntax.

The answer

Posted: 12 Dec 2005 23:22
by h2g2bob
Use the wizard or do something like this at the command line:

Code: Select all

vlc "FILENAME" --start-time=SECONDS --stop-time=SECONDS --sout='#std{access=file,mux=AVI,url="NEW_FILENAME"}'
AVI can be "ps" if it's an mpg or "ogg" if it's an ogg or whatever. Use a whole number of seconds and no fancy stuff.

Posted: 13 Dec 2005 18:08
by fkuehne
Just a side note: our AVI-muxer is pretty broken, so I highly encourage you to use another one, such as MP4. AVI-files created by VLC might not even play using our own demuxer ;)

Re: The answer

Posted: 02 Jan 2008 08:57
by Clafoutis
Use the wizard or do something like this at the command line:

Code: Select all

vlc "FILENAME" --start-time=SECONDS --stop-time=SECONDS --sout='#std{access=file,mux=AVI,url="NEW_FILENAME"}'

Hello!

Wanting to crop a mpeg file, I found this example, thanks to you all VLCpeople.
Trying this, I use a command line way and get it, but if I actually end the transcoding at the desired stop-time, I get the full beginning of the file, as if I had set : start-time=0
How can I effectively set start and end of my transcodings ?
Thank you!

Re: Selecting part of an MPEG file

Posted: 02 Jan 2008 12:46
by fkuehne
You need to provide both start-time and stop-time before trying to transcode. Additionally, make sure that you're using the latest release of VLC, as this feature used to be broken in earlier releases. Note that you can also use the Streaming / Transcoding wizard on all platforms to create excerpts of your clips.

Re: Selecting part of an MPEG file

Posted: 03 Jan 2008 12:26
by Clafoutis
Thanks!
Can you explain the subtleties between the syntax variants : --start-time 164, --start-time=164, --start-time="164", the help pages are sometimes difficult to understand...

I try to do the extraction from an application I am writing, it sends command lines to VLC, as following :

Code: Select all

/Applications/VLC\-0.8.6c.app/Contents/MacOS/VLC --start-time=164 --stop-time=177 /Users/fl/AVideos/xtrac.mpg --sout='#transcode{acodec=mpga,vcodec=mp1v}:standard{mux=ts,access=file,dst=/Users/fl/AVideos/xtrac.ts}'
What is wrong in this line, why is there no time cropping of the movie ? VLC protests, saying there is no module for start-time or stop-time, as if is was considering these parameters as elements of a playlist. So my syntax must be wrong somewhere... Should I put the start and stop times within the {...} ?
Thanks...

Re: Selecting part of an MPEG file

Posted: 03 Jan 2008 13:03
by fkuehne
Start and stop-time could be embedded in the sout command, but preferably, just move them to the end of your command-line, so it's like this

Code: Select all

/Applications/VLC\-0.8.6c.app/Contents/MacOS/VLC /Users/fl/AVideos/xtrac.mpg --sout='#transcode{acodec=mpga,vcodec=mp1v}:standard{mux=ts,access=file,dst=/Users/fl/AVideos/xtrac.ts}' --start-time=164 --stop-time=177
As you posted earlier, the input stream is always at the first position of VLC's command-line.

Re: Selecting part of an MPEG file

Posted: 03 Jan 2008 13:12
by Clafoutis
Start and stop-time could be embedded in the sout command, but preferably, just move them to the end of your command-line
So VLC accepts different syntaxes, but what are the different effects one can expect ?
Could you post different rightful variants of this command, embedded and not embedded, but correct so I can try them ?
the input stream is always at the first position of VLC's command-line.
Ok, so my previous example could not work.
But the --sout... and --start-time... pieces would not be considered as different commands and not one complex command ?
And what about the --somecommand and -somecommand variants ?

Re: Selecting part of an MPEG file

Posted: 03 Jan 2008 17:58
by Clafoutis
After several essays, it seems VLC uses the stop-time item but not the start-time one. I think I have read this somewhere else... Is this a known bug, and is there a solution ?

Thanks...