HandBrake / HandBrake

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

commit 8fef64a breaks scanning a file #5751

Closed taxen closed 8 months ago

taxen commented 8 months ago

Problem Description

Commit 8fef64a in my environment breaks scanning a file by either D&D or Open file video menu. I use Visual Studio Community 2022 Version 17.8.6 VisualStudio.17.Release/17.8.6+34525.116 .NET Framework Version 4.8.09037 Also cross compiled on Ubuntu 22.04.3 LTS box VM for hb.dll.

I checked some of neighboring commits (d24b616, 1b0ccd8, 8fef64a, and 7b12732) and identified the cause as such. Up to 1b0ccd8, HB works fine. After 8fef64a up to 1cc363a as far as I tested, HB hangs and exits soon after it starts scanning a file. Below are my extended logs of both successful one by 1b0ccd8 and failed one by 8fef64a, respectively.

Activity Log, Crash Log or any other details

HandBrake Nightly 20231224075759-1b0ccd8b9 (2024020801)
OS: Microsoft Windows NT 10.0.19045.0
CPU: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
Ram: 12159 MB, 
GPU Information:
  Intel(R) HD Graphics 520 - 31.0.101.2111
Screen: 1536x864
Temp Dir: C:\Users\user\AppData\Local\Temp\
Install Dir: C:\Program Files\HandBrake Nightly-1b0ccd8\
Data Dir: C:\Users\user\AppData\Roaming\HandBrake\Nightly

-------------------------------------------
[20:29:23] hb_init: starting libhb thread
[20:29:23] thread 2 started ("libhb")

 # Starting Scan ...

[20:29:23] CPU: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
[20:29:23]  - Intel microarchitecture Skylake
[20:29:23]  - logical processor count: 4
[20:29:23] hb_scan: path=G:\test.mkv, title_index=0
[20:29:23] thread 3 started ("scan")
Input #0, matroska,webm, from 'G:\test.mkv':
  Metadata:
    ENCODER         : Lavf60.3.100
  Duration: 00:00:58.16, start: 0.084000, bitrate: 2482 kb/s
  Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1280x640 [SAR 1:1 DAR 2:1], 23.98 fps, 23.98 tbr, 1k tbn
    Metadata:
      DURATION        : 00:00:58.142000000
  Stream #0:1(eng): Audio: eac3 (Dolby Digital Plus + Dolby Atmos), 48000 Hz, 5.1(side), fltp, 640 kb/s
    Metadata:
      DURATION        : 00:00:58.164000000
