How do I turn off "Two Pass" to one with HandbrakeCLI?

Discussion of the HandBrake command line interface (CLI)
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
imkow
Posts: 3
Joined: Sat Jun 25, 2016 8:25 am

How do I turn off "Two Pass" to one with HandbrakeCLI?

Post by imkow » Sat Jun 25, 2016 8:47 am

Please detail your question or problem in as much detail as possible:
I've been using HandbrakeCli for several years. I always use the nightly build.
In recent month or so, I found encoding took longer time..then i discovered the HandbrakeCli turns ON the two passes by default.
thus doubled my encoding time...I want to turn it off and have one pass only, but i checked the help text on HandbrakeCli options and found no such an option..I need one pass..

Tell us about your environment. What version of HandBrake? What operating system are you running. etc.
Im using "HandBrakeCLI-20160620144024-31be008-master-win-x86_64.zip"
under an up-to-date Windows 10 64bit
If there was any exception or error displayed, please copy it and paste it here:

a part of output showing
"Video": {
"Bitrate": 1382,
"ColorMatrixCode": 0,
"Encoder": "qsv_h264",
"OpenCL": true,
"Options": "target-usage=1:extbrc=1:trellis=3:lookahead-depth=60:keyint=
120",
"QSV": {
"AsyncDepth": 4,
"Decode": true
},
"Turbo": true,
"TwoPass": true <--------!!!!!!!!! no, it's automatically two passes
}

this is my encoding command:

Code: Select all

HandBrakeCLI.exe -i "K:\_input\1080.mp4" -o "K:\_output\_transcoding\1080_video.m4v" --use-opencl --encoder qsv_h264 --encopts="target-usage=1:extbrc=1:trellis=3:lookahead-depth=60:keyint=120" --vb 1382 --width 1280 --height 720 --custom-anamorphic --display-width 1280 --audio none --verbose 3
i did not specify Two Passes...

rollin_eng
Veteran User
Posts: 3046
Joined: Wed May 04, 2011 11:06 pm

Re: How do I turn off "Two Pass" to one with HandbrakeCLI?

Post by rollin_eng » Sat Jun 25, 2016 9:22 am

Could you please post your logs, instructions can be found here:

viewtopic.php?f=6&t=31236

imkow
Posts: 3
Joined: Sat Jun 25, 2016 8:25 am

Re: How do I turn off "Two Pass" to one with HandbrakeCLI?

Post by imkow » Sat Jun 25, 2016 10:08 am

rollin_eng wrote:Could you please post your logs, instructions can be found here:

viewtopic.php?f=6&t=31236

Code: Select all

[17:56:14] hb_init: starting libhb thread
[17:56:14] thread 455c1c0 started ("libhb")
HandBrake 20160620144024-31be008-master (2016062201) - MinGW x86_64 - https://handbrake.fr
8 CPUs detected
Opening K:\_input\720p.mp4...
[17:56:14] CPU: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
[17:56:14]  - Intel microarchitecture Haswell
[17:56:14]  - logical processor count: 8
[17:56:14] OpenCL device #1: NVIDIA Corporation GeForce GTX 970
[17:56:14]  - OpenCL version: 1.2 CUDA
[17:56:14]  - driver version: 358.91
[17:56:14]  - device type:    GPU
[17:56:14]  - supported:      no
[17:56:14] OpenCL device #2: Intel(R) Corporation Intel(R) HD Graphics 4600
[17:56:14]  - OpenCL version: 1.2
[17:56:14]  - driver version: 20.19.15.4331
[17:56:14]  - device type:    GPU
[17:56:14]  - supported:      YES
[17:56:14] Intel Quick Sync Video support: yes
[17:56:14]  - Intel Media SDK hardware: API 1.17 (minimum: 1.3)
[17:56:14]  - H.264 encoder: yes
[17:56:14]     - preferred implementation: hardware (any)
[17:56:14]     - capabilities (hardware):  breftype icq+la+i+downs vsinfo opt1 opt2+mbbrc+extbrc+trellis+ib_adapt+nmpslice
[17:56:14]  - H.265 encoder: no
[17:56:14] hb_scan: path=K:\_input\720p.mp4, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
src/libbluray/disc/disc.c:274: failed opening UDF image K:\_input\720p.mp4
src/libbluray/disc/disc.c:352: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:352: error opening file BDMV\BACKUP\index.bdmv
[17:56:14] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 5.0.1
libdvdread: Encrypted DVD support unavailable.
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[17:56:14] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'K:\_input\720p.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2013-07-22 15:04:13
  Duration: 00:17:07.62, start: 0.000000, bitrate: 2344 kb/s
    Stream #0.0(und): Video: h264 (High), yuv420p, 1280x720, 2192 kb/s, 29.97 fps, 30k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2013-07-22 15:04:13
    Stream #0.1(und): Audio: aac, 44100 Hz, stereo, fltp, 148 kb/s (default)
    Metadata:
      creation_time   : 2013-07-22 15:04:28
