Setting HB CLI 1.0.3 audio bitrate on MacOS Sierra

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
AndyA
Posts: 12
Joined: Mon Apr 10, 2017 5:45 pm

Setting HB CLI 1.0.3 audio bitrate on MacOS Sierra

Post by AndyA »

Hi, I read that the AAC encoder on Mac is the "best" (https://handbrake.fr/docs/en/latest/tec ... odecs.html)... So I'm trying this script on MacOS Sierra -

Code: Select all

/Applications/HandbrakeCLI --main-feature --input '/A Video Folder'  
  --output /A Video.mkv --markers --format av_mkv --encoder x264 
  --quality 18 --encoder-tune film --encoder-preset slow --encoder-profile auto 
  --encoder-level auto --vfr --aencoder copy --audio-copy-mask aac,ac3 
  --audio-fallback av_aac --mixdown 5point1  --ab 320 --arate 48
Even though I specify 320 as the bitrate it always ends up 160 using HB CLI on MacOS. I've tried 640 and other's but it always ends up 160. On windows when I try this it uses libavcodec with 256 (although still specifying 320).

On mac when I use the HB GUI I DO get 320 in the output.

Code: Select all

[13:38:23] job configuration:
[13:38:23]  * source
[13:38:23]    + /Volumes/D/Movies/Zootopia (2016)
[13:38:23]    + title 77, start 00:02:0.00 stop 00:03:0.00
[13:38:23]  * destination
[13:38:23]    + /A Video Folder.mkv
[13:38:23]    + container: Matroska (libavformat)
[13:38:23]      + chapter markers
[13:38:23]  * video track
[13:38:23]    + decoder: h264
[13:38:23]      + bitrate 200 kbps
[13:38:23]    + filters
[13:38:23]      + 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)
[13:38:23]      + Decomb (mode=39)
[13:38:23]      + Framerate Shaper (mode=2:rate=27000000/900000)
[13:38:23]        + frame rate: 23.976 fps -> peak rate limited to 30.000 fps
[13:38:23]      + Crop and Scale (width=1920:height=804:crop-top=138:crop-bottom=138:crop-left=0:crop-right=0)
[13:38:23]        + source: 1920 * 1080, crop (138/138/0/0): 1920 * 804, scale: 1920 * 804
[13:38:23]    + Output geometry
[13:38:23]      + storage dimensions: 1920 x 804
[13:38:23]      + pixel aspect ratio: 1 : 1
[13:38:23]      + display dimensions: 1920 x 804
[13:38:23]    + encoder: H.264 (libx264)
[13:38:23]      + preset:  slow
[13:38:23]      + options: ref=5:bframes=5
[13:38:23]      + profile: high
[13:38:23]      + level:   4.0
[13:38:23]      + quality: 18.00 (RF)
[13:38:23]  * audio track 1
[13:38:23]    + decoder: English (DTS) (5.1 ch) (track 1, id 0x711100)
[13:38:23]      + bitrate: 1536 kbps, samplerate: 48000 Hz
[13:38:23]    + mixdown: 5.1 Channels
[13:38:23]    + encoder: AAC (Apple AudioToolbox)
[13:38:23]      + bitrate: 320 kbps, samplerate: 48000 Hz
Here is the MacOS HB CLI output where I get 160 instead of the 320 I specified. Interestingly the audio settings in the json job show 112. I have no idea where that came from...

Code: Select all

[11:43:52] hb_init: starting libhb thread
[11:43:52] thread 70000c76f000 started ("libhb")
HandBrake 1.0.3 (2017022500) - Darwin x86_64 - https://handbrake.fr
6 CPUs detected
Opening /A Video Folder...
[11:43:52] CPU: Intel(R) Core(TM) i7-6850K CPU @ 3.60GHz
[11:43:52]  - logical processor count: 6
[11:43:52] hb_scan: path=/A Video Folder, title_index=0
[11:43:52] scan: BD has 12 title(s)
[11:43:52] bd: scanning title 1