[20:29:23] Found ffmpeg 0 chapters, container=matroska,webm
[20:29:23] scan: decoding previews for title 1
[20:29:23] scan: preview 1
[20:29:23] fifo_close: trashing 0 buffer(s)
[20:29:23] scan: audio 0x1: eac3, rate=48000Hz, bitrate=640000 English (E-AC3 Dolby Digital Plus + Dolby Atmos, 5.1 ch, 640 kbps)
[20:29:23] Interlacing detected in preview frame 1
[20:29:23] scan: preview 2
[20:29:23] scan: preview 3
[20:29:23] scan: preview 4
[20:29:23] scan: preview 5
[20:29:23] scan: preview 6
[20:29:23] scan: preview 7
[20:29:24] scan: preview 8
[20:29:24] scan: preview 9
[20:29:24] scan: preview 10
[20:29:24] scan: preview 11
[20:29:24] scan: preview 12
[20:29:24] scan: preview 13
[20:29:24] scan: preview 14
[20:29:24] scan: preview 15
[20:29:24] scan: preview 16
[20:29:24] scan: preview 17
[20:29:24] scan: preview 18
[20:29:24] scan: preview 19
[20:29:24] scan: preview 20
[20:29:24] scan: preview 21
[20:29:24] scan: preview 22
[20:29:24] scan: preview 23
[20:29:24] scan: preview 24
[20:29:24] scan: preview 25
[20:29:24] scan: preview 26
[20:29:24] scan: preview 27
[20:29:24] scan: preview 28
[20:29:24] scan: preview 29
[20:29:24] scan: preview 30
[20:29:24] scan: preview 31
[20:29:24] scan: preview 32
[20:29:24] scan: preview 33
[20:29:25] scan: preview 34
[20:29:25] scan: preview 35
[20:29:25] scan: preview 36
[20:29:25] scan: preview 37
[20:29:25] scan: preview 38
[20:29:25] scan: preview 39
[20:29:25] scan: preview 40
[20:29:25] scan: preview 41
[20:29:25] scan: preview 42
[20:29:25] scan: preview 43
[20:29:25] scan: preview 44
[20:29:25] scan: preview 45
[20:29:25] scan: preview 46
[20:29:25] scan: preview 47
[20:29:25] scan: preview 48
[20:29:25] scan: preview 49
[20:29:25] scan: preview 50
[20:29:25] scan: preview 51
[20:29:25] scan: preview 52
[20:29:25] scan: preview 53
[20:29:25] scan: preview 54
[20:29:25] scan: preview 55
[20:29:25] scan: preview 56
[20:29:25] scan: preview 57
[20:29:25] scan: preview 58
[20:29:25] scan: preview 59
[20:29:25] scan: preview 60
[20:29:25] using container PAR 1:1
[20:29:25] crop: [0] 0/0/0/0
[20:29:25] crop: [1] 0/0/0/0
[20:29:25] crop: [2] 0/0/0/0
[20:29:25] crop: [3] 0/0/0/0
[20:29:25] crop: [4] 0/0/0/0
[20:29:25] crop: [5] 0/0/14/0
[20:29:25] crop: [6] 0/0/14/0
[20:29:25] crop: [7] 0/0/16/0
[20:29:25] crop: [8] 0/0/16/0
[20:29:25] crop: [9] 0/0/16/0
[20:29:25] crop: [10] 0/0/39/0
[20:29:25] crop: [11] 0/0/39/0
[20:29:25] crop: [12] 0/0/54/0
[20:29:25] crop: [13] 0/0/54/0
[20:29:25] crop: [14] 0/0/58/0
[20:29:25] crop: [15] 0/0/58/0
[20:29:25] crop: [16] 0/0/65/0
[20:29:25] crop: [17] 0/0/65/0
[20:29:25] crop: [18] 0/0/74/0
[20:29:25] crop: [19] 0/0/74/0
[20:29:25] crop: [20] 0/0/82/0
[20:29:25] crop: [21] 0/0/82/0
[20:29:25] crop: [22] 0/0/84/0
[20:29:25] crop: [23] 0/0/84/0
[20:29:25] crop: [24] 0/0/88/0
[20:29:25] crop: [25] 0/0/88/1
[20:29:25] crop: [26] 0/0/88/1
[20:29:25] crop: [27] 0/0/97/9
[20:29:25] crop: [28] 1/0/97/9
[20:29:25] crop: [29] 1/0/110/11
[20:29:25] crop: [30] 4/0/110/11
[20:29:25] crop: [31] 4/0/121/13
[20:29:25] crop: [32] 8/0/121/13
[20:29:25] crop: [33] 8/0/133/26
[20:29:25] crop: [34] 23/0/133/26
[20:29:25] crop: [35] 23/0/140/29
[20:29:25] crop: [36] 47/0/140/29
[20:29:25] crop: [37] 47/0/155/53
[20:29:25] crop: [38] 51/0/155/53
[20:29:25] crop: [39] 51/0/190/54
[20:29:25] crop: [40] 61/0/190/54
[20:29:25] crop: [41] 61/0/209/55
[20:29:25] crop: [42] 94/24/209/55
[20:29:25] crop: [43] 110/24/226/106
[20:29:25] crop: [44] 110/90/226/106
[20:29:25] crop: less_than_median_frame_count: 20,
[20:29:25] crop: switching to loose crop for this source. May be mixed aspect ratio. (8)
[20:29:25] scan: 60 previews, 1280x640, 23.976 fps, autocrop = 0/0/0/0, aspect 2.00:1, PAR 1:1, color profile: 1-1-1, chroma location: left
[20:29:25] Freed 1 buffers of size 1024
[20:29:25] Freed 1 buffers of size 2048
[20:29:25] Freed 1 buffers of size 4096
[20:29:25] Freed 1 buffers of size 8192
[20:29:25] Freed 1 buffers of size 16384
[20:29:25] Freed 1 buffers of size 32768
[20:29:25] Freed 1 buffers of size 65536
[20:29:25] Freed 1 buffers of size 131072
[20:29:25] Allocated 261120 bytes of buffers on this pass and Freed 261120 bytes, 0 bytes leaked
[20:29:25] thread 3 exited ("scan")
[20:29:25] thread 3 joined ("scan")
[20:29:25] libhb: scan thread found 1 valid title(s)

 # Scan Finished ...

[20:29:26] thread 4 started ("yadif_filter_segment")
[20:29:26] thread 5 started ("yadif_filter_segment")
[20:29:26] thread 6 started ("yadif_filter_segment")
[20:29:26] thread 7 started ("yadif_filter_segment")
[20:29:26] thread 4 exited ("yadif_filter_segment")
[20:29:26] thread 5 exited ("yadif_filter_segment")
[20:29:26] thread 6 exited ("yadif_filter_segment")
[20:29:26] thread 7 exited ("yadif_filter_segment")
[20:29:26] thread 4 joined ("yadif_filter_segment")
[20:29:26] thread 5 joined ("yadif_filter_segment")
[20:29:26] thread 6 joined ("yadif_filter_segment")
[20:29:26] thread 7 joined ("yadif_filter_segment")
[20:29:26] fifo_close: trashing 0 buffer(s)
[20:29:26] fifo_close: trashing 0 buffer(s)
[20:29:26] fifo_close: trashing 1 buffer(s)

