Preserve embedded subtitles CLI

Support for HandBrake on Linux, Solaris, and other Unix-like platforms
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
sircameron
Posts: 10
Joined: Sun Jan 13, 2019 8:14 am

Preserve embedded subtitles CLI

Post by sircameron »

Description of problem or question:
I have a video with embedded subtitles. When transcoding it, the subtitles are lost. I have tried many different settings using the app on Mac and using CLI on Ubuntu, but the subtitles are always removed.

When using the app, the presets actually work, but using --preset-import-file in CLI, the presets are not used - only defaults.
This makes it very difficult to see why, in the app, subtitles are preserved but not when using CLI.

ultimately, subtitles are not working when transcoding CLI, but are working with the app. I need the CLI to work.
In the app it works by default - no special settings needed.

Has anyone managed:
1 - to get the preset file to work correctly in CLI
2 - to get subtitles to work in CLI

Steps to reproduce the problem (If Applicable):
get a video file with embedded subtitles and transcode it using CLI.

HandBrake version (e.g., 1.0.0):
app 1.2.0
cli 1.1.2 (no newer version available at the time of writing)

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

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

This is a dump from the app. not cli.

Code: Select all

HandBrake Activity Log for Session: 2019-01-13T09:24:11Z
Handbrake Version: 1.2.0 (2018122200)
NENAMAGAT_2.mp4
Preset: FFL v3
[11:24:11] macgui: QueueCore prevented sleep
[11:24:11] macgui: QueueCore scanning specifically for title: 1
[11:24:11] CPU: Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
[11:24:11]  - Intel microarchitecture Haswell
[11:24:11]  - logical processor count: 8
[11:24:11] hb_scan: path=/Users/sircameron/Vagrant/Apache/NENAMAGAT.mp4, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
disc.c:323: failed opening UDF image /Users/sircameron/Vagrant/Apache/NENAMAGAT.mp4
disc.c:424: error opening file BDMV/index.bdmv
disc.c:424: error opening file BDMV/BACKUP/index.bdmv
[11:24:11] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 6.0.0
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
[11:24:11] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/sircameron/Vagrant/Apache/NENAMAGAT.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41isomavc1
    creation_time   : 2018-04-20T09:31:56.000000Z
  Duration: 00:17:13.77, start: 0.000000, bitrate: 510 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 640x360, 377 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc (default)
    Metadata:
      creation_time   : 2018-04-20T09:31:56.000000Z
      handler_name    : L-SMASH Video Handler
      encoder         : AVC Coding
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2018-04-20T09:31:56.000000Z
      handler_name    : L-SMASH Audio Handler
