This actually concerns the same source as that in my previous issue. In spite of frame-accurate trimming during Blu-ray rip (AnyDVD HD was used again), output file retains two or three seconds' worth of audio after the trim point, where the video seems to either stall at the last frame for the same two or three seconds, or display frames that also occur after the trim point. In simpler terms, trimming by frame number is behaving somewhat similarly to how it does in MKVToolNix, which does no re-encoding and thus must rely on key frames.
I am not sure if this is a problem specific to this source or not, but I can say that it is working as expected with different sources, DVD and BD.
If it's important, this is a TV series, and there is a small portion that I am cutting out of each episode around the middle. Thus, for each episode, I make two output files, which I then merge together via MKVToolNix. The issue occurs in the two separate output files, as well as the merged file.
Steps to reproduce the problem (If Applicable)
I've prepared an abridged version of the source by doing a rip via MKVToolNix GUI with assistance from AnyDVD HD. It can be downloaded here:
https://1drv.ms/u/s!Aqbbpq4RDc1zhYpW0wf-J4HR55MSAA
- Choose "Shakugan_No_Shana-1-TS.mkv" as source.
- Configure settings as normal.
- Switch Range mode to Frames and enter range: 0 to 19683.
- (Optional) Add to Queue.
- (Optional) Enter another range: 19784 to 35147
- (Optional) Add to Queue
- Start Encode
- (Optional) Merge output files via the Append files feature in MKVToolNix
Nightly 20180126214425-21d0e57-master (2018012701) - 64bit
Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.3 High Sierra, Windows 10 Creators Update)
Windows 10 Creators Update
HandBrake Activity Log ***required*** (see How-to get an activity log)
Code: Select all
HandBrake Nightly 20180126214425-21d0e57-master (2018012701) - 64bit
OS: Microsoft Windows NT 10.0.16299.0 - 64bit
CPU: AMD A10-7850K Radeon R7, 12 Compute Cores 4C+8G
Ram: 7106 MB,
GPU Information:
AMD Radeon(TM) R7 Graphics - 22.19.677.257
Screen: 1920x1080
Temp Dir: C:\Users\schme\AppData\Local\Temp\
Install Dir: C:\Program Files\HandBrake Nightly
Data Dir: C:\Users\schme\AppData\Roaming\HandBrake Team\HandBrake\1.1.0.0
-------------------------------------------
# Starting Encode ...
[04:32:42] hb_init: starting libhb thread
[04:32:42] 1 job(s) to process
[04:32:42] json job:
{
"Audio": {
"AudioList": [
{
"DRC": 0.0,
"Encoder": 1125984256,
"Gain": 0.0,
"Mixdown": -1,
"NormalizeMixLevel": false,
"Samplerate": 0,
"Track": 0,
"DitherMethod": 0
},
{
"DRC": 0.0,
"Encoder": 1125984256,
"Gain": 0.0,
"Mixdown": -1,
"NormalizeMixLevel": false,
"Samplerate": 0,
"Track": 1,
"DitherMethod": 0
}
],
"CopyMask": [
1073807360,
1073743872,
1074003968,
1073750016,
1090519040,
1074790400,
1074266112,
1107296256
],
"FallbackEncoder": 2097152
},
"Destination": {
"ChapterList": [
{
"Name": "Chapter 1"
},
{
"Name": "Chapter 2"
},
{
"Name": "Chapter 3"
},
{
"Name": "Chapter 4"
},
{
"Name": "Chapter 5"
}
],
"ChapterMarkers": true,
"AlignAVStart": false,
"File": "E:\\Rips\\Shakugan_No_Shana-1-TS-2.mkv",
"Mp4Options": {
"IpodAtom": false,
"Mp4Optimize": false
},
"Mux": 2097152
},
"Filters": {
"FilterList": [
{
"ID": 4,
"Settings": {
"mode": "7"
}
},
{
"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": 11,
"Settings": {
"crop-bottom": "0",
"crop-left": "0",
"crop-right": "0",
"crop-top": "0",
"height": "1080",
"width": "1920"
}
},
{
"ID": 6,
"Settings": {
"mode": "0"
}
}
]
},
"PAR": {
"Num": 1,
"Den": 1
},
"Metadata": {},
"SequenceID": 0,
"Source": {
"Angle": 1,
"Range": {
"Type": "frame",
"Start": 19784,
"End": 35147
},
"Title": 1,
"Path": "E:\\Rips\\Shakugan_No_Shana-1-TS.mkv"
},
"Subtitle": {
"Search": {
"Burn": false,
"Default": false,
"Enable": false,
"Forced": false
},
"SubtitleList": [
{
"Burn": false,
"Default": false,
"Forced": false,
"ID": 1,
"Offset": 0,
"Track": 0
},
{
"Burn": false,
"Default": false,
"Forced": false,
"ID": 2,
"Offset": 0,
"Track": 1
}
]
},
"Video": {
"Encoder": 16384,
"Level": "auto",
"TwoPass": false,
"Turbo": false,
"ColorMatrixCode": 0,
"Options": "",
"Preset": "fast",
"Profile": "auto",
"Quality": 20.0,
"HWDecode": false,
"QSV": {
"Decode": false,
"AsyncDepth": 0
}
}
}
[04:32:42] CPU:
[04:32:42] - logical processor count: 4
[04:32:42] Intel Quick Sync Video support: no
[04:32:42] hb_scan: path=E:\Rips\Shakugan_No_Shana-1-TS.mkv, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
src/libbluray/disc/disc.c:323: failed opening UDF image E:\Rips\Shakugan_No_Shana-1-TS.mkv
src/libbluray/disc/disc.c:424: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:424: error opening file BDMV\BACKUP\index.bdmv
[04:32:42] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 5.0.3
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
[04:32:42] dvd: not a dvd - trying as a stream/file instead
Input #0, matroska,webm, from 'E:\Rips\Shakugan_No_Shana-1-TS.mkv':
Duration: 00:24:42.02, start: 0.000000, bitrate: N/A
Chapter #0:0: start 0.000000, end 106.064000
Metadata:
title : Chapter 1
Chapter #0:1: start 106.064000, end 821.028000
Metadata:
title : Chapter 2
Chapter #0:2: start 821.028000, end 1376.041000
Metadata:
title : Chapter 3
Chapter #0:3: start 1376.041000, end 1466.006000
Metadata:
title : Chapter 4
Chapter #0:4: start 1466.006000, end 1482.024000
Metadata:
title : Chapter 5
Stream #0:0: Video: h264 (High)
yuv420p, tv, bt709/bt709/bt709
1920x1080 [PAR 1:1 DAR 16:9], PAR 1:1 DAR 16:9
23.98 fps, 1k tbn (default)
Metadata:
BPS : 14934067
BPS-eng : 14934067
DURATION : 00:24:42.023000000
DURATION-eng : 00:24:42.023000000
NUMBER_OF_FRAMES: 35533
NUMBER_OF_FRAMES-eng: 35533
NUMBER_OF_BYTES : 2766578886
NUMBER_OF_BYTES-eng: 2766578886
_STATISTICS_WRITING_APP: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
_STATISTICS_WRITING_APP-eng: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2018-02-11 10:12:14
_STATISTICS_WRITING_DATE_UTC-eng: 2018-02-11 10:12:14
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:1(eng): Audio: truehd
48000 Hz, stereo, s32 (default)
Metadata:
BPS : 798580
BPS-eng : 798580
DURATION : 00:24:42.024000000
DURATION-eng : 00:24:42.024000000
NUMBER_OF_FRAMES: 1778427
NUMBER_OF_FRAMES-eng: 1778427
NUMBER_OF_BYTES : 147939466
NUMBER_OF_BYTES-eng: 147939466
_STATISTICS_WRITING_APP: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
_STATISTICS_WRITING_APP-eng: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2018-02-11 10:12:14
_STATISTICS_WRITING_DATE_UTC-eng: 2018-02-11 10:12:14
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:2(jpn): Audio: truehd
48000 Hz, stereo, s32
Metadata:
BPS : 845925
BPS-eng : 845925
DURATION : 00:24:42.024000000
DURATION-eng : 00:24:42.024000000
NUMBER_OF_FRAMES: 1778427
NUMBER_OF_FRAMES-eng: 1778427
NUMBER_OF_BYTES : 156710222
NUMBER_OF_BYTES-eng: 156710222
_STATISTICS_WRITING_APP: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
_STATISTICS_WRITING_APP-eng: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2018-02-11 10:12:14
_STATISTICS_WRITING_DATE_UTC-eng: 2018-02-11 10:12:14
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:3(eng): Subtitle: hdmv_pgs_subtitle (default)
Metadata:
BPS : 34449
BPS-eng : 34449
DURATION : 00:24:37.560000000
DURATION-eng : 00:24:37.560000000
NUMBER_OF_FRAMES: 607
NUMBER_OF_FRAMES-eng: 607
NUMBER_OF_BYTES : 6362583
NUMBER_OF_BYTES-eng: 6362583
_STATISTICS_WRITING_APP: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
_STATISTICS_WRITING_APP-eng: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2018-02-11 10:12:14
_STATISTICS_WRITING_DATE_UTC-eng: 2018-02-11 10:12:14
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:4(eng): Subtitle: hdmv_pgs_subtitle
Metadata:
title : English signs
BPS : 4330
BPS-eng : 4330
DURATION : 00:24:04.109000000
DURATION-eng : 00:24:04.109000000
NUMBER_OF_FRAMES: 58
NUMBER_OF_FRAMES-eng: 58
NUMBER_OF_BYTES : 781734
NUMBER_OF_BYTES-eng: 781734
_STATISTICS_WRITING_APP: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
_STATISTICS_WRITING_APP-eng: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2018-02-11 10:12:14
_STATISTICS_WRITING_DATE_UTC-eng: 2018-02-11 10:12:14
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
[04:32:43] scan: decoding previews for title 1
[04:32:43] scan: audio 0x1: truehd, rate=48000Hz, bitrate=1 English (TrueHD) (2.0 ch)
[04:32:43] scan: audio 0x2: truehd, rate=48000Hz, bitrate=1 ??? (TrueHD) (2.0 ch)
[04:32:43] scan: 10 previews, 1920x1080, 23.976 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1
[04:32:43] scan: supported video decoders: avcodec qsv
[04:32:43] libhb: scan thread found 1 valid title(s)
[04:32:43] starting job
[04:32:43] decomb filter thread started for segment 1
[04:32:43] decomb filter thread started for segment 2
[04:32:43] decomb filter thread started for segment 0
[04:32:43] decomb filter thread started for segment 3
[04:32:43] decomb check thread started for segment 0
[04:32:43] decomb check thread started for segment 1
[04:32:43] decomb check thread started for segment 2
[04:32:43] decomb check thread started for segment 3
[04:32:43] mask filter thread started for segment 0
[04:32:43] mask filter thread started for segment 1
[04:32:43] mask filter thread started for segment 2
[04:32:43] mask filter thread started for segment 3
[04:32:43] mask erode thread started for segment 0
[04:32:43] mask erode thread started for segment 1
[04:32:43] Auto Passthru: allowed codecs are AAC, AC3, E-AC3, TrueHD, DTS, DTS-HD, MP3, FLAC
[04:32:43] Auto Passthru: fallback is FLAC 24-bit
[04:32:43] mask erode thread started for segment 2
[04:32:43] Auto Passthru: using TrueHD Passthru for track 1
[04:32:43] Auto Passthru: using TrueHD Passthru for track 2
[04:32:43] mask erode thread started for segment 3
[04:32:43] mask dilate thread started for segment 0
[04:32:43] mask dilate thread started for segment 1
[04:32:43] mask dilate thread started for segment 2
[04:32:43] mask dilate thread started for segment 3
[04:32:43] yadif thread started for segment 0
[04:32:43] yadif thread started for segment 1
[04:32:43] yadif thread started for segment 2
[04:32:43] job configuration:
[04:32:43] * source
[04:32:43] + E:\Rips\Shakugan_No_Shana-1-TS.mkv
[04:32:43] + title 1, frames 19783 to 35146
[04:32:43] yadif thread started for segment 3
[04:32:43] + container: matroska,webm
[04:32:43] * destination
[04:32:43] + E:\Rips\Shakugan_No_Shana-1-TS-2.mkv
[04:32:43] + container: Matroska (libavformat)
[04:32:43] + chapter markers
[04:32:43] * video track
[04:32:43] + decoder: h264
[04:32:43] + filters
[04:32:43] + 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)
[04:32:43] + Decomb (mode=39)
[04:32:43] + Framerate Shaper (mode=0)
[04:32:43] + frame rate: same as source (around 23.976 fps)
[04:32:43] + Crop and Scale (width=1920:height=1080:crop-top=0:crop-bottom=0:crop-left=0:crop-right=0)
[04:32:43] + source: 1920 * 1080, crop (0/0/0/0): 1920 * 1080, scale: 1920 * 1080
[04:32:43] + Output geometry
[04:32:43] + storage dimensions: 1920 x 1080
[04:32:43] + pixel aspect ratio: 1 : 1
[04:32:43] + display dimensions: 1920 x 1080
[04:32:43] + encoder: H.265 12-bit (libx265)
[04:32:43] + preset: fast
[04:32:43] + profile: auto
[04:32:43] + quality: 20.00 (RF)
[04:32:43] * subtitle track 1, English [PGS] (track 0, id 0x3, Picture) -> Passthrough
[04:32:43] * subtitle track 2, English [PGS] (track 1, id 0x4, Picture) -> Passthrough
[04:32:43] * audio track 1
[04:32:43] + decoder: English (TrueHD) (2.0 ch) (track 1, id 0x1)
[04:32:43] + samplerate: 48000 Hz
[04:32:43] + TrueHD Passthru
[04:32:43] * audio track 2
[04:32:43] + decoder: ??? (TrueHD) (2.0 ch) (track 2, id 0x2)
[04:32:43] + samplerate: 48000 Hz
[04:32:43] + TrueHD Passthru
[04:32:43] sync: expecting 15364 video frames
x265 [info]: HEVC encoder version 2.6
x265 [info]: build info [Windows][GCC 7.1.0][64 bit] 12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX XOP FMA4 FMA3 BMI1
x265 [info]: Main 12 profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 4 threads
x265 [info]: Slices : 1
x265 [info]: frame threads / pool features : 2 / wpp(17 rows)
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 : hex / 57 / 2 / 2
x265 [info]: Keyframe min / max / scenecut / bias: 24 / 240 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt : 15 / 4 / 0
x265 [info]: b-pyramid / weightp / weightb : 1 / 1 / 0
x265 [info]: References / ref-limit cu / depth : 3 / on / on
x265 [info]: AQ: mode / str / qg-size / cu-tree : 1 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress : CRF-20.0 / 0.60
x265 [info]: tools: rd=2 psy-rd=2.00 rskip signhide tmvp fast-intra
x265 [info]: tools: strong-intra-smoothing lslices=6 deblock sao
[04:35:15] sync: first pts video is 0
[04:35:15] sync: first pts audio 0x1 is 22614
[04:35:15] sync: first pts audio 0x2 is 22614
[04:35:55] sync: first pts subtitle 0x3 is 1054854
[05:22:20] sync: first pts subtitle 0x4 is 49583304
[05:22:32] sync: "Chapter 4" (4) at frame 13210 time 49583283
[05:29:39] sync: reached video frame 15364, exiting early
[05:29:39] sync: reached audio 0x1 pts 57822864, exiting early
[05:29:39] sync: reached audio 0x2 pts 57822864, exiting early
[05:29:45] reader: done. 1 scr changes
[05:29:58] work: average encoding speed for job is 4.702342 fps
[05:29:58] comb detect: heavy 86 | light 540 | uncombed 14738 | total 15364
[05:29:58] decomb: deinterlaced 86 | blended 540 | unfiltered 14738 | total 15364
[05:29:58] vfr: lost time: 0 (0 frames)
[05:29:58] vfr: gained time: 0 (0 frames) (0 not accounted for)
[05:29:58] truehd-decoder done: 1778427 frames, 0 decoder errors
[05:29:58] truehd-decoder done: 1778427 frames, 0 decoder errors
[05:29:58] h264-decoder done: 35533 frames, 0 decoder errors
[05:29:58] sync: got 15364 frames, 15364 expected
[05:29:58] sync: framerate min 23.981 fps, max 23.981 fps, avg 23.976 fps
x265 [info]: frame I: 190, Avg QP:15.20 kb/s: 9664.73
x265 [info]: frame P: 3110, Avg QP:15.93 kb/s: 4790.19
x265 [info]: frame B: 12064, Avg QP:21.46 kb/s: 1275.51
x265 [info]: Weighted P-Frames: Y:8.0% UV:5.6%
x265 [info]: consecutive B-frames: 6.8% 1.1% 1.4% 1.4% 89.4%
encoded 15364 frames in 3434.77s (4.47 fps), 2090.70 kb/s, Avg QP:20.26
[05:29:58] mux: track 0, 15364 frames, 167528692 bytes, 2085.77 kbps, fifo 1024
[05:29:58] mux: track 1, 770670 frames, 63330246 bytes, 788.48 kbps, fifo 65536
[05:29:58] mux: track 2, 770670 frames, 67337736 bytes, 838.37 kbps, fifo 65536
[05:29:58] mux: track 3, 261 frames, 2697452 bytes, 33.58 kbps, fifo 64
[05:29:58] mux: track 4, 30 frames, 369751 bytes, 4.60 kbps, fifo 16
[05:29:58] libhb: work result = 0
# Encode Completed ...
[code][/i]