HandBrake / HandBrake

HandBrake's main development repository
https://handbrake.fr
Other
17.23k stars 1.32k forks source link

The last caption in a track is still getting removed #4641

Open El-Has opened 1 year ago

El-Has commented 1 year ago

Problem Description

Embedding SRT subtitles used to mean the last caption from the file would be erroneously removed upon embedding. I remember reporting this already, but cannot find the old issue. I also thought the nightly builds from months ago had fixed it, but the issue is back in Version 20221005173115-d026bcf17-master (2022101001) on Mac. I've attached a log file from when this happened in every single language. Once when this happened, I managed to restore it by re-encoding the video with no changes, but usually nothing helps.

Activity Log, Crash Log or any other details

HandBrake Activity Log for Session: 2022-10-31T08:46:34Z
Handbrake Version: 20221005173115-d026bcf17-master (2022101001)
WTWID 8 Medicine Being Affordable [OD3].mp4
Preset: Fast 1080p30 (Modified)
[08:46:34] macgui: fr.handbrake.HandBrakeXPCService scanning specifically for title: 1
[08:46:34] CPU: Intel(R) Core(TM) i5-4260U CPU @ 1.40GHz
[08:46:34]  - Intel microarchitecture Haswell
[08:46:34]  - logical processor count: 4
[08:46:34] hb_scan: path=/Volumes/TOSHIBA EXT/Videos/Complete/The Problem/What the WEF is Doing/WTWID 8 Medicine Being Affordable.m4v, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
disc.c:333: failed opening UDF image /Volumes/TOSHIBA EXT/Videos/Complete/The Problem/What the WEF is Doing/WTWID 8 Medicine Being Affordable.m4v
disc.c:437: error opening file BDMV/index.bdmv
disc.c:437: error opening file BDMV/BACKUP/index.bdmv
[08:46:34] bd: not a bd - trying as a stream/file instead
libdvdread: DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdnav: vm: vm: failed to read VIDEO_TS.IFO
[08:46:34] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/TOSHIBA EXT/Videos/Complete/The Problem/What the WEF is Doing/WTWID 8 Medicine Being Affordable.m4v':
  Metadata:
    major_brand     : M4V 
    minor_version   : 1
    compatible_brands: M4V M4A isommp42
    creation_time   : 2022-07-18T08:47:22.000000Z
    title           : WTWID 8: Medicine Being Affordable
    keywords        : The Problem
    artist          : El Has
  Duration: 00:00:59.84, start: 0.000000, bitrate: 7683 kb/s
  Stream #0:0[0x1](eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 124 kb/s (default)
    Metadata:
      creation_time   : 2022-07-18T08:47:22.000000Z
      handler_name    : Core Media Audio
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1080x1080 [SAR 1:1 DAR 1:1], 7541 kb/s, 25 fps, 25 tbr, 25k tbn (default)
    Metadata:
      creation_time   : 2022-07-18T08:47:23.000000Z
      handler_name    : Core Media Video
      vendor_id       : [0][0][0][0]
  Stream #0:2[0x0]: Video: mjpeg (Progressive), yuvj420p(pc, bt470bg/unknown/unknown), 1080x1080 [SAR 72:72 DAR 1:1], 90k tbr, 90k tbn (attached pic)
[08:46:34] scan: decoding previews for title 1
[08:46:34] scan: audio 0x0: aac, rate=44100Hz, bitrate=124687 English (AAC LC) (2.0 ch) (124 kbps)
[08:46:34] scan: 10 previews, 1080x1080, 25.000 fps, autocrop = 0/0/0/0, aspect 1.00:1, PAR 1:1, color profile: 1-1-1, chroma location: left
[08:46:34] libhb: scan thread found 1 valid title(s)
[08:46:34] macgui: fr.handbrake.HandBrakeXPCService scan done
[08:46:34] Starting work at: Mon Oct 31 08:46:34 2022

