Trouble handling audio tracks

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
cafevincent
Posts: 5
Joined: Wed Oct 18, 2023 1:58 pm

Trouble handling audio tracks

Post by cafevincent »

Description of problem or question:
I am currently testing this script to encode videos for cropping purposes, I have set it (I think) to process all audio tracks, and to copy all but aac,ac3,mp2,mp3,opus and to encode all others with opus to 160kbps. The tested source video with a single AAC audio track was not copied over. The new video had no audio what so ever. I first tried using --all-audio but I received error claiming it cannot be used with --audio, which was not used at the time. I am super confused about this whole audio aspect.

It is important, whenever possible, to make the audio more apartment bulding night time watching friendly, hence the --drc 2.0, though I'm not sure where its applicable.


Steps to reproduce the problem (If Applicable):
HandBrakeCLI.exe -i %1 -o "%new%" --encoder x265_10bit --encoder-preset slow --encoder-profile main444-10 --vb %bitrate% --two-pass --turbo --audio 1,2,3,4,5,6,7,8,9 --aencoder copy --audio-copy-mask aac,ac3,mp2,mp3,opus --audio-fallback opus -ab 160 --drc 2.0 --crop-mode conservative


HandBrake version (e.g., 1.0.0):
1.6.1


Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.13 High Sierra, Windows 10 Creators Update):
Windows 11, ver command claims 10.0.22621.963


HandBrake Activity Log ***required*** (see How-to get an activity log)

Code: Select all

\HandBrakeCLI.exe -i "D:\VIDEO\OFFICIAL RED BAND TRAILERS\Enemy Official Red Band Teaser 1 (2014) - Jake Gyllenhaal Movie HD 720p 30fps Movieclips Trailers.mp4" -o "D:\VIDEO\OFFICIAL RED BAND TRAILERS\Enemy Official Red Band Teaser 1 (2014) - Jake Gyllenhaal Movie HD 720p 30fps Movieclips Trailers_2.mkv" --encoder x265_10bit --encoder-preset slow --encoder-profile main444-10 --vb 539 --two-pass --turbo --audio 1,2,3,4,5,6,7,8,9 --aencoder copy --audio-copy-mask aac,ac3,mp2,mp3,opus --audio-fallback opus -ab 160 --drc 2.0 --crop-mode conservative
[17:16:42] Compile-time hardening features are enabled
[17:16:42] qsv: not available on this system
[17:16:42] vcn: not available on this system
[17:16:42] nvenc: version 12.0 is available
[17:16:42] nvdec: is available
[17:16:42] hb_init: starting libhb thread
[17:16:42] thread 1 started ("libhb")
HandBrake 1.6.1 (2023012300) - MinGW x86_64 - https://handbrake.fr
12 CPUs detected
Opening D:\VIDEO\OFFICIAL RED BAND TRAILERS\Enemy Official Red Band Teaser 1 (2014) - Jake Gyllenhaal Movie HD 720p 30fps Movieclips Trailers.mp4...
[17:16:42] CPU: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
[17:16:42]  - Intel microarchitecture Kaby Lake
[17:16:42]  - logical processor count: 12
[17:16:42] Intel Quick Sync Video support: no
[17:16:42] hb_scan: path=D:\VIDEO\OFFICIAL RED BAND TRAILERS\Enemy Official Red Band Teaser 1 (2014) - Jake Gyllenhaal Movie HD 720p 30fps Movieclips Trailers.mp4, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
src/libbluray/disc/disc.c:333: failed opening UDF image D:\VIDEO\OFFICIAL RED BAND TRAILERS\Enemy Official Red Band Teaser 1 (2014) - Jake Gyllenhaal Movie HD 720p 30fps Movieclips Trailers.mp4
src/libbluray/disc/disc.c:437: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:437: error opening file BDMV\BACKUP\index.bdmv
[17:16:42] bd: not a bd - trying as a stream/file instead
libdvdread: Encrypted DVD support unavailable.
libdvdread: DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: vm: failed to read VIDEO_TS.IFO
[17:16:42] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\VIDEO\OFFICIAL RED BAND TRAILERS\Enemy Official Red Band Teaser 1 (2014) - Jake Gyllenhaal Movie HD 720p 30fps Movieclips Trailers.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2018-11-14T11:00:34.000000Z
  Duration: 00:00:48.13, start: 0.000000, bitrate: 670 kb/s
  Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 539 kb/s, 23.98 fps, 23.98 tbr, 24k tbn (default)
    Metadata:
      creation_time   : 2018-11-14T11:00:34.000000Z
      handler_name    : ISO Media file produced by Google Inc. Created on: 11/14/2018.
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2018-11-14T11:00:34.000000Z
      handler_name    : ISO Media file produced by Google Inc. Created on: 11/14/2018.
      vendor_id       : [0][0][0][0]
