Handbrake --stop-at parameter not working as intended

7

2

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?

karlgrz

Posted 2010-12-29T19:51:55.250

Reputation: 259

Answers

4

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.

karlgrz

Posted 2010-12-29T19:51:55.250

Reputation: 259

9

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

Stefan Schmidt

Posted 2010-12-29T19:51:55.250

Reputation: 498

1Have 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 – 2011-02-17T18:02:32.180

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 – 2011-02-23T06:37:16.897

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 – 2011-03-02T15:17:37.910

1This 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 – 2011-09-17T08:21:55.197

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 – 2011-09-17T08:30:00.597

Confusing that you're supposed to put "duration" where it says "unit"! How is "duration" a unit? I wrote "s" and it didn't work. – Janus Troelsen – 2013-02-01T19:11:31.793

1

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.

nonopolarity

Posted 2010-12-29T19:51:55.250

Reputation: 7 932