How do I get VLC to spit out sections of a movie?
July 23, 2010 3:09 PM   Subscribe

I'd like to be able to easily extract clips from movies using VLC, or equivalent. Is there anyway to do this easily? It seems like it should be possible for me to cue up a text fils with time stamps I want extracted and VLC will spit it out for me. Any ideas on how to accomplish this?

I'm really for any method that doesn't involve me loading up Final Cut Pro or equivalent.
posted by anonymous unit 4000 to Computers & Internet (13 answers total) 10 users marked this as a favorite
 
VLC really isn't built for that. Try using VirtualDub. Intro to cropping is here.
posted by griphus at 3:39 PM on July 23, 2010


Sounds like you might be a Mac user, but if not I've used Windows Live Movie Maker, it's simple and free. Just import the video, set start and end point, export to a variety of device formats or publish to YouTube.
posted by simms2k at 3:42 PM on July 23, 2010


Response by poster: I'm a Windows users. I should have added that most of the films are Matroska/x264 which VirtualDub doesn't support. It looks like VirtualDubMod does, but with the caveat that the support is "old and simple."
posted by anonymous unit 4000 at 3:48 PM on July 23, 2010


This is where you need something like ffmpeg or mencoder (I think there are Windows ports).
$ mencoder input.mp4 -oac copy -ovc copy -ss 1:15:35 -endpos 15 -o output.mp4
$ ffmpeg -i input.mp4 -s 10 -t 30 output.mp4
Pretty much extract from a start position for a length in seconds or hh:mm:ss.xxx times, optionally doing random conversions.
posted by zengargoyle at 4:08 PM on July 23, 2010


http://www.winxdvd.com/dvd-ripper-platinum/

permits you to set start and stop sections to rip from the disk, nice tool overall. Check out the manual pdf.
posted by Freedomboy at 4:40 PM on July 23, 2010


Implicit in your question is whether you want to re-encode the video or not. All modern video codecs work by having a stream of several different frame types: I, P, and B. I frames (aka keyframes) stand alone and don't depend on other frames; P frames depend on previous frames, and B frames can depend on previous and future frames. What does this mean? If you try to make your 'start time' of your cut on a P frame then the stream is invalid because that frame depends on information that you've removed. This means you have to decode the clip and re-encode it again so that the starting frame can be an I frame -- this means a loss of quality. The same is true of the end time and B frames. The only way that you can losslessly cut video that's encoded this way is to make sure all your start and end times fall on I frames.

I think, but haven't verified, that if you instruct ffmpeg/mencoder to do a stream copy it will do this rounding for you so that it doesn't have to re-encode anything -- that means you won't necessarily get the start/end times that you ask for. If you really want to rigidly stick to the given start/end times then you will have to specify encoding options (e.g. bitrate, codec) and you won't be able to do a stream copy.
posted by Rhomboid at 5:11 PM on July 23, 2010 [1 favorite]


(And obviously you can minimize the quality loss by making the output bitrate somewhat larger than the input bitrate, but that's counterintuitive to a lot of people.)
posted by Rhomboid at 5:14 PM on July 23, 2010


And this is also why h.264 added intra-only profiles (i.e. all I frames) for use by cameras/camcorders, so that you can trade off compression for editability.
posted by Rhomboid at 5:16 PM on July 23, 2010


Rhomboid, I want to avoid transcoding if possible. How far apart are I Frames? Are we talking 5-10 seconds or longer?
posted by geoff. at 5:37 PM on July 23, 2010


(Oh, cover is blown! Just didn't want my previous question google-able to my name on request of my employer)
posted by geoff. at 5:39 PM on July 23, 2010


I use MPEG Streamclip for stuff like this.
posted by baho at 6:23 PM on July 23, 2010


It depends on the nature of the source material as I-frames tend to be chosen by the encoder when there's little or no opportunity for motion prediction, which usually occurs when you have a cut from one scene/angle to the next. But there's usually also an encoder option specifying the maximum number of frames between I-frames -- this is another trade-off that the encoder makes because more I-frames means smoother seeking during playback but larger overall bitrate. I think the default for x264 is FPS*10, i.e. 10 seconds, so it's probably not going to mess with your start/end points too much.

BTW, every once in a while you see this on youtube: the clip starts out distorted and macro-blocky and looking like scrambled cable for the first 5 or 10 seconds and then suddenly everything clears up almost instantly and from there on it looks perfectly normal. That is what happens when someone cuts a compressed stream on a P-frame without re-encoding -- it rather surprises me that software exists that allows creation of such an invalid stream.
posted by Rhomboid at 6:45 PM on July 23, 2010


MKVTtoolnix will split MKV files without reencoding. It's command line but there is a GUI for it
posted by wongcorgi at 6:55 PM on July 23, 2010


« Older Where to sell 240 Purolator car air filters?   |   What Companies Handle Country Specific Versions of... Newer »
This thread is closed to new comments.