[17:16:42] scan: decoding previews for title 1
[17:16:42] scan: audio 0x1: aac, rate=44100Hz, bitrate=128059 Unknown (AAC LC) (2.0 ch) (128 kbps)
[17:16:42] scan: 10 previews, 1280x720, 23.976 fps, autocrop = 98/98/12/12, aspect 16:9, PAR 1:1, color profile: 1-1-1, chroma location: left
[17:16:42] scan: supported video decoders: avcodec nvdec
Scanning title 1 of 1, preview 10, 100.00 %[17:16:42] libhb: scan thread found 1 valid title(s)
+ Using preset: CLI Default
+ title 1:
  + stream: D:\VIDEO\OFFICIAL RED BAND TRAILERS\Enemy Official Red Band Teaser 1 (2014) - Jake Gyllenhaal Movie HD 720p 30fps Movieclips Trailers.mp4
  + duration: 00:00:48
  + size: 1280x720, pixel aspect: 1/1, display aspect: 1.78, 23.976 fps
  + autocrop: 98/98/12/12
  + chapters:
    + 1: duration 00:00:48
  + audio tracks:
    + 1, Unknown (AAC LC) (2.0 ch) (128 kbps) (iso639-2: und)
  + subtitle tracks:
ERROR: unable to parse audio input "b", skipping
Dropping excess audio encoders
Dropping excess audio dynamic range controls
[17:16:42] Starting work at: Wed Oct 18 17:16:42 2023