[11:24:11] scan: decoding previews for title 1
[11:24:11] scan: audio 0x1: aac, rate=48000Hz, bitrate=128000 Unknown (AAC LC) (2.0 ch)
[11:24:11] scan: 10 previews, 640x360, 25.000 fps, autocrop = 48/48/0/0, aspect 16:9, PAR 1:1
[11:24:11] libhb: scan thread found 1 valid title(s)
[11:24:11] macgui: QueueCore scan done
[11:24:11] 1 job(s) to process
[11:24:11] Skipping subtitle scan.  No suitable subtitle tracks.
[11:24:11] starting job
[11:24:11] decomb filter thread started for segment 0
[11:24:11] decomb filter thread started for segment 1
[11:24:11] decomb filter thread started for segment 2
[11:24:11] decomb filter thread started for segment 3
[11:24:11] decomb filter thread started for segment 4
[11:24:11] decomb filter thread started for segment 5
[11:24:11] decomb filter thread started for segment 6
[11:24:11] decomb filter thread started for segment 7
[11:24:11] decomb check thread started for segment 0
[11:24:11] decomb check thread started for segment 1
[11:24:11] decomb check thread started for segment 2
[11:24:11] decomb check thread started for segment 3
[11:24:11] decomb check thread started for segment 4
[11:24:11] decomb check thread started for segment 5
[11:24:11] decomb check thread started for segment 6
[11:24:11] decomb check thread started for segment 7
[11:24:11] mask filter thread started for segment 0
[11:24:11] mask filter thread started for segment 1
[11:24:11] mask filter thread started for segment 2
[11:24:11] mask filter thread started for segment 3
[11:24:11] mask filter thread started for segment 4
[11:24:11] mask filter thread started for segment 5
[11:24:11] mask filter thread started for segment 6
[11:24:11] mask filter thread started for segment 7
[11:24:11] mask erode thread started for segment 0
[11:24:11] mask erode thread started for segment 1
[11:24:11] mask erode thread started for segment 2
[11:24:11] mask erode thread started for segment 3
[11:24:11] mask erode thread started for segment 4
[11:24:11] mask erode thread started for segment 5
[11:24:11] mask erode thread started for segment 6
[11:24:11] mask erode thread started for segment 7
[11:24:11] mask dilate thread started for segment 0
[11:24:11] mask dilate thread started for segment 1
[11:24:11] mask dilate thread started for segment 2
[11:24:11] mask dilate thread started for segment 3
[11:24:11] mask dilate thread started for segment 4
[11:24:11] macgui: QueueCore started encoding NENAMAGAT_2.mp4
[11:24:11] macgui: QueueCore with preset FFL v3
[11:24:11] mask dilate thread started for segment 5
[11:24:11] mask dilate thread started for segment 6
[11:24:11] mask dilate thread started for segment 7
[11:24:11] yadif thread started for segment 0
[11:24:11] yadif thread started for segment 1
[11:24:11] yadif thread started for segment 2
[11:24:11] yadif thread started for segment 3
[11:24:11] yadif thread started for segment 7
[11:24:11] work: only 1 chapter, disabling chapter markers
[11:24:11] yadif thread started for segment 6
[11:24:11] yadif thread started for segment 4
[11:24:11] yadif thread started for segment 5
[11:24:11] job configuration:
[11:24:11]  * source
[11:24:11]    + /Users/sircameron/Vagrant/Apache/NENAMAGAT.mp4
[11:24:11]    + title 1, chapter(s) 1 to 1
[11:24:11]    + container: mov,mp4,m4a,3gp,3g2,mj2
[11:24:11]    + data rate: 510 kbps
[11:24:11]  * destination
[11:24:11]    + /Users/sircameron/Vagrant/Apache/NENAMAGAT_2.mp4
[11:24:11]    + container: MPEG-4 (libavformat)
[11:24:11]      + optimized for HTTP streaming (fast start)
[11:24:11]      + align initial A/V stream timestamps
[11:24:11]  * video track
[11:24:11]    + decoder: h264
[11:24:11]      + bitrate 377 kbps
[11:24:11]    + filters
[11:24:11]      + 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)
[11:24:11]      + Decomb (mode=39)
[11:24:11]      + Framerate Shaper (mode=1:rate=27000000/1080000)
[11:24:11]        + frame rate: 25.000 fps -> constant 25.000 fps
[11:24:11]      + Crop and Scale (width=640:height=360:crop-top=0:crop-bottom=0:crop-left=0:crop-right=0)
[11:24:11]        + source: 640 * 360, crop (0/0/0/0): 640 * 360, scale: 640 * 360
[11:24:11]    + Output geometry
[11:24:11]      + storage dimensions: 640 x 360
[11:24:11]      + pixel aspect ratio: 1 : 1
[11:24:11]      + display dimensions: 640 x 360
[11:24:11]    + encoder: H.264 (libx264)
[11:24:11]      + preset:  fast
[11:24:11]      + profile: main
[11:24:11]      + level:   3.0
[11:24:11]      + bitrate: 1100 kbps, pass: 1
[11:24:11]      + fast first pass
[11:24:11]      + options: ref=1:8x8dct=0:me=dia:trellis=0
[11:24:11]                 analyse=i4x4 (if originally enabled, else analyse=none)
[11:24:11]                 subq=2 (if originally greater than 2, else subq unchanged)
[11:24:11]      + color profile: 6-1-6
[11:24:11]  * audio track 1
[11:24:11]    + decoder: Unknown (AAC LC) (2.0 ch) (track 1, id 0x1)
[11:24:11]      + bitrate: 128 kbps, samplerate: 48000 Hz
[11:24:11]    + mixdown: Stereo
[11:24:11]    + dither: triangular
[11:24:11]    + encoder: AAC (Apple AudioToolbox)
[11:24:11]      + bitrate: 256 kbps, samplerate: 48000 Hz
[11:24:11] sync: expecting 25844 video frames
[11:24:11] encx264: encoding at average bitrate 1100
[11:24:11] encx264: unparsed options: level=3.0:ref=2:8x8dct=0:weightp=1:subme=6:vbv-bufsize=10000:vbv-maxrate=10000:rc-lookahead=30
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x264 [info]: profile Main, level 3.0, 4:2:0, 8-bit
[11:24:11] sync: first pts video is 0
[11:24:11] sync: "Chapter 1" (1) at frame 1 time 0
[11:24:11] sync: first pts audio 0x1 is 0
[11:25:18] reader: done. 1 scr changes
[11:25:18] work: average encoding speed for job is 384.343292 fps
[11:25:18] comb detect: heavy 5 | light 34 | uncombed 25805 | total 25844
[11:25:18] decomb: deinterlaced 5 | blended 34 | unfiltered 25805 | total 25844
[11:25:18] vfr: 25844 frames output, 0 dropped and 0 duped for CFR/PFR
[11:25:18] vfr: lost time: 0 (0 frames)
[11:25:18] vfr: gained time: 0 (0 frames) (0 not accounted for)
[11:25:18] aac-decoder done: 48458 frames, 0 decoder errors
[11:25:18] h264-decoder done: 25844 frames, 0 decoder errors
[11:25:18] sync: got 25844 frames, 25844 expected
[11:25:18] sync: framerate min 25.000 fps, max 25.000 fps, avg 25.000 fps
x264 [info]: frame I:192   Avg QP: 7.12  size: 31848
x264 [info]: frame P:7956  Avg QP:10.19  size: 10649
x264 [info]: frame B:17696 Avg QP:14.26  size:  2308
x264 [info]: consecutive B-frames:  2.9% 13.4% 11.9% 71.8%
x264 [info]: mb I  I16..4: 38.8%  0.0% 61.2%
x264 [info]: mb P  I16..4:  9.6%  0.0%  0.0%  P16..4: 51.1%  0.0%  0.0%  0.0%  0.0%    skip:39.3%
x264 [info]: mb B  I16..4:  1.0%  0.0%  0.0%  B16..8: 28.5%  0.0%  0.0%  direct: 7.8%  skip:62.8%  L0:31.8% L1:41.5% BI:26.7%
x264 [info]: final ratefactor: 12.71
x264 [info]: coded y,uvDC,uvAC intra: 67.7% 65.8% 37.9% inter: 18.3% 12.3% 1.3%
x264 [info]: i16 v,h,dc,p: 40% 29% 17% 14%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 20% 11%  6%  7%  8%  7%  8%  7%
x264 [info]: i8c dc,h,v,p: 50% 26% 18%  6%
x264 [info]: Weighted P-Frames: Y:1.7% UV:0.2%
x264 [info]: kb/s:1019.05
[11:25:18] starting job
[11:25:18] decomb filter thread started for segment 0
[11:25:18] decomb filter thread started for segment 1
[11:25:18] decomb filter thread started for segment 2
[11:25:18] decomb filter thread started for segment 4
[11:25:18] decomb filter thread started for segment 3
[11:25:18] decomb filter thread started for segment 5
[11:25:18] decomb filter thread started for segment 6
[11:25:18] decomb check thread started for segment 0
[11:25:18] decomb check thread started for segment 3
[11:25:18] decomb check thread started for segment 1
[11:25:18] decomb check thread started for segment 5
[11:25:18] decomb filter thread started for segment 7
[11:25:18] decomb check thread started for segment 7
[11:25:18] decomb check thread started for segment 2
[11:25:18] mask filter thread started for segment 0
[11:25:18] decomb check thread started for segment 4
[11:25:18] mask filter thread started for segment 1
[11:25:18] decomb check thread started for segment 6
[11:25:18] mask filter thread started for segment 2
[11:25:18] mask filter thread started for segment 3
[11:25:18] mask filter thread started for segment 4
[11:25:18] mask filter thread started for segment 6
[11:25:18] mask filter thread started for segment 5
[11:25:18] mask filter thread started for segment 7
[11:25:18] mask erode thread started for segment 0
[11:25:18] mask erode thread started for segment 1
[11:25:18] mask erode thread started for segment 2
[11:25:18] mask erode thread started for segment 3
[11:25:18] mask erode thread started for segment 5
[11:25:18] mask erode thread started for segment 4
[11:25:18] mask erode thread started for segment 6
[11:25:18] mask dilate thread started for segment 0
[11:25:18] mask erode thread started for segment 7
[11:25:18] mask dilate thread started for segment 1
[11:25:18] mask dilate thread started for segment 2
[11:25:18] mask dilate thread started for segment 3
[11:25:18] mask dilate thread started for segment 4
[11:25:18] mask dilate thread started for segment 5
[11:25:18] mask dilate thread started for segment 7
[11:25:18] mask dilate thread started for segment 6
[11:25:18] yadif thread started for segment 0
[11:25:18] yadif thread started for segment 2
[11:25:18] yadif thread started for segment 3
[11:25:18] yadif thread started for segment 1
[11:25:18] yadif thread started for segment 5
[11:25:18] yadif thread started for segment 6
[11:25:18] yadif thread started for segment 4
[11:25:18] work: only 1 chapter, disabling chapter markers
[11:25:18] job configuration:
[11:25:18]  * source
[11:25:18]    + /Users/sircameron/Vagrant/Apache/NENAMAGAT.mp4
[11:25:18]    + title 1, chapter(s) 1 to 1
[11:25:18]    + container: mov,mp4,m4a,3gp,3g2,mj2
[11:25:18]    + data rate: 510 kbps
[11:25:18]  * destination
[11:25:18]    + /Users/sircameron/Vagrant/Apache/NENAMAGAT_2.mp4
[11:25:18]    + container: MPEG-4 (libavformat)
[11:25:18] yadif thread started for segment 7
[11:25:18]      + optimized for HTTP streaming (fast start)
[11:25:18]      + align initial A/V stream timestamps
[11:25:18]  * video track
[11:25:18]    + decoder: h264
[11:25:18]      + bitrate 377 kbps
[11:25:18]    + filters
[11:25:18]      + 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)
[11:25:18]      + Decomb (mode=39)
[11:25:18]      + Framerate Shaper (mode=1:rate=27000000/1080000)
[11:25:18]        + frame rate: 25.000 fps -> constant 25.000 fps
[11:25:18]      + Crop and Scale (width=640:height=360:crop-top=0:crop-bottom=0:crop-left=0:crop-right=0)
[11:25:18]        + source: 640 * 360, crop (0/0/0/0): 640 * 360, scale: 640 * 360
[11:25:18]    + Output geometry
[11:25:18]      + storage dimensions: 640 x 360
[11:25:18]      + pixel aspect ratio: 1 : 1
[11:25:18]      + display dimensions: 640 x 360
[11:25:18]    + encoder: H.264 (libx264)
[11:25:18]      + preset:  fast
[11:25:18]      + profile: main
[11:25:18]      + level:   3.0
[11:25:18]      + bitrate: 1100 kbps, pass: 2
[11:25:18]      + color profile: 6-1-6
[11:25:18]  * audio track 1
[11:25:18]    + decoder: Unknown (AAC LC) (2.0 ch) (track 1, id 0x1)
[11:25:18]      + bitrate: 128 kbps, samplerate: 48000 Hz
[11:25:18]    + mixdown: Stereo
[11:25:18]    + dither: triangular
[11:25:18]    + encoder: AAC (Apple AudioToolbox)
[11:25:18]      + bitrate: 256 kbps, samplerate: 48000 Hz
[11:25:18] sync: expecting 25844 video frames
[11:25:18] encx264: encoding at average bitrate 1100
[11:25:18] encx264: unparsed options: level=3.0:ref=2:8x8dct=0:weightp=1:subme=6:vbv-bufsize=10000:vbv-maxrate=10000:rc-lookahead=30
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x264 [info]: profile Main, level 3.0, 4:2:0, 8-bit
[11:25:19] sync: first pts video is 0
[11:25:19] sync: "Chapter 1" (1) at frame 1 time 0
[11:25:19] sync: first pts audio 0x1 is 0
[11:27:40] reader: done. 1 scr changes
[11:27:40] work: average encoding speed for job is 182.233719 fps
[11:27:40] comb detect: heavy 5 | light 34 | uncombed 25805 | total 25844
[11:27:40] decomb: deinterlaced 5 | blended 34 | unfiltered 25805 | total 25844
[11:27:40] vfr: 25844 frames output, 0 dropped and 0 duped for CFR/PFR
[11:27:40] vfr: lost time: 0 (0 frames)
[11:27:40] vfr: gained time: 0 (0 frames) (0 not accounted for)
[11:27:40] aac-decoder done: 48458 frames, 0 decoder errors
[11:27:40] h264-decoder done: 25844 frames, 0 decoder errors
[11:27:40] sync: got 25844 frames, 25844 expected
[11:27:40] sync: framerate min 25.000 fps, max 25.000 fps, avg 25.000 fps
x264 [info]: frame I:192   Avg QP: 5.96  size: 35892
x264 [info]: frame P:7956  Avg QP: 9.22  size: 11927
x264 [info]: frame B:17696 Avg QP:12.73  size:  2300
x264 [info]: consecutive B-frames:  2.9% 13.4% 11.9% 71.8%
x264 [info]: mb I  I16..4: 40.8%  0.0% 59.2%
x264 [info]: mb P  I16..4:  2.0%  0.0%  7.8%  P16..4: 23.1% 16.4% 11.3%  0.0%  0.0%    skip:39.4%
x264 [info]: mb B  I16..4:  0.4%  0.0%  1.1%  B16..8: 24.0%  9.7%  1.7%  direct: 5.1%  skip:58.1%  L0:40.9% L1:45.3% BI:13.7%
x264 [info]: coded y,uvDC,uvAC intra: 80.2% 79.8% 62.7% inter: 16.8% 14.4% 3.8%
x264 [info]: i16 v,h,dc,p: 40% 28% 11% 21%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 20% 12%  6%  8%  9%  6%  8%  6%
x264 [info]: i8c dc,h,v,p: 48% 24% 21%  8%
x264 [info]: Weighted P-Frames: Y:3.4% UV:0.2%
x264 [info]: ref P L0: 80.8% 19.2%
x264 [info]: ref B L0: 86.9% 13.1%
x264 [info]: ref B L1: 96.2%  3.8%
x264 [info]: kb/s:1102.71
[11:27:41] mux: track 0, 25844 frames, 142484799 bytes, 1102.57 kbps, fifo 4096
[11:27:41] mux: track 1, 48461 frames, 33984520 bytes, 262.98 kbps, fifo 8192
[11:27:41] libhb: work result = 0

