Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

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

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.