[17:16:42] 1 job(s) to process
[17:16:42] json job:
{
    "Audio": {
        "AudioList": [],
        "CopyMask": [
            "copy:aac",
            "copy:ac3",
            "copy:mp2",
            "copy:mp3",
            "copy:opus"
        ],
        "FallbackEncoder": "opus"
    },
    "Destination": {
        "AlignAVStart": false,
        "ChapterList": [
            {
                "Duration": {
                    "Hours": 0,
                    "Minutes": 0,
                    "Seconds": 48,
                    "Ticks": 4332146
                },
                "Name": ""
            }
        ],
        "ChapterMarkers": false,
        "File": "D:\\VIDEO\\OFFICIAL RED BAND TRAILERS\\Enemy Official Red Band Teaser 1 (2014) - Jake Gyllenhaal Movie HD 720p 30fps Movieclips Trailers_2.mkv",
        "InlineParameterSets": false,
        "Mp4Options": {
            "IpodAtom": false,
            "Mp4Optimize": false
        },
        "Mux": "mkv"
    },
    "Filters": {
        "FilterList": [
            {
                "ID": 7,
                "Settings": {
                    "mode": 0
                }
            },
            {
                "ID": 14,
                "Settings": {
                    "crop-bottom": 98,
                    "crop-left": 10,
                    "crop-right": 10,
                    "crop-top": 98,
                    "height": 524,
                    "width": 1260
                }
            }
        ]
    },
    "Metadata": {},
    "PAR": {
        "Den": 1,
        "Num": 1
    },
    "SequenceID": 0,
    "Source": {
        "Angle": 0,
        "Path": "D:\\VIDEO\\OFFICIAL RED BAND TRAILERS\\Enemy Official Red Band Teaser 1 (2014) - Jake Gyllenhaal Movie HD 720p 30fps Movieclips Trailers.mp4",
        "Range": {
            "End": 1,
            "Start": 1,
            "Type": "chapter"
        },
        "Title": 1
    },
    "Subtitle": {
        "Search": {
            "Burn": true,
            "Default": false,
            "Enable": false,
            "Forced": false
        },
        "SubtitleList": []
    },
    "Video": {
        "Bitrate": 539,
        "ChromaLocation": 1,
        "ColorInputFormat": 0,
        "ColorMatrix": 1,
        "ColorOutputFormat": 0,
        "ColorPrimaries": 1,
        "ColorRange": 1,
        "ColorTransfer": 1,
        "Encoder": "x265_10bit",
        "HardwareDecode": 0,
        "Preset": "slow",
        "Profile": "main444-10",
        "QSV": {
            "AdapterIndex": 0,
            "AsyncDepth": 0,
            "Decode": false
        },
        "Turbo": true,
        "TwoPass": true
    }
}
[17:16:43] Starting Task: Analysis Pass
[17:16:43] Skipping vfr filter
[17:16:43] job configuration:
[17:16:43]  * source
[17:16:43]    + D:\VIDEO\OFFICIAL RED BAND TRAILERS\Enemy Official Red Band Teaser 1 (2014) - Jake Gyllenhaal Movie HD 720p 30fps Movieclips Trailers.mp4
[17:16:43]    + title 1, chapter(s) 1 to 1
[17:16:43]    + container: mov,mp4,m4a,3gp,3g2,mj2
[17:16:43]    + data rate: 670 kbps
[17:16:43]  * destination
[17:16:43]    + D:\VIDEO\OFFICIAL RED BAND TRAILERS\Enemy Official Red Band Teaser 1 (2014) - Jake Gyllenhaal Movie HD 720p 30fps Movieclips Trailers_2.mkv
[17:16:43]    + container: Matroska (libavformat)
[17:16:43]  * video track
[17:16:43]    + decoder: h264 8-bit (yuv420p)
[17:16:43]      + bitrate 539 kbps
[17:16:43]    + filters
[17:16:43]      + Crop and Scale (width=1260:height=524:crop-top=98:crop-bottom=98:crop-left=10:crop-right=10)
[17:16:43]        + source: 1280 * 720, crop (98/98/10/10): 1260 * 524, scale: 1260 * 524
[17:16:43]      + Format (format=yuv444p10le)
[17:16:43]    + Output geometry
[17:16:43]      + storage dimensions: 1260 x 524
[17:16:43]      + pixel aspect ratio: 1 : 1
[17:16:43]      + display dimensions: 1260 x 524
[17:16:43]    + encoder: H.265 10-bit (libx265)
[17:16:43]      + preset:  slow
[17:16:43]      + profile: main444-10
[17:16:43]      + bitrate: 539 kbps, pass: 1
[17:16:43]      + fast first pass
[17:16:43]      + color profile: 1-1-1
[17:16:43]      + chroma location: left
[17:16:43] sync: expecting 1154 video frames
x265 [info]: HEVC encoder version 3.5+1-f0c1022b6
x265 [info]: build info [Windows][GCC 10.2.0][64 bit] 10bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [warning]: halving the quality when psy-rd is enabled for 444 input. Setting cbQpOffset = 6 and crQpOffset = 6
x265 [info]: Main 4:4:4 10 profile, Level-3.1 (Main tier)
x265 [info]: Thread pool created using 12 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 3 / wpp(9 rows)
x265 [warning]: Source height < 720p; disabling lookahead-slices
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : dia / 57 / 2 / 1
x265 [info]: Keyframe min / max / scenecut / bias  : 24 / 240 / 40 / 5.00
x265 [info]: Cb/Cr QP Offset                     : 6 / 6
x265 [info]: Lookahead / bframes / badapt        : 25 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 1 / on / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : ABR-539 kbps / 0.60
x265 [info]: tools: limit-modes rd=2 psy-rd=2.00 rdoq=2 psy-rdoq=1.00
x265 [info]: tools: early-skip rskip mode=1 signhide tmvp fast-intra
x265 [info]: tools: strong-intra-smoothing deblock sao stats-write
[17:16:43] sync: first pts video is 0
[17:16:43] sync: Chapter 1 at frame 1 time 0
Encoding: task 1 of 2, 94.71 % (24.53 fps, avg 27.30 fps, ETA 00h00m02s)[17:17:23] reader: done. 1 scr changes
Encoding: task 1 of 2, 99.91 % (26.37 fps, avg 27.20 fps, ETA 00h00m01s)[17:17:27] work: average encoding speed for job is 27.195730 fps
Encoding: task 1 of 2, 99.91 % (26.37 fps, avg 27.20 fps, ETA 00h00m01s)[17:17:27] h264-decoder done: 1154 frames, 0 decoder errors
[17:17:27] sync: got 1154 frames, 1154 expected
[17:17:27] sync: framerate min 23.976 fps, max 23.976 fps, avg 23.976 fps
Encoding: task 1 of 2, 99.91 % (26.37 fps, avg 27.20 fps, ETA 00h00x265 [info]: frame I:     65, Avg QP:20.00  kb/s: 1286.92 m
0x265 [info]: frame P:    521, Avg QP:22.14  kb/s: 798.78  1
sx265 [info]: frame B:    568, Avg QP:25.98  kb/s: 248.34  )
x265 [info]: Weighted P-Frames: Y:30.5% UV:27.8%