Woodstock
Veteran User
Posts: 4613
Joined: Tue Aug 27, 2013 6:39 am

Re: Preserve embedded subtitles CLI

Post by Woodstock »

[11:24:11] Skipping subtitle scan. No suitable subtitle tracks.

Handbrake did not see any subtitles in the source. Did it include any?

If you want to see the log information from the CLI, append "2>/path/to/log" to the end of your command line, where "/path/to/log" is where the log will be written.
sircameron
Posts: 10
Joined: Sun Jan 13, 2019 8:14 am

Re: Preserve embedded subtitles CLI

Post by sircameron »

Thanks
yes, there are definitely subtitles in the video.

Skipping subtitle scan. No suitable subtitle tracks. -> this is the app output, which does actually preserve the subtitles.

CLI also doesn't use the preset file, it simply uses defaults - which makes this process more frustrating.

The preset works in the app and the subtitles are preserved.
But exporting the preset file and using it in CLI doen't work.

command used:

Code: Select all

HandBrakeCLI -i in.mp4 -o out.mp4 --preset-import-file encode-preset-st.json 2> /tmp/encode2.log
preset file:

Code: Select all

{
  "PresetList" : [
    {
      "AlignAVStart" : true,
      "AudioCopyMask" : [
        "copy:aac"
      ],
      "AudioEncoderFallback" : "ca_aac",
      "AudioLanguageList" : [

      ],
      "AudioList" : [
        {
          "AudioBitrate" : 256,
          "AudioCompressionLevel" : -1,
          "AudioDitherMethod" : "auto",
          "AudioEncoder" : "ca_aac",
          "AudioMixdown" : "dpl2",
          "AudioNormalizeMixLevel" : false,
          "AudioSamplerate" : "48",
          "AudioTrackDRCSlider" : 0,
          "AudioTrackGainSlider" : 0,
          "AudioTrackQuality" : -1,
          "AudioTrackQualityEnable" : false
        }
      ],
      "AudioSecondaryEncoderMode" : true,
      "AudioTrackSelectionBehavior" : "first",
      "ChapterMarkers" : true,
      "ChildrenArray" : [

      ],
      "Default" : false,
      "FileFormat" : "av_mp4",
      "Folder" : false,
      "FolderOpen" : false,
      "InlineParameterSets" : false,
      "Mp4HttpOptimize" : true,
      "Mp4iPodCompatible" : false,
      "PictureAutoCrop" : false,
      "PictureBottomCrop" : 0,
      "PictureCombDetectCustom" : "",
      "PictureCombDetectPreset" : "default",
      "PictureDARWidth" : 0,
      "PictureDeblock" : 0,
      "PictureDeblockCustom" : "qp=0:mode=2",
      "PictureDeinterlaceCustom" : "",
      "PictureDeinterlaceFilter" : "decomb",
      "PictureDeinterlacePreset" : "default",
      "PictureDenoiseCustom" : "",
      "PictureDenoiseFilter" : "off",
      "PictureDenoisePreset" : "light",
      "PictureDenoiseTune" : "none",
      "PictureDetelecine" : "off",
      "PictureDetelecineCustom" : "",
      "PictureForceHeight" : 0,
      "PictureForceWidth" : 0,
      "PictureHeight" : 0,
      "PictureItuPAR" : false,
      "PictureKeepRatio" : true,
      "PictureLeftCrop" : 0,
      "PictureLooseCrop" : false,
      "PictureModulus" : 2,
      "PicturePAR" : "off",
      "PicturePARHeight" : 1,
      "PicturePARWidth" : 1,
      "PictureRightCrop" : 0,
      "PictureRotate" : "angle=0:hflip=0",
      "PictureSharpenCustom" : "",
      "PictureSharpenFilter" : "off",
      "PictureSharpenPreset" : "medium",
      "PictureSharpenTune" : "none",
      "PictureTopCrop" : 0,
      "PictureWidth" : 0,
      "PresetDescription" : "",
      "PresetName" : "FFL v3 st",
      "SubtitleAddCC" : true,
      "SubtitleAddForeignAudioSearch" : true,
      "SubtitleAddForeignAudioSubtitle" : false,
      "SubtitleBurnBDSub" : true,
      "SubtitleBurnBehavior" : "foreign",
      "SubtitleBurnDVDSub" : true,
      "SubtitleLanguageList" : [
        "und"
      ],
      "SubtitleTrackSelectionBehavior" : "first",
      "Type" : 1,
      "UsesPictureFilters" : true,
      "UsesPictureSettings" : 2,
      "VideoAvgBitrate" : 1100,
      "VideoColorMatrixCode" : 0,
      "VideoEncoder" : "x264",
      "VideoFramerate" : "auto",
      "VideoFramerateMode" : "cfr",
      "VideoGrayScale" : false,
      "VideoLevel" : "3.0",
      "VideoOptionExtra" : "",
      "VideoPreset" : "fast",
      "VideoProfile" : "main",
      "VideoQSVAsyncDepth" : 4,
      "VideoQSVDecode" : false,
      "VideoQualitySlider" : 24,
      "VideoQualityType" : 1,
      "VideoScaler" : "swscale",
      "VideoTune" : "",
      "VideoTurboTwoPass" : true,
      "VideoTwoPass" : true,
      "x264Option" : "",
      "x264UseAdvancedOptions" : false
    }
  ],
  "VersionMajor" : 34,
  "VersionMicro" : 0,
  "VersionMinor" : 0
}
log output:

Code: Select all

[13:17:07] hb_init: starting libhb thread
[13:17:07] thread 7f461de4c700 started ("libhb")
HandBrake 1.1.2 (2018091000) - Linux x86_64 - https://handbrake.fr
1 CPU detected
Opening /vagrant/NENAMAGAT.mp4...
[13:17:07] CPU: Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
[13:17:07]  - Intel microarchitecture Haswell
[13:17:07]  - logical processor count: 1
[13:17:07] hb_scan: path=/vagrant/NENAMAGAT.mp4, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
disc.c:323: failed opening UDF image /vagrant/NENAMAGAT.mp4
disc.c:424: error opening file BDMV/index.bdmv
disc.c:424: error opening file BDMV/BACKUP/index.bdmv
[13:17:07] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 6.0.0
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
[13:17:07] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/vagrant/NENAMAGAT.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41isomavc1
    creation_time   : 2018-04-20 09:31:56
  Duration: 00:17:13.77, start: 0.000000, bitrate: 510 kb/s
    Stream #0:0(und): Video: h264 (High) [avc1 / 0x31637661]
      yuv420p, tv, smpte170m/smpte170m/smpte170m
      640x360, 377 kb/s
      25 fps, 25 tbn (default)
    Metadata:
      creation_time   : 2018-04-20 09:31:56
      handler_name    : L-SMASH Video Handler
      encoder         : AVC Coding
    Stream #0:1(und): Audio: aac (LC) [mp4a / 0x6134706D]
      48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2018-04-20 09:31:56
      handler_name    : L-SMASH Audio Handler