[17:56:14] scan: decoding previews for title 1
[17:56:14] scan: audio 0x1: aac, rate=44100Hz, bitrate=148271 Unknown (AAC) (2.0 ch)
Scanning title 1 of 1, preview 6, 60.00 %[17:56:14] scan: 10 previews, 1280x720, 29.970 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1
[17:56:14] scan: supported video decoders: avcodec qsv
[17:56:14] libhb: scan thread found 1 valid title(s)
+ Using preset: Fast 1080p30
+ title 1:
  + stream: K:\_input\720p.mp4
  + duration: 00:17:07
  + size: 1280x720, pixel aspect: 1/1, display aspect: 1.78, 29.970 fps
  + autocrop: 0/0/0/0
  + support opencl: yes
  + chapters:
    + 1: cells 0->0, 0 blocks, duration 00:17:07
  + audio tracks:
    + 1, Unknown (AAC) (2.0 ch) (iso639-2: und)
  + subtitle tracks:
[17:56:15] 1 job(s) to process
[17:56:15] json job:
{
    "Audio": {
        "AudioList": [],
        "CopyMask": [
            "copy:aac"
        ],
        "FallbackEncoder": "av_aac"
    },
    "Destination": {
        "ChapterList": [
            {
                "Name": ""
            }
        ],
        "ChapterMarkers": false,
        "File": "K:\_output\720p_video.m4v",
        "Mp4Options": {
            "IpodAtom": false,
            "Mp4Optimize": false
        },
        "Mux": "m4v"
    },
    "Filters": {
        "FilterList": [
            {
                "ID": 3,
                "Settings": {
                    "block-height": "16",
                    "block-thresh": "40",
                    "block-width": "16",
                    "filter-mode": "2",
                    "mode": "3",
                    "motion-thresh": "1",
                    "spatial-metric": "2",
                    "spatial-thresh": "1"
                }
            },
            {
                "ID": 4,
                "Settings": {
                    "mode": "7"
                }
            },
            {
                "ID": 6,
                "Settings": {
                    "mode": 2,
                    "rate": "27000000/1125000"
                }
            },
            {
                "ID": 11,
                "Settings": {
                    "crop-bottom": 0,
                    "crop-left": 0,
                    "crop-right": 0,
                    "crop-top": 0,
                    "height": 720,
                    "width": 1280
                }
            }
        ]
    },
    "Metadata": {},
    "PAR": {
        "Den": 1280,
        "Num": 1280
    },
    "SequenceID": 0,
    "Source": {
        "Angle": 0,
        "Path": "K:\\_input\\720p.mp4",
        "Range": {
            "End": 1,
            "Start": 1,
            "Type": "chapter"
        },
        "Title": 1
    },
    "Subtitle": {
        "Search": {
            "Burn": true,
            "Default": false,
            "Enable": false,
            "Forced": false
        },
        "SubtitleList": []
    },
    "Video": {
        "Bitrate": 1382,
        "ColorMatrixCode": 0,
        "Encoder": "qsv_h264",
        "OpenCL": true,
        "Options": "target-usage=1:extbrc=1:trellis=3:lookahead-depth=60:keyint=120",
        "QSV": {
            "AsyncDepth": 4,
            "Decode": false
        },
        "Turbo": true,
        "TwoPass": true             <-----!!!this is where I think it's wrong, I just want one pass...but I dont know how to change this
    }
}
[17:56:15] starting job
[17:56:15] decomb filter thread started for segment 0
[17:56:15] decomb filter thread started for segment 7
[17:56:15] decomb filter thread started for segment 2
[17:56:15] job configuration:
[17:56:15] yadif thread started for segment 6
[17:56:15]  * source
[17:56:15] decomb filter thread started for segment 4
[17:56:15] decomb filter thread started for segment 5
[17:56:15] decomb filter thread started for segment 6
[17:56:15] decomb filter thread started for segment 1
[17:56:15]    + K:\_input\720p.mp4
[17:56:15] decomb check thread started for segment 0
[17:56:15] decomb check thread started for segment 1
[17:56:15] decomb check thread started for segment 2
[17:56:15] decomb check thread started for segment 3
[17:56:15]    + title 1, chapter(s) 1 to 1
[17:56:15] decomb check thread started for segment 4
[17:56:15] decomb check thread started for segment 5
[17:56:15] decomb check thread started for segment 6
[17:56:15] mask erode thread started for segment 4
[17:56:15] mask filter thread started for segment 0
[17:56:15] mask filter thread started for segment 1
[17:56:15] mask filter thread started for segment 2
[17:56:15] mask filter thread started for segment 3
[17:56:15] mask filter thread started for segment 4
[17:56:15] mask filter thread started for segment 5
[17:56:15] mask filter thread started for segment 6
[17:56:15]    + container: mov,mp4,m4a,3gp,3g2,mj2
[17:56:15] mask filter thread started for segment 7
[17:56:15] mask erode thread started for segment 0
[17:56:15] mask erode thread started for segment 1
[17:56:15] mask erode thread started for segment 2
[17:56:15] mask erode thread started for segment 3
[17:56:15] decomb check thread started for segment 7
[17:56:15] mask erode thread started for segment 5
[17:56:15] mask erode thread started for segment 6
[17:56:15] mask erode thread started for segment 7
[17:56:15] mask dilate thread started for segment 0
[17:56:15] mask dilate thread started for segment 1
[17:56:15] mask dilate thread started for segment 2
[17:56:15] mask dilate thread started for segment 3
[17:56:15] mask dilate thread started for segment 4
[17:56:15] mask dilate thread started for segment 6
[17:56:15] mask dilate thread started for segment 5
[17:56:15] mask dilate thread started for segment 7
[17:56:15]    + data rate: 2344 kbps
[17:56:15] yadif thread started for segment 0
[17:56:15] yadif thread started for segment 1
[17:56:15] yadif thread started for segment 2
[17:56:15] yadif thread started for segment 3
[17:56:15] yadif thread started for segment 4
[17:56:15] yadif thread started for segment 5
[17:56:15] decomb filter thread started for segment 3
[17:56:15] yadif thread started for segment 7
[17:56:15]  * destination
[17:56:15]    + K:\_output\720p_video.m4v
[17:56:15]    + container: MPEG-4 (libavformat)
[17:56:15]  * video track
[17:56:15]    + decoder: h264
[17:56:15]      + bitrate 2192 kbps
[17:56:15]    + filters
[17:56:15]      + Comb Detect (mode=3:spatial-metric=2:motion-thresh=1:spatial-thresh=1:filter-mode=2:block-thresh=40:block-width=16:block-height=16)
[17:56:15]      + Decomb (mode=39)
[17:56:15]      + Framerate Shaper (mode=2:rate=27000000/1125000)
[17:56:15]        + frame rate: 29.970 fps -> peak rate limited to 24.000 fps
[17:56:15]      + Crop and Scale (width=1280:height=720:crop-top=0:crop-bottom=0:crop-left=0:crop-right=0)
[17:56:15]        + source: 1280 * 720, crop (0/0/0/0): 1280 * 720, scale: 1280 * 720
[17:56:15]    + Output geometry
[17:56:15]      + storage dimensions: 1280 x 720
[17:56:15]      + pixel aspect ratio: 1280 : 1280
[17:56:15]      + display dimensions: 1280 x 720
[17:56:15]    + encoder: H.264 (Intel Media SDK)
[17:56:15]      + options: target-usage=1:extbrc=1:trellis=3:lookahead-depth=60:keyint=120
[17:56:15]      + bitrate: 1382 kbps, pass: 1
[17:56:15] sync: expecting 30798 video frames
Encoding: task 1 of 2, 0.00 %[17:56:15] encqsvInit: using encode-only path
[17:56:15] encqsvInit: H.264/AVC High profile @ level 3.1
[17:56:15] encqsvInit: TargetUsage 1 AsyncDepth 4
[17:56:15] encqsvInit: GopRefDist 3 GopPicSize 120 NumRefFrame 3
[17:56:15] encqsvInit: BFramesMax 2 BRefType off
[17:56:15] encqsvInit: RateControlMethod LA TargetKbps 1382 LookAheadDepth 60
[17:56:15] encqsvInit: Trellis on (IPB)
[17:56:15] sync: first pts video is 0
[17:56:15] sync: Chapter 1 at frame 1 time 0
Encoding: task 1 of 2, 0.12 %[17:56:15] qsv_enc_init: using 'hardware (2)' implementation, API: 1.17
Encoding: task 1 of 2, 35.95 % (179.02 fps, avg 174.74 fps, ETA 00h01m53s)
is this the log you need?....the encoding is generally ok...just the 2 pass took a lot of time