encoded 1154 frames in 44.37s (26.01 fps), 555.35 kb/s, Avg QP:23.91
[17:17:27] Starting Task: Encoding Pass
[17:17:27] Skipping vfr filter
[17:17:27] job configuration:
[17:17:27]  * source
[17:17:27]    + D:\VIDEO\OFFICIAL RED BAND TRAILERS\Enemy Official Red Band Teaser 1 (2014) - Jake Gyllenhaal Movie HD 720p 30fps Movieclips Trailers.mp4
[17:17:27]    + title 1, chapter(s) 1 to 1
[17:17:27]    + container: mov,mp4,m4a,3gp,3g2,mj2
[17:17:27]    + data rate: 670 kbps
[17:17:27]  * destination
[17:17:27]    + D:\VIDEO\OFFICIAL RED BAND TRAILERS\Enemy Official Red Band Teaser 1 (2014) - Jake Gyllenhaal Movie HD 720p 30fps Movieclips Trailers_2.mkv
[17:17:27]    + container: Matroska (libavformat)
[17:17:27]  * video track
[17:17:27]    + decoder: h264 8-bit (yuv420p)
[17:17:27]      + bitrate 539 kbps
[17:17:27]    + filters
[17:17:27]      + Crop and Scale (width=1260:height=524:crop-top=98:crop-bottom=98:crop-left=10:crop-right=10)
[17:17:27]        + source: 1280 * 720, crop (98/98/10/10): 1260 * 524, scale: 1260 * 524
[17:17:27]      + Format (format=yuv444p10le)
[17:17:27]    + Output geometry
[17:17:27]      + storage dimensions: 1260 x 524
[17:17:27]      + pixel aspect ratio: 1 : 1
[17:17:27]      + display dimensions: 1260 x 524
[17:17:27]    + encoder: H.265 10-bit (libx265)
[17:17:27]      + preset:  slow
[17:17:27]      + profile: main444-10
[17:17:27]      + bitrate: 539 kbps, pass: 2
[17:17:27]      + color profile: 1-1-1
[17:17:27]      + chroma location: left
[17:17:27] sync: expecting 1154 video frames
x265 [info]: HEVC encoder version 3.5+1-f0c1022b6
x265 [info]: build info [Windows][GCC 10.2.0][64 bit] 10bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [warning]: halving the quality when psy-rd is enabled for 444 input. Setting cbQpOffset = 6 and crQpOffset = 6
x265 [info]: Main 4:4:4 10 profile, Level-3.1 (Main tier)
x265 [info]: Thread pool created using 12 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 3 / wpp(9 rows)
x265 [warning]: Source height < 720p; disabling lookahead-slices
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : star / 57 / 3 / 3
x265 [info]: Keyframe min / max / scenecut / bias  : 24 / 240 / 40 / 5.00
x265 [info]: Cb/Cr QP Offset                     : 6 / 6
x265 [info]: Lookahead / bframes / badapt        : 25 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 4 / on / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : ABR-539 kbps / 0.60
x265 [info]: tools: rect limit-modes rd=4 psy-rd=2.00 rdoq=2 psy-rdoq=1.00
x265 [info]: tools: rskip mode=1 signhide tmvp strong-intra-smoothing deblock
x265 [info]: tools: sao stats-read
Encoding: task 2 of 2, 0.00 %[17:17:27] sync: first pts video is 0
[17:17:27] sync: Chapter 1 at frame 1 time 0
Encoding: task 2 of 2, 94.71 % (11.15 fps, avg 10.37 fps, ETA 00h00m06s)[17:19:13] reader: done. 1 scr changes
Encoding: task 2 of 2, 99.91 % (8.51 fps, avg 10.27 fps, ETA 00h00m02s)[17:19:26] work: average encoding speed for job is 10.268189 fps
Encoding: task 2 of 2, 99.91 % (8.51 fps, avg 10.27 fps, ETA 00h00m02s)[17:19:26] h264-decoder done: 1154 frames, 0 decoder errors
[17:19:26] sync: got 1154 frames, 1154 expected
[17:19:26] sync: framerate min 23.976 fps, max 23.976 fps, avg 23.976 fps
x265 [info]: frame I:     65, Avg QP:19.50  kb/s: 1162.75
x265 [info]: frame P:    521, Avg QP:22.38  kb/s: 779.02
x265 [info]: frame B:    568, Avg QP:26.37  kb/s: 238.37
x265 [info]: Weighted P-Frames: Y:30.5% UV:27.8%

