Can meta data be set within Handbrake via CLI?

HandBrake for Windows support
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
Woodstock
Veteran User
Posts: 4621
Joined: Tue Aug 27, 2013 6:39 am

Can meta data be set within Handbrake via CLI?

Post by Woodstock »

Somewhere between the nightly build I normally use (from July 2013) and the latest, a feature was added to Handbrake that preserves the meta data title from a source MKV file in the resultant MP4 file. Which is fine, as long as the meta data in the MKV file is what you WANT in the MP4...

However, part of my process of ripping disks often means taking multi-episode MKV files and making single-episode MP4 files. MakeMKV put the title of the multi-episode file into the meta data, "Ranma 1-2 E01-08". Guess what the individual episodes now show as their title?

Short of editing the original MKV file prior to each episode being split out and compressed by Handbrake, I do not see a way to set the title in the meta data to anything EXCEPT what is in the MKV file. Is there something I missed in the documentation?
Deleted User 11865

Re: Can meta data be set within Handbrake via CLI?

Post by Deleted User 11865 »

No, you are correct.

You could always use the Linux GUI, where you can actually edit the metadata before passing it through.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5726
Joined: Sat Feb 09, 2008 7:21 pm

Re: Can meta data be set within Handbrake via CLI?

Post by JohnAStebbins »

There are also other taggers that can be used to post process your mp4 files. mp4box (from gpac) is a command line tool that can do this. Lookup -itag and -tag-list options.
Woodstock
Veteran User
Posts: 4621
Joined: Tue Aug 27, 2013 6:39 am

Re: Can meta data be set within Handbrake via CLI?

Post by Woodstock »

The linux GUI is out for a couple of reasons... First is that my fast Linux box is running Fedora 11, and I haven't been able to find the magic combination of files to get HB to compile a CLI version yet, let alone the GUI. Second is that the GUIs are not compatible with my work flow, which is why I have the old version of HB for Windows, which still supports generating a batch file from the GUI. Frankly, the idea of queuing up even a single season of a series in a GUI that resets important options (subtitle order, audio tracks) each time a new file is loaded does NOT appeal to me.

mp4box might be the fix, if this really starts to bug me. The only reason I was experimenting with the later SVN was to see if my QSV-enabled machine did any better with a QSV-enabled version of Handbrake. But, the logs were inconclusive as to whether or not QSV was USED during the test encode (it was detected), so it's kind of a moot point for now.
Deleted User 11865

Re: Can meta data be set within Handbrake via CLI?

Post by Deleted User 11865 »

Well, the logs definitely do tell whether QSV is used. As for the UI, track selection is being re-worked… it's a big buggy right now as the code is fairly new, but it gives you more flexibility in terms of automatic track selection, and allows you to save everything to a preset (as opposed on a global option affecting every preset).
Woodstock
Veteran User
Posts: 4621
Joined: Tue Aug 27, 2013 6:39 am

Re: Can meta data be set within Handbrake via CLI?

Post by Woodstock »

The logs show when QSV is active? I only saw the detection in the log, not that it was being used:

Code: Select all