...

[11:43:52] bd: playlist 00100.MPLS
[11:43:52] bd: duration is 01:53:29 (6809469 ms)
[11:43:52] bd: video id=0x1011, stream type=H.264, format 1080p
[11:43:52] bd: aspect = 16:9
[11:43:52] bd: audio id=0x711100, lang=English (DTS), 3cc=eng
[11:43:52] bd: audio id=0x1100, lang=English (DTS-HD MA), 3cc=eng

Scanning title 11 of 12, 45.83 %[11:43:52] bd: audio id=0x1101, lang=Francais (AC3), 3cc=fra
[11:43:52] bd: audio id=0x1102, lang=español (AC3), 3cc=spa
[11:43:52] bd: subtitle id=0x1200, lang=English, 3cc=eng
[11:43:52] bd: subtitle id=0x1201, lang=Francais, 3cc=fra
[11:43:52] bd: subtitle id=0x1202, lang=español, 3cc=spa
[11:43:52] bd: chap 1 packet=768, 628169 ms
[11:43:52] bd: chap 2 packet=2567291520, 430930 ms
[11:43:52] bd: chap 3 packet=4423802688, 431097 ms
[11:43:52] bd: chap 4 packet=6398278464, 667750 ms
[11:43:52] bd: chap 5 packet=9324065088, 629337 ms
[11:43:52] bd: chap 6 packet=11939579520, 487487 ms
[11:43:52] bd: chap 7 packet=14061609792, 624790 ms
[11:43:52] bd: chap 8 packet=16771851264, 473514 ms
[11:43:52] bd: chap 9 packet=18774780672, 615823 ms
[11:43:52] bd: chap 10 packet=21372399552, 565231 ms
[11:43:52] bd: chap 11 packet=23851669056, 619452 ms
[11:43:52] bd: chap 12 packet=26602746816, 172630 ms
[11:43:52] bd: chap 13 packet=27364632192, 463004 ms
[11:43:52] bd: chap 14 packet=28972407552, 250 ms
[11:43:52] bd: title 11 has 14 chapters
[11:43:52] bd: scanning title 12
[11:43:52] bd: playlist 00120.MPLS
[11:43:52] bd: duration is 00:00:01 (1001 ms)
[11:43:52] bd: ignoring title (too short)
[11:43:52] scan: decoding previews for title 11
[11:43:52] scan: title angle(s) 1
[11:43:53] scan: audio 0x1101: ac3, rate=48000Hz, bitrate=640000 Francais (AC3) (5.1 ch)
[11:43:53] scan: audio 0x1102: ac3, rate=48000Hz, bitrate=640000 español (AC3) (5.1 ch)
[11:43:53] scan: audio 0x711100: dca, rate=48000Hz, bitrate=1536000 English (DTS) (5.1 ch)
[11:43:53] scan: audio 0x1100: dca, rate=48000Hz, bitrate=1536000 English (DTS-HD MA) (5.1 ch)

Scanning title 1 of 1, preview 1, 55.00 %
Scanning title 1 of 1, preview 2, 60.00 %
Scanning title 1 of 1, preview 5, 75.00 %
Scanning title 1 of 1, preview 7, 85.00 %
Scanning title 1 of 1, preview 9, 95.00 %[11:43:54] scan: 10 previews, 1920x1080, 23.976 fps, autocrop = 140/140/0/0, aspect 16:9, PAR 1:1
[11:43:54] stream: 6 good frames, 0 errors (0%)

Scanning title 1 of 1, preview 10, 100.00 %[11:43:54] libhb: scan thread found 1 valid title(s)
Searching for main feature title...
 + Title (0) index 11 has length 6809sec