[13:17:07] scan: decoding previews for title 1
[13:17:07] scan: audio 0x1: aac, rate=48000Hz, bitrate=128000 Unknown (AAC) (2.0 ch)
[13:17:07] scan: 10 previews, 640x360, 25.000 fps, autocrop = 48/48/0/0, aspect 16:9, PAR 1:1
[13:17:07] libhb: scan thread found 1 valid title(s)
+ Using preset: CLI Default
+ title 1:
  + stream: /vagrant/NENAMAGAT.mp4
  + duration: 00:17:13
  + size: 640x360, pixel aspect: 1/1, display aspect: 1.78, 25.000 fps
  + autocrop: 48/48/0/0
  + chapters:
    + 1: cells 0->0, 0 blocks, duration 00:17:13
  + audio tracks:
    + 1, Unknown (AAC) (2.0 ch) (iso639-2: und)
  + subtitle tracks:
[13:17:07] 1 job(s) to process
[13:17:07] json job:
{
    "Audio": {
        "AudioList": [
            {
                "Bitrate": 128,
                "CompressionLevel": -1.0,
                "DRC": 0.0,
                "DitherMethod": "auto",
                "Encoder": "av_aac",
                "Gain": 0.0,
                "Mixdown": "stereo",
                "NormalizeMixLevel": false,
                "PresetEncoder": "av_aac",
                "Quality": -3.0,
                "Samplerate": 0,
                "Track": 0
            }
        ],
        "CopyMask": [
            "copy:aac",
            "copy:ac3",
            "copy:eac3",
            "copy:dtshd",
            "copy:dts",
            "copy:mp3",
            "copy:truehd",
            "copy:flac"
        ],
        "FallbackEncoder": "av_aac"
    },
    "Destination": {
        "AlignAVStart": false,
        "ChapterList": [
            {
                "Name": ""
            }
        ],
        "ChapterMarkers": false,
        "File": "/vagrant/NENAMAGAT_cli.mp4",
        "InlineParameterSets": false,
        "Mp4Options": {
            "IpodAtom": false,
            "Mp4Optimize": false
        },
        "Mux": "m4v"
    },
    "Filters": {
        "FilterList": [
            {
                "ID": 6,
                "Settings": {
                    "mode": 0
                }
            },
            {
                "ID": 11,
                "Settings": {
                    "crop-bottom": 48,
                    "crop-left": 0,
                    "crop-right": 0,
                    "crop-top": 48,
                    "height": 264,
                    "width": 640
                }
            }
        ]
    },
    "Metadata": {},
    "PAR": {
        "Den": 1,
        "Num": 1
    },
    "SequenceID": 0,
    "Source": {
        "Angle": 0,
        "Path": "/vagrant/NENAMAGAT.mp4",
        "Range": {
            "End": 1,
            "Start": 1,
            "Type": "chapter"
        },
        "Title": 1
    },
    "Subtitle": {
        "Search": {
            "Burn": true,
            "Default": false,
            "Enable": false,
            "Forced": false
        },
        "SubtitleList": []
    },
    "Video": {
        "ColorMatrixCode": 0,
        "Encoder": "x264",
        "Level": "auto",
        "Options": "",
        "Preset": "medium",
        "Profile": "auto",
        "QSV": {
            "AsyncDepth": 4,
            "Decode": false
        },
        "Quality": 22.0,
        "Tune": "",
        "Turbo": false,
        "TwoPass": false
    }
}
[13:17:07] starting job
[13:17:07] job configuration:
[13:17:07]  * source
[13:17:07]    + /vagrant/NENAMAGAT.mp4
[13:17:07]    + title 1, chapter(s) 1 to 1
[13:17:07]    + container: mov,mp4,m4a,3gp,3g2,mj2
[13:17:07]    + data rate: 510 kbps
[13:17:07]  * destination
[13:17:07]    + /vagrant/NENAMAGAT_cli.mp4
[13:17:07]    + container: MPEG-4 (libavformat)
[13:17:07]  * video track
[13:17:07]    + decoder: h264
[13:17:07]      + bitrate 377 kbps
[13:17:07]    + filters
[13:17:07]      + Framerate Shaper (mode=0)
[13:17:07]        + frame rate: same as source (around 25.000 fps)
[13:17:07]      + Crop and Scale (width=640:height=264:crop-top=48:crop-bottom=48:crop-left=0:crop-right=0)
[13:17:07]        + source: 640 * 360, crop (48/48/0/0): 640 * 264, scale: 640 * 264
[13:17:07]    + Output geometry
[13:17:07]      + storage dimensions: 640 x 264
[13:17:07]      + pixel aspect ratio: 1 : 1
[13:17:07]      + display dimensions: 640 x 264
[13:17:07]    + encoder: H.264 (libx264)
[13:17:07]      + preset:  medium
[13:17:07]      + profile: auto
[13:17:07]      + level:   auto
[13:17:07]      + quality: 22.00 (RF)
[13:17:07]  * audio track 1
[13:17:07]    + decoder: Unknown (AAC) (2.0 ch) (track 1, id 0x1)
[13:17:07]      + bitrate: 128 kbps, samplerate: 48000 Hz
[13:17:07]    + mixdown: Stereo
[13:17:07]    + encoder: AAC (libavcodec)
[13:17:07]      + bitrate: 128 kbps, samplerate: 48000 Hz
[13:17:07] sync: expecting 25844 video frames
[13:17:07] encx264: encoding at constant RF 22.000000
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 LZCNT
x264 [info]: profile High, level 2.1
[13:17:07] sync: first pts video is 0
[13:17:07] sync: Chapter 1 at frame 1 time 0
[13:17:07] sync: first pts audio 0x1 is 0
[13:22:42] reader: done. 1 scr changes
[13:22:43] work: average encoding speed for job is 76.619492 fps
[13:22:44] vfr: lost time: 0 (0 frames)
[13:22:44] vfr: gained time: 0 (0 frames) (0 not accounted for)
[13:22:44] aac-decoder done: 48458 frames, 0 decoder errors
[13:22:44] h264-decoder done: 25844 frames, 0 decoder errors
[13:22:44] sync: got 25844 frames, 25844 expected
[13:22:44] sync: framerate min 25.000 fps, max 25.000 fps, avg 25.000 fps
x264 [info]: frame I:197   Avg QP:17.33  size: 15946
x264 [info]: frame P:9426  Avg QP:21.62  size:  3198
x264 [info]: frame B:16221 Avg QP:25.00  size:   633
x264 [info]: consecutive B-frames:  6.9% 22.9% 15.8% 54.3%
x264 [info]: mb I  I16..4: 12.2% 68.2% 19.6%
x264 [info]: mb P  I16..4:  1.3%  6.2%  0.7%  P16..4: 38.2% 14.5%  7.4%  0.0%  0.0%    skip:31.8%
x264 [info]: mb B  I16..4:  0.1%  0.3%  0.0%  B16..8: 35.0%  2.7%  0.5%  direct: 0.9%  skip:60.6%  L0:42.6% L1:52.4% BI: 5.0%
x264 [info]: 8x8 transform intra:74.4% inter:75.7%
x264 [info]: coded y,uvDC,uvAC intra: 62.6% 64.8% 16.4% inter: 11.5% 11.6% 0.1%
x264 [info]: i16 v,h,dc,p: 34% 19%  8% 38%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 13% 18%  5%  6%  9%  6%  8%  6%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 12% 13%  5%  8% 10%  7%  7%  5%
x264 [info]: i8c dc,h,v,p: 56% 17% 21%  5%
x264 [info]: Weighted P-Frames: Y:3.3% UV:0.3%
x264 [info]: ref P L0: 60.9% 19.1% 14.6%  5.2%  0.1%
x264 [info]: ref B L0: 89.5%  9.0%  1.6%
x264 [info]: ref B L1: 95.0%  5.0%
x264 [info]: kb/s:337.07
[13:22:44] mux: track 0, 25844 frames, 43547695 bytes, 336.99 kbps, fifo 8192
[13:22:44] mux: track 1, 48459 frames, 16556271 bytes, 128.12 kbps, fifo 16384
[13:22:44] libhb: work result = 0