rollin_eng
Veteran User
Posts: 3046
Joined: Wed May 04, 2011 11:06 pm

Re: How do I turn off "Two Pass" to one with HandbrakeCLI?

Post by rollin_eng » Sat Jun 25, 2016 11:23 am

Not 100% sure on this but it appears to be defaulting to preset: Fast 1080p30.

This preset uses cq mode but for some reason has 2 pass and turbo enabled, by setting the bitrate you are overriding the cq and thus activating the 2 pass.

That's my guess anyway.

imkow
Posts: 3
Joined: Sat Jun 25, 2016 8:25 am

Re: How do I turn off "Two Pass" to one with HandbrakeCLI?

Post by imkow » Sat Jun 25, 2016 1:18 pm

rollin_eng wrote:Not 100% sure on this but it appears to be defaulting to preset: Fast 1080p30.

This preset uses cq mode but for some reason has 2 pass and turbo enabled, by setting the bitrate you are overriding the cq and thus activating the 2 pass.

That's my guess anyway.
Thank you for pointing out to the presets. I didn't notice the presets...When I looked into those presets i found out the settings in preset is far more detailed than command line switches.
Maybe sometime in recent months, the preset system has been redesigned to replace the "Legacy" presets ..So in nightly builds, every new preset is, by a minor mistake, enabled Two Pass and Turbo Two Passes with TRUE, including those "Very Fast" presets...The trouble is HandbrakeCLI provides no "force one pass" switch to turn off the two pass settings.
i currently get a workaround.. by export and import the preset,
first to see all presets