"C:\Program Files\HandbrakeSVN\HandBrakeCLI.exe" -i "S:\Movies\The Disappearance of Haruhi Suzumiya.mkv" -t 1 -o "C:\VideoOut\Movies\The Disappearance of Haruhi SuzumiyaT.mkv"  -f mkv --detelecine --decomb -w 1920 --loose-anamorphic  -e x264 -q 20 --vfr  -a 1,4 -E ffac3,ffac3 -B 160,160 -6 dpl2,dpl2 -R Auto,Auto -D 0,0 --gain=0,0 --audio-copy-mask none --audio-fallback ffac3 --subtitle 2,1 --markers="C:\Users\jeffb\AppData\Local\Temp\The Disappearance of Haruhi Suzumiya-1-chapters.csv" -x b-adapt=2:rc-lookahead=50 --verbose=1
[12:52:23] hb_init: starting libhb thread
HandBrake svn5933 (2013121601) - MinGW x86_64 - http://handbrake.fr
4 CPUs detected
Opening S:\Movies\The Disappearance of Haruhi Suzumiya.mkv...
[12:52:23] CPU: Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz
[12:52:23]  - Intel microarchitecture Ivy Bridge
[12:52:23]  - logical processor count: 4
[12:52:25] OpenCL device #1: Advanced Micro Devices, Inc. Oland
[12:52:25]  - OpenCL version: 1.2 AMD-APP (1214.3)
[12:52:25]  - driver version: 1214.3 (VM)
[12:52:25]  - device type:    GPU
[12:52:25]  - supported:      YES
[12:52:25] Intel Quick Sync Video support: yes
[12:52:25]  - Intel Media SDK hardware: API 1.4 (minimum: 1.3)
[12:52:25]  - Preferred implementation: hardware (any)
[12:52:25] hb_scan: path=S:\Movies\The Disappearance of Haruhi Suzumiya.mkv, title_index=1
libbluray/bdnav/index_parse.c:162: indx_parse(): error opening S:\Movies\The Disappearance of Haruhi Suzumiya.mkv/BDMV/index.bdmv
libbluray/bdnav/index_parse.c:162: indx_parse(): error opening S:\Movies\The Disappearance of Haruhi Suzumiya.mkv/BDMV/BACKUP/index.bdmv
libbluray/bluray.c:1725: nav_get_title_list(S:\Movies\The Disappearance of Haruhi Suzumiya.mkv) failed (00000000002fafd0)
[12:52:25] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 4.1.3
libdvdread: Encrypted DVD support unavailable.
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[12:52:26] dvd: not a dvd - trying as a stream/file instead
Input #0, matroska,webm, from 'S:\Movies\The Disappearance of Haruhi Suzumiya.mkv':
  Metadata:
    title           : The Disappearance of Haruhi Suzumiya
  Duration: 02:43:15.96, start: 0.000000, bitrate: N/A
    Chapter #0.0: start 0.000000, end 354.312292
    Metadata:
      title           : Chapter 01
    Chapter #0.1: start 354.312292, end 445.153042
    Metadata:
      title           : Chapter 02
    Chapter #0.2: start 445.153042, end 1072.529792
    Metadata:
      title           : Chapter 03
    Chapter #0.3: start 1072.529792, end 1431.263167
    Metadata:
      title           : Chapter 04
    Chapter #0.4: start 1431.263167, end 1916.623042
    Metadata:
      title           : Chapter 05
    Chapter #0.5: start 1916.623042, end 2423.838083
    Metadata:
      title           : Chapter 06
    Chapter #0.6: start 2423.838083, end 2780.110667
    Metadata:
      title           : Chapter 07
    Chapter #0.7: start 2780.110667, end 3168.748917
    Metadata:
      title           : Chapter 08
    Chapter #0.8: start 3168.748917, end 3722.427042
    Metadata:
      title           : Chapter 09
    Chapter #0.9: start 3722.427042, end 4151.647500
    Metadata:
      title           : Chapter 10
    Chapter #0.10: start 4151.647500, end 4587.040792
    Metadata:
      title           : Chapter 11
    Chapter #0.11: start 4587.040792, end 5320.440125
    Metadata:
      title           : Chapter 12
    Chapter #0.12: start 5320.440125, end 5680.966958
    Metadata:
      title           : Chapter 13
    Chapter #0.13: start 5680.966958, end 5968.003708
    Metadata:
      title           : Chapter 14
    Chapter #0.14: start 5968.003708, end 6608.602000
    Metadata:
      title           : Chapter 15
    Chapter #0.15: start 6608.602000, end 7001.244250
    Metadata:
      title           : Chapter 16
    Chapter #0.16: start 7001.244250, end 7416.200458
    Metadata:
      title           : Chapter 17
    Chapter #0.17: start 7416.200458, end 7891.758875
    Metadata:
      title           : Chapter 18
    Chapter #0.18: start 7891.758875, end 8184.593083
    Metadata:
      title           : Chapter 19
    Chapter #0.19: start 8184.593083, end 8711.327625
    Metadata:
      title           : Chapter 20
    Chapter #0.20: start 8711.327625, end 9164.780625
    Metadata:
      title           : Chapter 21
    Chapter #0.21: start 9164.780625, end 9379.953917
    Metadata:
      title           : Chapter 22
    Chapter #0.22: start 9379.953917, end 9653.477167
    Metadata:
      title           : Chapter 23
    Chapter #0.23: start 9653.477167, end 9708.573875
    Metadata:
      title           : Chapter 24
    Chapter #0.24: start 9708.573875, end 9782.773000
    Metadata:
      title           : Chapter 25
    Chapter #0.25: start 9782.773000, end 9794.951833
    Metadata:
      title           : Chapter 26
    Chapter #0.26: start 9794.951833, end 9795.968000
    Metadata:
      title           : Chapter 27
    Stream #0.0(eng): Video: h264 (High), yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc
    Stream #0.1(eng): Audio: truehd, 48000 Hz, 5.1, s32 (default)
    Metadata:
      title           : 5.1
    Stream #0.2(eng): Audio: ac3, 48000 Hz, 5.1, fltp, 448 kb/s
    Metadata:
      title           : 3/2+1
    Stream #0.3(jpn): Audio: truehd, 48000 Hz, 5.1, s32
    Metadata:
      title           : 5.1
    Stream #0.4(jpn): Audio: ac3, 48000 Hz, 5.1, fltp, 448 kb/s
    Metadata:
      title           : 3/2+1
    Stream #0.5(eng): Subtitle: pgssub
    Stream #0.6(eng): Subtitle: pgssub