Found main feature title 11
+ Using preset: CLI Default
+ title 11:
  + Main Feature
  + playlist: 00100.MPLS
  + duration: 01:53:29
  + size: 1920x1080, pixel aspect: 1/1, display aspect: 1.78, 23.976 fps
  + autocrop: 140/140/0/0
  + support opencl: no
  + chapters:
    + 1: cells 0->0, 0 blocks, duration 00:10:28
    + 2: cells 0->0, 0 blocks, duration 00:07:11
    + 3: cells 0->0, 0 blocks, duration 00:07:11
    + 4: cells 0->0, 0 blocks, duration 00:11:08
    + 5: cells 0->0, 0 blocks, duration 00:10:29
    + 6: cells 0->0, 0 blocks, duration 00:08:07
    + 7: cells 0->0, 0 blocks, duration 00:10:25
    + 8: cells 0->0, 0 blocks, duration 00:07:54
    + 9: cells 0->0, 0 blocks, duration 00:10:16
    + 10: cells 0->0, 0 blocks, duration 00:09:25
    + 11: cells 0->0, 0 blocks, duration 00:10:19
    + 12: cells 0->0, 0 blocks, duration 00:02:53
    + 13: cells 0->0, 0 blocks, duration 00:07:43
    + 14: cells 0->0, 0 blocks, duration 00:00:00
  + audio tracks:
    + 1, English (DTS) (5.1 ch) (iso639-2: eng), 48000Hz, 1536000bps
    + 2, English (DTS-HD MA) (5.1 ch) (iso639-2: eng)
    + 3, Francais (AC3) (5.1 ch) (iso639-2: fra), 48000Hz, 640000bps
    + 4, español (AC3) (5.1 ch) (iso639-2: spa), 48000Hz, 640000bps
  + subtitle tracks:
    + 1, English (iso639-2: eng) (Bitmap)(PGS)
    + 2, Francais (iso639-2: fra) (Bitmap)(PGS)
    + 3, español (iso639-2: spa) (Bitmap)(PGS)