Encode done!
HandBrake has exited.
You can see in the output, that the presets are ignored.
mduell
Veteran User
Posts: 8182
Joined: Sat Apr 21, 2007 8:54 pm

Re: Preserve embedded subtitles CLI

Post by mduell »

--preset-import-file just makes the preset(s) in the file(s) named available in the CLI. You need to specify a preset name from those file(s) using --preset if you want to use a particular preset. This is covered in the documentation.

Handbrake 1.1.2 is not supported.
sircameron
Posts: 10
Joined: Sun Jan 13, 2019 8:14 am

Re: Preserve embedded subtitles CLI

Post by sircameron »

Thanks I will check it out.

What do you mean 1.1.2 isn't supported?
It's the only version of CLI available.
mduell
Veteran User
Posts: 8182
Joined: Sat Apr 21, 2007 8:54 pm

Re: Preserve embedded subtitles CLI

Post by mduell »

I'm not sure what could cause you to think that; 1.2.0 CLI is available for all supported platforms on https://handbrake.fr/downloads2.php
Woodstock
Veteran User
Posts: 4613
Joined: Tue Aug 27, 2013 6:39 am

Re: Preserve embedded subtitles CLI

Post by Woodstock »

https://handbrake.fr/downloads2.php lists version 1.2.0 as the current version of the CLI for Linux.