[12:52:26] scan: decoding previews for title 1
[12:52:26] scan: audio 0x1: truehd, rate=48000Hz, bitrate=1 English (truehd) (5.1 ch)
[12:52:26] scan: audio 0x2: AC-3, rate=48000Hz, bitrate=448000 English (AC3) (5.1 ch)
[12:52:26] scan: audio 0x3: truehd, rate=48000Hz, bitrate=1 Japanese (truehd) (5.1 ch)
[12:52:26] scan: audio 0x4: AC-3, rate=48000Hz, bitrate=448000 Japanese (AC3) (5.1 ch)
Scanning title 1 of 1, preview 9, 90.00 %[12:52:27] scan: 10 previews, 1920x1080, 23.976 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1
[12:52:27] libhb: scan thread found 1 valid title(s)
+ title 1:
  + stream: S:\Movies\The Disappearance of Haruhi Suzumiya.mkv
  + duration: 02:43:15
  + size: 1920x1080, pixel aspect: 1/1, display aspect: 1.78, 23.976 fps
  + autocrop: 0/0/0/0
  + support opencl: yes
  + support hwd: yes
  + chapters:
    + 1: cells 0->0, 0 blocks, duration 00:05:54
    + 2: cells 0->0, 0 blocks, duration 00:01:31
    + 3: cells 0->0, 0 blocks, duration 00:10:27
    + 4: cells 0->0, 0 blocks, duration 00:05:59
    + 5: cells 0->0, 0 blocks, duration 00:08:05
    + 6: cells 0->0, 0 blocks, duration 00:08:27
    + 7: cells 0->0, 0 blocks, duration 00:05:56
    + 8: cells 0->0, 0 blocks, duration 00:06:29
    + 9: cells 0->0, 0 blocks, duration 00:09:14
    + 10: cells 0->0, 0 blocks, duration 00:07:09
    + 11: cells 0->0, 0 blocks, duration 00:07:15
    + 12: cells 0->0, 0 blocks, duration 00:12:13
    + 13: cells 0->0, 0 blocks, duration 00:06:01
    + 14: cells 0->0, 0 blocks, duration 00:04:47
    + 15: cells 0->0, 0 blocks, duration 00:10:41
    + 16: cells 0->0, 0 blocks, duration 00:06:33
    + 17: cells 0->0, 0 blocks, duration 00:06:55
    + 18: cells 0->0, 0 blocks, duration 00:07:56
    + 19: cells 0->0, 0 blocks, duration 00:04:53
    + 20: cells 0->0, 0 blocks, duration 00:08:47
    + 21: cells 0->0, 0 blocks, duration 00:07:33
    + 22: cells 0->0, 0 blocks, duration 00:03:35
    + 23: cells 0->0, 0 blocks, duration 00:04:34
    + 24: cells 0->0, 0 blocks, duration 00:00:55
    + 25: cells 0->0, 0 blocks, duration 00:01:14
    + 26: cells 0->0, 0 blocks, duration 00:00:12
    + 27: cells 0->0, 0 blocks, duration 00:00:01
  + audio tracks:
    + 1, English (truehd) (5.1 ch) (iso639-2: eng)
    + 2, English (AC3) (5.1 ch) (iso639-2: eng), 48000Hz, 448000bps
    + 3, Japanese (truehd) (5.1 ch) (iso639-2: jpn)
    + 4, Japanese (AC3) (5.1 ch) (iso639-2: jpn), 48000Hz, 448000bps
  + subtitle tracks:
    + 1, English (iso639-2: eng) (Bitmap)(PGS)
    + 2, English (iso639-2: eng) (Bitmap)(PGS)