encoded 1154 frames in 119.19s (9.68 fps), 534.52 kb/s, Avg QP:24.18
[17:19:26] mux: track 0, 1154 frames, 3220538 bytes, 535.29 kbps, fifo 2048
[17:19:26] Finished work at: Wed Oct 18 17:19:26 2023

[17:19:26] libhb: work result = 0

Encode done!

HandBrake has exited.
cafevincent
Posts: 5
Joined: Wed Oct 18, 2023 1:58 pm

Re: Trouble handling audio tracks

Post by cafevincent »

anybody? first time encoder over here so this should be quick and easy to fix I'm sure.
Woodstock
Veteran User
Posts: 4623
Joined: Tue Aug 27, 2013 6:39 am

Re: Trouble handling audio tracks

Post by Woodstock »

Code: Select all

 + audio tracks:
    + 1, Unknown (AAC LC) (2.0 ch) (128 kbps) (iso639-2: und)
  ...
ERROR: unable to parse audio input "b", skipping
Dropping excess audio encoders
Dropping excess audio dynamic range controls
It would appear that handbrake cannot parse the audio track, so it ignores it.
cafevincent
Posts: 5
Joined: Wed Oct 18, 2023 1:58 pm

Re: Trouble handling audio tracks

Post by cafevincent »

Woodstock wrote: Fri Oct 20, 2023 1:55 pm

Code: Select all

 + audio tracks:
    + 1, Unknown (AAC LC) (2.0 ch) (128 kbps) (iso639-2: und)
  ...
ERROR: unable to parse audio input "b", skipping
Dropping excess audio encoders
Dropping excess audio dynamic range controls
It would appear that handbrake cannot parse the audio track, so it ignores it.
I tried this with 20 different videos, all from youtube (I think), every one is missing the audio track. I have to put the audio in manually using MKVtoolNix. I wonder what the problem is and how to get around it
mduell
Veteran User
Posts: 8207
Joined: Sat Apr 21, 2007 8:54 pm

Re: Trouble handling audio tracks

Post by mduell »

Try the nightly, there have been a lot of updates since 1.6.1.
cafevincent
Posts: 5
Joined: Wed Oct 18, 2023 1:58 pm

Re: Trouble handling audio tracks

Post by cafevincent »

Latest nightly gives error: unknown option (--two-pass)
mduell
Veteran User
Posts: 8207
Joined: Sat Apr 21, 2007 8:54 pm

Re: Trouble handling audio tracks

Post by mduell »

We're going to need more than that for a meaningful response. What's the full command and encoding log?
cafevincent
Posts: 5
Joined: Wed Oct 18, 2023 1:58 pm

Re: Trouble handling audio tracks

Post by cafevincent »

Went back to 1.6.1 for two-pass
reconstructed the command using chatgpt
this is the new command, which works beautifully

Code: Select all

HandBrakeCLI.exe -i %1 -o "%new%" --encoder x265_10bit --encoder-preset slow --encoder-profile main444-10 --vb %bitrate% --two-pass --turbo --audio 1-9 --aencoder copy --audio-copy-mask aac,ac3,mp2,mp3,opus --audio-fallback opus --ab 160 --drc 2.0 --crop-mode conservative
and my old command

Code: Select all

HandBrakeCLI.exe -i %1 -o "%new%" --encoder x265_10bit --encoder-preset slow --encoder-profile main444-10 --vb %bitrate% --two-pass --turbo --audio 1,2,3,4,5,6,7,8,9 --aencoder copy --audio-copy-mask aac,ac3,mp2,mp3,opus --audio-fallback opus -ab 160 --drc 2.0 --crop-mode conservative
which seems to be exactly the same. there must be a poltergeist in my windows yea?
Post Reply