Code: Select all

handbrakecli --preset-list
find a desired preset and export it to a file

Code: Select all

handbrakecli --preset-export "HQ 1080p30 Surround" --preset-export-file "HQ1080p30Surround.txt"
edit the HQ1080p30Surround.txt, turn off two pass switches.

Code: Select all

           
           "VideoTurboTwoPass": true, -->false,
            "VideoTwoPass": true, -->false,
import the file in command line when encoding

Code: Select all

HandBrakeCLI.exe -i "K:\_input\1080.mp4" -o "K:\_output\_transcoding\1080_video.m4v" --use-opencl --encoder qsv_h264 --encopts="target-usage=1:extbrc=1:trellis=3:lookahead-depth=60:keyint=120" --vb 1382 --width 1280 --height 720 --custom-anamorphic --display-width 1280 --audio none --verbose 3  --preset-import-file "MyOnePassHQ1080p30Surround.txt"     <<<----!! import the corrected preset
then it become one pass happily!...
though this could be easier if there were a command line switch(e.g. --one-pass)to force one pass or turn off two pass..
it's just a tiny bug of imperfection in the nightly build...no biggie :_)

User avatar
BradleyS
Moderator
Posts: 1530
Joined: Thu Aug 09, 2007 12:16 pm

Re: How do I turn off "Two Pass" to one with HandbrakeCLI?

Post by BradleyS » Sat Jun 25, 2016 3:56 pm

@imkow Thanks for bringing this to our attention. The new presets do indeed use constant quality by default, but also have similar 2-pass abr settings available just a click away. We need to add --no-two-pass and --no-turbo (or similar) to make it easy to override this on the CLI.

Also, if/when this lands the default preset on the CLI will be mostly automatic settings, so there is less to override in general (you can still import and use presets from file/GUI).

User avatar
BradleyS
Moderator
Posts: 1530
Joined: Thu Aug 09, 2007 12:16 pm

Re: How do I turn off "Two Pass" to one with HandbrakeCLI?

Post by BradleyS » Sat Jun 25, 2016 4:01 pm

I created a new issue on GitHub in case you would like to watch for any code updates: https://github.com/HandBrake/HandBrake/issues/234

In the meantime, your solution of using a custom preset is the correct workaround. Thanks!

Post Reply