Reading chapter markers from file C:\Users\jeffb\AppData\Local\Temp\The Disappearance of Haruhi Suzumiya-1-chapters.csv
Cannot open chapter marker file, using defaults
[12:52:27] 1 job(s) to process
[12:52:27] starting job
[12:52:27] yadif thread started for segment 0
[12:52:27] yadif thread started for segment 2
[12:52:27] yadif thread started for segment 3
[12:52:27] decomb filter thread started for segment 1
[12:52:27] decomb filter thread started for segment 3
[12:52:27] decomb check thread started for segment 1
[12:52:27] mask filter thread started for segment 0
[12:52:27] mask filter thread started for segment 2
[12:52:27] yadif thread started for segment 1
[12:52:27] decomb check thread started for segment 0
[12:52:27] mask dilate thread started for segment 1
[12:52:27] mask dilate thread started for segment 3
[12:52:27] decomb check thread started for segment 3
[12:52:27] sync: expecting 234868 video frames
[12:52:27] mask filter thread started for segment 1
[12:52:27] decomb filter thread started for segment 2
[12:52:27] mask filter thread started for segment 3
[12:52:27] mask erode thread started for segment 0
[12:52:27] mask erode thread started for segment 1
[12:52:27] mask erode thread started for segment 2
[12:52:27] mask erode thread started for segment 3
[12:52:27] mask dilate thread started for segment 0
[12:52:27] decomb filter thread started for segment 0
[12:52:27] mask dilate thread started for segment 2
[12:52:27] decomb check thread started for segment 2
[12:52:27] job configuration:
[12:52:27]  * source
[12:52:27]    + S:\Movies\The Disappearance of Haruhi Suzumiya.mkv
[12:52:27]    + title 1, chapter(s) 1 to 27
[12:52:27]    + container: matroska,webm
[12:52:27]  * destination
[12:52:27]    + C:\VideoOut\Movies\The Disappearance of Haruhi SuzumiyaT.mkv
[12:52:27]    + container: Matroska (avformat)
[12:52:27]      + chapter markers
[12:52:27]  * video track
[12:52:27]    + decoder: h264
[12:52:27]    + filters
[12:52:27]      + Detelecine (pullup) (default settings)
[12:52:27]      + Decomb (default settings)
[12:52:27]      + Framerate Shaper (0:27000000:1126125)
[12:52:27]        + frame rate: same as source (around 23.976 fps)
[12:52:27]      + Crop and Scale (1920:1072:0:0:0:0)
[12:52:27]        + source: 1920 * 1080, crop (0/0/0/0): 1920 * 1080, scale: 1920 * 1072
[12:52:27]    + loose anamorphic
[12:52:27]      + storage dimensions: 1920 * 1072, mod 0
[12:52:27]      + pixel aspect ratio: 134 / 135
[12:52:27]      + display dimensions: 1905 * 1072
[12:52:27]    + encoder: H.264 (x264)
[12:52:27]      + options: b-adapt=2:rc-lookahead=50
[12:52:27]      + quality: 20.00 (RF)
[12:52:27]  * subtitle track 1, English (track 6, id 0x6) Picture [PGS] -> Passthrough
[12:52:27]  * subtitle track 2, English (track 5, id 0x5) Picture [PGS] -> Passthrough
[12:52:27]  * audio track 1
[12:52:27]    + decoder: English (truehd) (5.1 ch) (track 1, id 0x1)
[12:52:27]      + samplerate: 48000 Hz
[12:52:27]    + mixdown: Dolby Pro Logic II
[12:52:27]    + encoder: AC3
[12:52:27]      + bitrate: 160 kbps, samplerate: 48000 Hz
[12:52:27]  * audio track 2
[12:52:27]    + decoder: Japanese (AC3) (5.1 ch) (track 4, id 0x4)
[12:52:27]      + bitrate: 448 kbps, samplerate: 48000 Hz
[12:52:27]    + mixdown: Dolby Pro Logic II
[12:52:27]    + encoder: AC3
[12:52:27]      + bitrate: 160 kbps, samplerate: 48000 Hz
[12:52:27] reader: first SCR 0 id 0x0 DTS 0
[12:52:27] encx264: min-keyint: 24, keyint: 240
[12:52:27] encx264: encoding at constant RF 20.000000
[12:52:27] encx264: unparsed options: b-adapt=2:rc-lookahead=50
x264 [info]: using SAR=134/135
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
x264 [info]: profile High, level 4.0
Encoding: task 1 of 1, 0.40 % (20.39 fps, avg 35.19 fps, ETA 01h50m49s)
Not the full log, because I really haven't worked out how to make sure "everything" gets captured... I just took a screen shot when it got to the actual encode.

