Selecting part of an MPEG file

About encoding, codec settings, muxers and filter usage
highlysceptical
Blank Cone
Blank Cone
Posts: 12
Joined: 07 Nov 2005 22:15

Selecting part of an MPEG file

Postby highlysceptical » 11 Dec 2005 21:15

Is there any way to trim parts of an MPEG file - for example, to trim unwanted bits from the beginning and the end?

fkuehne
Developer
Developer
Posts: 7264
Joined: 16 Mar 2004 19:37
VLC version: 0.4.6 - present
Operating System: Darwin
Location: Germany
Contact:

Postby fkuehne » 12 Dec 2005 18:44

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.
VideoLAN
Felix Paul Kühne
Medic. VLC developer for appleOS since before you were born.
Blog: https://www.feepk.net

h2g2bob
Blank Cone
Blank Cone
Posts: 46
Joined: 02 Oct 2005 13:09
Location: Exeter, UK

The answer

Postby h2g2bob » 12 Dec 2005 23:22

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.

fkuehne
Developer
Developer
Posts: 7264
Joined: 16 Mar 2004 19:37
VLC version: 0.4.6 - present
Operating System: Darwin
Location: Germany
Contact:

Postby fkuehne » 13 Dec 2005 18:08

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 ;)
VideoLAN
Felix Paul Kühne
Medic. VLC developer for appleOS since before you were born.
Blog: https://www.feepk.net

Clafoutis
Blank Cone
Blank Cone
Posts: 28
Joined: 06 Oct 2007 18:16

Re: The answer

Postby Clafoutis » 02 Jan 2008 08:57

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!

fkuehne
Developer
Developer
Posts: 7264
Joined: 16 Mar 2004 19:37
VLC version: 0.4.6 - present
Operating System: Darwin
Location: Germany
Contact:

Re: Selecting part of an MPEG file

Postby fkuehne » 02 Jan 2008 12:46

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.
VideoLAN
Felix Paul Kühne
Medic. VLC developer for appleOS since before you were born.
Blog: https://www.feepk.net

Clafoutis
Blank Cone
Blank Cone
Posts: 28
Joined: 06 Oct 2007 18:16

Re: Selecting part of an MPEG file

Postby Clafoutis » 03 Jan 2008 12:26

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...

fkuehne
Developer
Developer
Posts: 7264
Joined: 16 Mar 2004 19:37
VLC version: 0.4.6 - present
Operating System: Darwin
Location: Germany
Contact:

Re: Selecting part of an MPEG file

Postby fkuehne » 03 Jan 2008 13:03

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.
VideoLAN
Felix Paul Kühne
Medic. VLC developer for appleOS since before you were born.
Blog: https://www.feepk.net

Clafoutis
Blank Cone
Blank Cone
Posts: 28
Joined: 06 Oct 2007 18:16

Re: Selecting part of an MPEG file

Postby Clafoutis » 03 Jan 2008 13:12

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 ?

Clafoutis
Blank Cone
Blank Cone
Posts: 28
Joined: 06 Oct 2007 18:16

Re: Selecting part of an MPEG file

Postby Clafoutis » 03 Jan 2008 17:58

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...


Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 1 guest