[08:46:34] macgui: fr.handbrake.HandBrakeXPCService started encoding WTWID 8 Medicine Being Affordable [OD3].mp4
[08:46:34] 1 job(s) to process
[08:46:34] macgui: fr.handbrake.HandBrakeXPCService with preset Fast 1080p30 (Modified)
[08:46:34] Starting Task: Encoding Pass
[08:46:34] Skipping crop/scale filter
[08:46:34] job configuration:
[08:46:34]  * source
[08:46:34]    + /Volumes/TOSHIBA EXT/Videos/Complete/The Problem/What the WEF is Doing/WTWID 8 Medicine Being Affordable.m4v
[08:46:34]    + title 1, chapter(s) 1 to 1
[08:46:34]    + container: mov,mp4,m4a,3gp,3g2,mj2
[08:46:34]    + data rate: 7683 kbps
[08:46:34]  * destination
[08:46:34]    + /Volumes/TOSHIBA EXT/Videos/Complete/The Problem/What the WEF is Doing/WTWID 8 Medicine Being Affordable [OD3].mp4
[08:46:34]    + container: MPEG-4 (libavformat)
[08:46:34]      + optimized for HTTP streaming (fast start)
[08:46:34]      + compatibility atom for iPod 5G
[08:46:34]      + align initial A/V stream timestamps
[08:46:34]  * video track
[08:46:34]    + decoder: h264 8-bit (yuv420p)
[08:46:34]      + bitrate 7541 kbps
[08:46:34]    + filter
[08:46:34]      + Framerate Shaper (mode=1:rate=27000000/1080000)
[08:46:34]        + frame rate: 25.000 fps -> constant 25.000 fps
[08:46:34]    + Output geometry
[08:46:34]      + storage dimensions: 1080 x 1080
[08:46:34]      + pixel aspect ratio: 1 : 1
[08:46:34]      + display dimensions: 1080 x 1080
[08:46:34]    + encoder: H.264 (libx264)
[08:46:34]      + preset:  faster
[08:46:34]      + tune:    fastdecode
[08:46:34]      + profile: main
[08:46:34]      + level:   4.0
[08:46:34]      + bitrate: 1000 kbps, pass: 0
[08:46:34]      + color profile: 1-1-1
[08:46:34]      + chroma location: left
[08:46:34]  * subtitle track 1, English [SRT] (track 0, id 0xff000000, Text) -> Passthrough, offset: 0, charset: UTF-8
[08:46:34]  * subtitle track 2, Nederlands [SRT] (track 0, id 0xff000100, Text) -> Passthrough, offset: 0, charset: UTF-8
[08:46:34]  * subtitle track 3, Francais [SRT] (track 0, id 0xff000200, Text) -> Passthrough, offset: 0, charset: UTF-8
[08:46:34]  * subtitle track 4, Deutsch [SRT] (track 0, id 0xff000300, Text) -> Passthrough, offset: 0, charset: UTF-8
[08:46:34]  * subtitle track 5, español [SRT] (track 0, id 0xff000400, Text) -> Passthrough, offset: 0, charset: UTF-8
[08:46:34]  * subtitle track 6, svenska [SRT] (track 0, id 0xff000500, Text) -> Passthrough, offset: 0, charset: UTF-8
[08:46:34]  * subtitle track 7, Türkçe [SRT] (track 0, id 0xff000600, Text) -> Passthrough, offset: 0, charset: UTF-8
[08:46:34]  * audio track 1
[08:46:34]    + decoder: English (AAC LC) (2.0 ch) (124 kbps) (track 1, id 0x0)
[08:46:34]      + bitrate: 124 kbps, samplerate: 44100 Hz
[08:46:34]    + AAC Passthru
[08:46:35] sync: expecting 1496 video frames
[08:46:35] encx264: encoding at average bitrate 1000
[08:46:35] encx264: unparsed options: level=4.0:ref=2:weightb=0:no-deblock=1:cabac=0:8x8dct=0:weightp=0:subme=4:mixed-refs=0:vbv-bufsize=25000:vbv-maxrate=20000:rc-lookahead=20
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 4.0, 4:2:0, 8-bit
[08:46:35] sync: first pts audio 0x0 is 0
[08:46:35] sync: first pts video is 130
[08:46:35] sync: Chapter 1 at frame 1 time 130
[08:46:35] sync: first pts subtitle 0xff000000 is 130
[08:46:35] sync: first pts subtitle 0xff000100 is 130
[08:46:35] sync: first pts subtitle 0xff000200 is 130
[08:46:35] sync: first pts subtitle 0xff000300 is 130
[08:46:35] sync: first pts subtitle 0xff000400 is 130
[08:46:35] sync: first pts subtitle 0xff000500 is 130
[08:46:35] sync: first pts subtitle 0xff000600 is 130
[08:47:11] reader: done. 1 scr changes
[08:47:13] work: average encoding speed for job is 39.508022 fps
[08:47:14] vfr: 1496 frames output, 0 dropped and 0 duped for CFR/PFR
[08:47:14] vfr: lost time: 0 (0 frames)
[08:47:14] vfr: gained time: 0 (0 frames) (0 not accounted for)
[08:47:14] aac-decoder done: 2578 frames, 0 decoder errors
[08:47:14] h264-decoder done: 1496 frames, 0 decoder errors
[08:47:14] sync: got 1496 frames, 1496 expected
[08:47:14] sync: framerate min 25.000 fps, max 25.000 fps, avg 25.000 fps
x264 [info]: frame I:24    Avg QP:19.01  size: 62984
x264 [info]: frame P:487   Avg QP:21.90  size:  8494
x264 [info]: frame B:985   Avg QP:22.58  size:  1933
x264 [info]: consecutive B-frames:  2.6% 28.2%  1.8% 67.4%
x264 [info]: mb I  I16..4: 52.9%  0.0% 47.1%
x264 [info]: mb P  I16..4:  7.8%  0.0%  2.0%  P16..4: 23.3%  5.9%  0.9%  0.0%  0.0%    skip:60.0%
x264 [info]: mb B  I16..4:  1.1%  0.0%  0.2%  B16..8:  9.8%  1.6%  0.1%  direct: 2.4%  skip:84.9%  L0:39.4% L1:51.6% BI: 9.0%
x264 [info]: final ratefactor: 24.93
x264 [info]: coded y,uvDC,uvAC intra: 29.7% 42.2% 4.4% inter: 2.6% 4.8% 0.0%
x264 [info]: i16 v,h,dc,p: 44% 20% 20% 16%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 16% 20%  8%  6%  6%  4%  7%  4%
x264 [info]: i8c dc,h,v,p: 58% 16% 22%  4%
x264 [info]: ref P L0: 73.4% 26.6%
x264 [info]: ref B L0: 84.4% 15.6%
x264 [info]: ref B L1: 96.7%  3.3%
x264 [info]: kb/s:1009.67
[08:47:14] mux: track 0, 1496 frames, 7551350 bytes, 1008.86 kbps, fifo 2048
[08:47:14] mux: track 1, 2578 frames, 933310 bytes, 124.69 kbps, fifo 4096
[08:47:14] mux: track 2, 17 frames, 1883 bytes, 0.25 kbps, fifo 32
[08:47:14] mux: track 3, 17 frames, 1927 bytes, 0.26 kbps, fifo 32
[08:47:14] mux: track 4, 17 frames, 2140 bytes, 0.29 kbps, fifo 32
[08:47:14] mux: track 5, 17 frames, 2021 bytes, 0.27 kbps, fifo 32
[08:47:14] mux: track 6, 17 frames, 2102 bytes, 0.28 kbps, fifo 32
[08:47:14] mux: track 7, 17 frames, 1942 bytes, 0.26 kbps, fifo 32
[08:47:14] mux: track 8, 17 frames, 1932 bytes, 0.26 kbps, fifo 32
[08:47:14] Finished work at: Mon Oct 31 08:47:14 2022

[08:47:14] libhb: work result = 0

What Operating System are you running?

macOS Catalina 10.15.7

What version of HandBrake are you running?

Version 20221005173115-d026bcf17-master (2022101001)

Where did you download HandBrake from?

GitHub handbrake-snapshots

galad87 commented 1 year ago

If I remember correctly this is an issue of the libavformat mp4 demuxer, it doesn't use the duration of each sample but it computes it using the timestamp of the next sample, there isn't any next for the last sample so it doesn't get a duration.

vobine commented 7 months ago

I just opened incident 5732 for similar symptoms. After some time chasing it with GDB, the root of 5732 seems to be in HandBrake, not upstream. I don't know if that applies here or not.