Is it the "using cpu capabilities" line?

The most frequent issue with stream selection is that the forced/full subtitle tracks are "reversed", i.e., the forced-only subtitle track is the SECOND one in the file, meaning I have to reverse them when I encode with HB.

Since it's been decided that there will no longer be a GUI that constructs a CLI interface batch file, it would be REALLY nice if the GUIs had the option to select multiple files, and let you build a queue with a common set of parameters... That is, take one of the files selected as "representative", select which tracks to include in which order, and the queue would be built as if you'd repeatedly done that on each selected file. THAT would get me away from using the older NB and even the CLI itself...
Deleted User 11865

Re: Can meta data be set within Handbrake via CLI?

Post by Deleted User 11865 »

Woodstock wrote:The logs show when QSV is active? I only saw the detection in the log, not that it was being used:

Code: Select all

-e x264
If you ask HandBrake to use x264, that's what it will use. If you want to try QSV, you have to use it (qsv_h264).

As a side note, since you have Ivy Bridge hardware and only Media SDK API 1.4 is available, you must have pretty old drivers for your Intel graphics.
Woodstock
Veteran User
Posts: 4621
Joined: Tue Aug 27, 2013 6:39 am

Re: Can meta data be set within Handbrake via CLI?

Post by Woodstock »

Rodeo wrote:If you ask HandBrake to use x264, that's what it will use. If you want to try QSV, you have to use it (qsv_h264).
Noted, batch file changed. Recoding Andromeda (SD video), it now says 350 frames per second, instead of 105...
As a side note, since you have Ivy Bridge hardware and only Media SDK API 1.4 is available, you must have pretty old drivers for your Intel graphics.
I figured as much, but... While Windows Update TELLS me there is a new Intel driver available, it refuses to actually install it, since I already have the "best" one for my hardware. Need to override that one of these days.

Thanks!
Woodstock
Veteran User
Posts: 4621
Joined: Tue Aug 27, 2013 6:39 am

Re: Can meta data be set within Handbrake via CLI?

Post by Woodstock »

And I've decided to UNmodify the batch files... QSV sure is fast, but the 10-15% increase in size vs. the software encoder with the same quality settings is not worth the speed.
Post Reply