---------------------------------------------------------------------

HandBrake Nightly 20231226193954-8fef64a5c (2024020801)
OS: Microsoft Windows NT 10.0.19045.0
CPU: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
Ram: 12159 MB, 
GPU Information:
  Intel(R) HD Graphics 520 - 31.0.101.2111
Screen: 1536x864
Temp Dir: C:\Users\user\AppData\Local\Temp\
Install Dir: C:\Program Files\HandBrake Nightly-8fef64a\
Data Dir: C:\Users\user\AppData\Roaming\HandBrake\Nightly

-------------------------------------------
[20:30:47] hb_init: starting libhb thread
[20:30:47] thread 2 started ("libhb")

 # Starting Scan ...

[20:30:48] CPU: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
[20:30:48]  - Intel microarchitecture Skylake
[20:30:48]  - logical processor count: 4
[20:30:48] hb_scan: path=G:\test.mkv, title_index=0
[20:30:48] thread 3 started ("scan")
Input #0, matroska,webm, from 'G:\test.mkv':
  Metadata:
    ENCODER         : Lavf60.3.100
  Duration: 00:00:58.16, start: 0.084000, bitrate: 2482 kb/s
  Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1280x640 [SAR 1:1 DAR 2:1], 23.98 fps, 23.98 tbr, 1k tbn
    Metadata:
      DURATION        : 00:00:58.142000000
  Stream #0:1(eng): Audio: eac3 (Dolby Digital Plus + Dolby Atmos), 48000 Hz, 5.1(side), fltp, 640 kb/s
    Metadata:
      DURATION        : 00:00:58.164000000
[20:30:50] Found ffmpeg 0 chapters, container=matroska,webm
[20:30:50] scan: decoding previews for title 1
[20:30:50] scan: preview 1
[20:30:50] fifo_close: trashing 0 buffer(s)
[20:30:50] scan: audio 0x1: eac3, rate=48000Hz, bitrate=640000 English (E-AC3 Dolby Digital Plus + Dolby Atmos, 5.1 ch, 640 kbps)
[20:30:50] Interlacing detected in preview frame 1

What Operating System are you running?

Windows 10 Home 22H2

What version of HandBrake are you running?

Nightly 8fef64a5c

Where did you download HandBrake from?

github

sr55 commented 8 months ago

The commit you reference has absolutely nothing to do with Scanning so I'm afraid your analysis there is incorrect. It's not even within libhb.

Are you able to share a sample file that reproduces the issue?

taxen commented 8 months ago

I may be wrong, but my experiments above and just now confirm that the commit has something to do with because just before the commit, build 1b0ccd8 works fine and with the commit, build 8fef64a fails to load a file.

Sure, I can provide the file, but due to copyright issue, I will provide a different one. So far as I have tested, any file causes the issue. Here is what I also tested: http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4 The result is the same. 1b0ccd8 succeeds and 8fef64a fails.

When fails, the HB window crashes right after the progress goes around 2% without showing any error. image

Here is how I identified the commit causing the trouble. I used a nightly build of my own made around last August. I recently made a big bump to Feb commit and faced the trouble. In between, there are some builds which work fine and some other which do not. By narrowing the range, I finally track it down to 1b0ccd8 and 8fef64a. image

Regards,

taxen commented 8 months ago

Precisely speaking, I have only narrowed the cause down to anything between https://github.com/HandBrake/HandBrake/commit/1b0ccd8b94a7230749099a1b04d12f72421582a7 and https://github.com/HandBrake/HandBrake/commit/8fef64a5cd147c970681f39f2091e372bdf9f4cd. I thought only WinGui change was to be blamed, but it may not. I will have to check if any of the commits (419d224, f0773d9, and d1a98ab) before 8fef64a starts to break the scanning. Please give me some more time to figure it out.

galad87 commented 8 months ago

Does a snapshot from https://github.com/HandBrake/HandBrake-snapshots work? If so, maybe there is something stale in your build.

taxen commented 8 months ago

The snapshot of HandBrake-20240208-4a22c60f6-x86_64-Win_GUI.zip (Release contents overwritten by those in HandBrake) works fine on me. Compared with this build, my builds both good and bad have two extra files, which are Ookii.Dialogs.Wpf.dll and System.CodeDom.dll. I am not sure why these files are made. I always clean an old build before building a new one. I even hard delete the files under HandBrake\win\CS\HandBrakeWPF\bin directory to make sure. Also, I deleted all the files under Windows build folder (HandBrake) on 6th Feb to make sure the local files are up to date and clean.