The command line has to be told to include subtitles. What happens if you add --subtitle 1-99 to the command line?
sircameron
Posts: 10
Joined: Sun Jan 13, 2019 8:14 am

Re: Preserve embedded subtitles CLI

Post by sircameron »

adding the PPA and installing with apt-get only gets me 1.1.2
mduell
Veteran User
Posts: 8182
Joined: Sat Apr 21, 2007 8:54 pm

Re: Preserve embedded subtitles CLI

Post by mduell »

Then you're not using the PPA, or not on a supported version of Ubuntu.
sircameron
Posts: 10
Joined: Sun Jan 13, 2019 8:14 am

Re: Preserve embedded subtitles CLI

Post by sircameron »

I removed handbrake and did the following:

Code: Select all

sudo add-apt-repository ppa:stebbins/handbrake-releases
sudo apt-get update
sudo apt-get install handbrake-cli
HandBrakeCLI --version

HandBrake 1.1.2
edit: that's on Ubuntu 14 and 16.
mduell
Veteran User
Posts: 8182
Joined: Sat Apr 21, 2007 8:54 pm

Re: Preserve embedded subtitles CLI

Post by mduell »

1.2.0 is available in the PPA for 18 (Bionic and Cosmic)
sircameron
Posts: 10
Joined: Sun Jan 13, 2019 8:14 am

Re: Preserve embedded subtitles CLI

Post by sircameron »

Understood. Thanks!

PS: I managed to get subtitles working. Thanks for everyone's help on that :)
Woodstock
Veteran User
Posts: 4613
Joined: Tue Aug 27, 2013 6:39 am

Re: Preserve embedded subtitles CLI

Post by Woodstock »

Just so you know, the version being distributed by Ubuntu is known to have problems with subtitles and several other things, because the packager decided to use the "native" libraries in place of the ones patched to work with handbrake. And it isn't just Ubuntu that does that.

The flatpak distribution will, hopefully, provide a distribution-independent way to get an official copy, without so much politics behind it.
Post Reply