[11:43:55] 1 job(s) to process
[11:43:55] json job:
{
    "Audio": {
        "AudioList": [
            {
                "Bitrate": 112,
                "CompressionLevel": -1.0,
                "DRC": 0.0,
                "DitherMethod": "auto",
                "Encoder": "ca_aac",
                "Gain": 0.0,
                "Mixdown": "5point1",
                "NormalizeMixLevel": false,
                "PresetEncoder": "copy",
                "Quality": -3.0,
                "Samplerate": "48",
                "Track": 0
            }
        ],
        "CopyMask": [
            "copy:aac",
            "copy:ac3"
        ],
        "FallbackEncoder": "av_aac"
    },
    "Destination": {
        "ChapterList": [
            {
                "Name": "Chapter 1"
            },
            {
                "Name": "Chapter 2"
            },
            {
                "Name": "Chapter 3"
            },
            {
                "Name": "Chapter 4"
            },
            {
                "Name": "Chapter 5"
            },
            {
                "Name": "Chapter 6"
            },
            {
                "Name": "Chapter 7"
            },
            {
                "Name": "Chapter 8"
            },
            {
                "Name": "Chapter 9"
            },
            {
                "Name": "Chapter 10"
            },
            {
                "Name": "Chapter 11"
            },
            {
                "Name": "Chapter 12"
            },
            {
                "Name": "Chapter 13"
            },
            {
                "Name": "Chapter 14"
            }
        ],
        "ChapterMarkers": true,
        "File": "/A Video.mkv",
        "Mp4Options": {
            "IpodAtom": false,
            "Mp4Optimize": false
        },
        "Mux": "mkv"
    },
    "Filters": {
        "FilterList": [
            {
                "ID": 6,
                "Settings": {
                    "mode": 0
                }
            },
            {
                "ID": 11,
                "Settings": {
                    "crop-bottom": 140,
                    "crop-left": 0,
                    "crop-right": 0,
                    "crop-top": 140,
                    "height": 800,
                    "width": 1920
                }
            }
        ]
    },
    "Metadata": {},
    "PAR": {
        "Den": 1,
        "Num": 1
    },
    "SequenceID": 0,
    "Source": {
        "Angle": 0,
        "Path": "/A Video Folder",
        "Range": {
            "End": 14,
            "Start": 1,
            "Type": "chapter"
        },
        "Title": 11
    },
    "Subtitle": {
        "Search": {
            "Burn": true,
            "Default": false,
            "Enable": true,
            "Forced": false
        },
        "SubtitleList": []
    },
    "Video": {
        "ColorMatrixCode": 0,
        "Encoder": "x264",
        "Level": "auto",
        "OpenCL": false,
        "Options": "",
        "Preset": "slow",
        "Profile": "auto",
        "QSV": {
            "AsyncDepth": 4,
            "Decode": false
        },
        "Quality": 18.0,
        "Tune": "film",
        "Turbo": false,
        "TwoPass": false
    }
}
[11:43:55] Skipping subtitle scan.  No suitable subtitle tracks.
[11:43:55] starting job
[11:43:55] work: sanitizing track 1 bitrate 112 to 160 Kbps
[11:43:55] job configuration:
[11:43:55]  * source
[11:43:55]    + /A Video Folder
[11:43:55]    + title 11, chapter(s) 1 to 14
[11:43:55]  * destination
[11:43:55]    + /A Video.mkv
[11:43:55]    + container: Matroska (libavformat)
[11:43:55]      + chapter markers
[11:43:55]  * video track
[11:43:55]    + decoder: h264
[11:43:55]      + bitrate 200 kbps
[11:43:55]    + filters
[11:43:55]      + Framerate Shaper (mode=0)
[11:43:55]        + frame rate: same as source (around 23.976 fps)
[11:43:55]      + Crop and Scale (width=1920:height=800:crop-top=140:crop-bottom=140:crop-left=0:crop-right=0)
[11:43:55]        + source: 1920 * 1080, crop (140/140/0/0): 1920 * 800, scale: 1920 * 800
[11:43:55]    + Output geometry
[11:43:55]      + storage dimensions: 1920 x 800
[11:43:55]      + pixel aspect ratio: 1 : 1
[11:43:55]      + display dimensions: 1920 x 800
[11:43:55]    + encoder: H.264 (libx264)
[11:43:55]      + preset:  slow
[11:43:55]      + tune:    film
[11:43:55]      + profile: auto
[11:43:55]      + level:   auto
[11:43:55]      + quality: 18.00 (RF)
[11:43:55]  * audio track 1
[11:43:55]    + decoder: English (DTS) (5.1 ch) (track 1, id 0x711100)
[11:43:55]      + bitrate: 1536 kbps, samplerate: 48000 Hz
[11:43:55]    + mixdown: 5.1 Channels
[11:43:55]    + encoder: AAC (Apple AudioToolbox)
[11:43:55]      + bitrate: 160 kbps, samplerate: 48000 Hz
[11:43:55] sync: expecting 163264 video frames
[11:43:55] encx264: min-keyint: 24, keyint: 240
[11:43:55] encx264: encoding at constant RF 18.000000
[11:43:55] encx264: unparsed options: me=umh:ref=5:b-adapt=2:direct=auto:psy-rd=1,0.15:deblock=-1,-1:rc-lookahead=50:subme=8
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 LZCNT
x264 [info]: profile High, level 4.0
[11:43:55] sync: first pts video is 0
[11:43:55] sync: "Chapter 1" (1) at frame 1 time 0
[11:43:55] sync: first pts audio 0x711100 is 0
[11:43:55] encCoreAudio: 0 packets returned
[11:53:53] sync: "Chapter 2" (2) at frame 15062 time 56535228
[12:01:46] sync: "Chapter 3" (3) at frame 25394 time 95318973
[12:13:11] sync: "Chapter 4" (4) at frame 35730 time 134117733
[12:27:05] sync: "Chapter 5" (5) at frame 51740 time 194215271
[12:38:37] sync: "Chapter 6" (6) at frame 66829 time 250855605
[12:48:05] sync: "Chapter 7" (7) at frame 78517 time 294729435
[12:59:34] sync: "Chapter 8" (8) at frame 93497 time 350960610
[13:07:36] sync: "Chapter 9" (9) at frame 104850 time 393576933
[13:18:14] sync: "Chapter 10" (10) at frame 119615 time 449001052
[13:28:05] sync: "Chapter 11" (11) at frame 133167 time 499871872
[13:39:36] sync: "Chapter 12" (12) at frame 148019 time 555622567
[13:42:41] sync: "Chapter 13" (13) at frame 152158 time 571159338
[13:46:54] reader: done. 1 scr changes
[13:46:58] work: average encoding speed for job is 22.118078 fps
[13:46:59] vfr: lost time: 0 (0 frames)
[13:46:59] vfr: gained time: 0 (0 frames) (0 not accounted for)
[13:46:59] stream: 163264 good frames, 0 errors (0%)
[13:46:59] dca-decoder done: 638387 frames, 0 decoder errors
[13:46:59] h264-decoder done: 163263 frames, 0 decoder errors
[13:46:59] sync: got 163263 frames, 163264 expected
[13:46:59] sync: framerate min 23.974 fps, max 23.981 fps, avg 23.976 fps
x264 [info]: frame I:1460  Avg QP:15.09  size:225717
x264 [info]: frame P:49934 Avg QP:18.00  size: 71272
x264 [info]: frame B:111869 Avg QP:19.73  size: 32584
x264 [info]: consecutive B-frames:  3.8%  6.2% 25.0% 65.0%
x264 [info]: mb I  I16..4: 10.1% 67.9% 22.0%
x264 [info]: mb P  I16..4:  2.9% 14.4%  2.4%  P16..4: 39.6% 21.8% 11.3%  0.0%  0.0%    skip: 7.6%
x264 [info]: mb B  I16..4:  0.2%  2.2%  0.4%  B16..8: 48.9% 11.4%  2.6%  direct: 6.0%  skip:28.2%  L0:45.9% L1:44.9% BI: 9.3%
x264 [info]: 8x8 transform intra:73.7% inter:63.1%
x264 [info]: direct mvs  spatial:99.9% temporal:0.1%
x264 [info]: coded y,uvDC,uvAC intra: 85.2% 83.2% 53.8% inter: 38.8% 31.9% 3.5%
x264 [info]: i16 v,h,dc,p: 27% 14% 10% 49%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  8%  9%  7% 10% 15% 13% 14% 11% 13%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  8%  9%  6% 10% 15% 13% 15% 10% 14%
x264 [info]: i8c dc,h,v,p: 43% 24% 18% 15%
x264 [info]: Weighted P-Frames: Y:2.6% UV:1.7%
x264 [info]: ref P L0: 50.7% 10.0% 21.9%  8.7%  8.1%  0.5%  0.0%
x264 [info]: ref B L0: 82.2% 12.1%  4.4%  1.3%
x264 [info]: ref B L1: 96.9%  3.1%
x264 [info]: kb/s:8850.84
[13:47:07] mux: track 0, 163263 frames, 7533584882 bytes, 8850.66 kbps, fifo 2048
[13:47:07] mux: track 1, 319193 frames, 141552802 bytes, 166.30 kbps, fifo 4096
[13:47:07] libhb: work result = 0

Encode done!
HandBrake has exited.
AndyA
Posts: 12
Joined: Mon Apr 10, 2017 5:45 pm

Re: Setting HB CLI 1.0.3 audio bitrate on MacOS Sierra

Post by AndyA »

Ok so it honors the

Code: Select all

--ab
option if I remove the

Code: Select all

--arate
option.
User avatar
Ritsuka
HandBrake Team
Posts: 1650
Joined: Fri Jan 12, 2007 11:29 am

Re: Setting HB CLI 1.0.3 audio bitrate on MacOS Sierra

Post by Ritsuka »

It should be fixed in the nightly builds. Please try one.
( https://github.com/HandBrake/HandBrake/ ... ee4fbea096 )
Post Reply