Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I run the following from command line:

handbrakeCLI.exe -i SourceFile.mkv -o OutputFile.mkv --stop-at 120

According to the CLIGuide you can supply the --stop-at value as seconds (which is what I want, stop encoding 120 seconds into the file).

My purpose for this is to quickly create a very high quality video clip from a full movie for testing other encoding processes.

However, when I view my output file, it is the entire movie. Any ideas?

share|improve this question

The answer can be found in Handbrake's help:

handbrakeCLI.exe --help

The correct syntax is as follows:

--stop-at     <unit:#>  Stop encoding at a given frame, duration (in seconds),
                        or pts (on a 90kHz clock)

Example:

handbrakeCLI.exe -i SourceFile.mkv -o OutputFile.mkv --stop-at duration:120

This will give you the first 120 seconds of the video

share|improve this answer
    
Have you actually tried that? That command looks like what you want, but in my experiments it processed the ENTIRE video asset, when all I wanted was the first two minutes. Fail. – karlgrz Feb 17 '11 at 18:02
    
Yes I've used the command successfully. It's important to specify the duration keyword and a colon prior to the duration, otherwise it won't work. – Stefan Schmidt Feb 23 '11 at 6:37
    
GREAT point! Thanks for the follow up! I'm still going with FFmpeg, as I'm more comfortable with it and use it a lot. – karlgrz Mar 2 '11 at 15:17
    
This used to work for me, but now I was encoding a file where the --stop-at parameter was ignored (i.e. no matter what I set it to, HandBrakeCLI would always encode the entire remaining file), while the --start-at parameter was respected. Any clues? – kynan Sep 17 '11 at 8:21
    
Note that --stop-at duration:120 means encode 120 seconds and will not stop at 120 sec into the video when combined with --start-at and a duration > 0. This is a little counter-intuitive and is what confused me there. – kynan Sep 17 '11 at 8:30
up vote 4 down vote accepted

Ok, so I decided to solve my problem with ffmpeg as such:

ffmpeg -i SourceFile.mkv -ss 00:00:05 -t 00:02:30 -ac 2 -sn OutputFile.mkv

Explanation:

  • ss : seek start, or "Begin my encoding at this point in time" (hh:mm:ss)
  • t : duration (hh:mm:ss)
  • ac : audio channels, since this particular movie was having a problem disseminating the audio tracks during encoding
  • sn : suppress subtitles, as ffmpeg was complaining about the subtitle track

This worked perfectly for what I was looking for.

share|improve this answer

As of April 2015, this is what I found, and I wonder if it would change in the future:

--start-at duration:120 --stop-at duration:60

The start-at duration is really "start at" some point. The stop-at duration is really a length (a true duration). So the word duration means different things. The line above means: start at 00:02:00, and for 60 seconds. So a quick way to remember it is: start-at is at a point, and stop-at is for a length.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .