CollapseLauncher / Collapse

An Advanced Launcher for miHoYo/HoYoverse Games
MIT License
1.41k stars 64 forks source link

[Bug]: Collapse cannot use .mp4 & .mkv video files as a custom background #572

Closed Cactism closed 2 months ago

Cactism commented 2 months ago

Affected Version

Collapse 1.81.5 Preview

Bug Behavior

Attempting to use .mp4 and .mkv video files (not sure about other formats) as a custom App Background will throw an error.

Expected Behavior

Collapse should be able to playback the aforementioned video file types without an error.

Steps to reproduce

  1. Get an .mp4 or .mkv video file
  2. Use the video file as a custom background in Collapse
  3. Error

Related Issues

No response

Screenshot(s)

Example (using a random music video in a .webm container with it's video/audio stream copied into an .mp4 and .mkv container):

https://github.com/user-attachments/assets/13e57187-7881-4c47-a185-2a8eaaaea3de

Error:

System.ArgumentNullException: ArgumentNull_Generic Arg_ParamName_Name, windowsruntimeStream
   at System.IO.WindowsRuntimeStreamExtensions.AsStreamInternal(Object, Int32, String, Boolean)
   at System.IO.WindowsRuntimeStreamExtensions.AsStream(IRandomAccessStream)
   at CollapseLauncher.Helper.Background.Loaders.MediaPlayerLoader.GetPreviewAsColorPalette(String file)
   at CollapseLauncher.Helper.Background.Loaders.MediaPlayerLoader.LoadAsync(String filePath, Boolean isImageLoadForFirstTime, Boolean isRequestInit, CancellationToken token)
   at CollapseLauncher.Helper.Background.Loaders.MediaPlayerLoader.LoadAsync(String filePath, Boolean isImageLoadForFirstTime, Boolean isRequestInit, CancellationToken token)
   at CollapseLauncher.Helper.Background.BackgroundMediaUtility.LoadBackgroundInner(String mediaPath, Boolean isRequestInit, Boolean isForceRecreateCache, ThrowExceptionAction throwAction, Action actionAfterLoaded)

Additional Information

.webm works oddly enough, as seen in the recording above.

Cactism commented 2 months ago

also I'm not quite sure if the acrylic effect using the video background is working at the end lol

bagusnl commented 2 months ago

Use MediaInfo to grab the information about the problematic video and the working one for you

Cactism commented 2 months ago

@bagusnl

Working videos: image image

Not working: image image

(the problematic videos are derived from the 1st working video)

Cactism commented 2 months ago

Here's some additional information: 1st working video:

General
Complete name                            : C:\Users\WDAGUtilityAccount\Desktop\Red Velvet 레드벨벳 'Psycho' MV [uR8Mrt1IpXg].webm
Format                                   : WebM
Format version                           : Version 4
File size                                : 62.7 MiB
Duration                                 : 3 min 35 s
Overall bit rate                         : 2 440 kb/s
Frame rate                               : 23.976 FPS
Writing application                      : Lavf61.3.103
Writing library                          : Lavf61.3.103

Video
ID                                       : 1
Format                                   : VP9
Format profile                           : 0
Codec ID                                 : V_VP9
Duration                                 : 3 min 35 s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 23.976 (23976/1000) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Title                                    : ISO Media file produced by Google Inc. Created on: 08/15/2024.
Default                                  : Yes
Forced                                   : No
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
VENDOR_ID                                : [0][0][0][0]

Audio
ID                                       : 2
Format                                   : Opus
Codec ID                                 : A_OPUS
Duration                                 : 3 min 35 s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Bit depth                                : 32 bits
Compression mode                         : Lossy
Delay relative to video                  : 7 ms
Language                                 : English
Default                                  : Yes
Forced                                   : No

1st problematic video:

General
Unique ID                                : 319458230763580042766486927623546101049 (0xF0556AD19B7C9C12F5676F4F20425D39)
Complete name                            : C:\Users\WDAGUtilityAccount\Desktop\a.mkv
Format                                   : Matroska
Format version                           : Version 4
File size                                : 62.7 MiB
Duration                                 : 3 min 35 s
Overall bit rate                         : 2 440 kb/s
Frame rate                               : 23.976 FPS
Writing application                      : Lavf61.3.103
Writing library                          : Lavf61.3.103
ErrorDetectionType                       : Per level 1

Video
ID                                       : 1
Format                                   : VP9
Format profile                           : 0
Codec ID                                 : V_VP9
Duration                                 : 3 min 35 s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 23.976 (23976/1000) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Title                                    : ISO Media file produced by Google Inc. Created on: 08/15/2024.
Default                                  : Yes
Forced                                   : No
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
VENDOR_ID                                : [0][0][0][0]

Audio
ID                                       : 2
Format                                   : Opus
Codec ID                                 : A_OPUS
Duration                                 : 3 min 35 s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Bit depth                                : 32 bits
Compression mode                         : Lossy
Delay relative to video                  : 7 ms
Language                                 : English
Default                                  : Yes
Forced                                   : No

2nd problematic video:

General
Complete name                            : C:\Users\WDAGUtilityAccount\Desktop\a.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/mp41)
File size                                : 62.7 MiB
Duration                                 : 3 min 35 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 2 441 kb/s
Frame rate                               : 23.976 FPS
Writing application                      : Lavf61.3.103

Video
ID                                       : 1
Format                                   : VP9
Codec ID                                 : vp09
Duration                                 : 3 min 35 s
Bit rate                                 : 2 310 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Frame rate                               : 23.976 FPS
Minimum frame rate                       : 23.256 FPS
Maximum frame rate                       : 24.390 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bits/(Pixel*Frame)                       : 0.046
Stream size                              : 59.4 MiB (95%)
Title                                    : ISO Media file produced by Google Inc. Created on: 08/15/2024.
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Audio
ID                                       : 2
Format                                   : Opus
Codec ID                                 : Opus
Duration                                 : 3 min 35 s
Duration_FirstFrame                      : 1 ms
Bit rate mode                            : Variable
Bit rate                                 : 126 kb/s
Sampling rate                            : 48.0 kHz
Compression mode                         : Lossy
Stream size                              : 3.24 MiB (5%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 1
bagusnl commented 2 months ago

Works fine on my end, with public version of .5 release and mp4/mkv container using av1/vp9/hevc codec.

If you're in EU/Korea (using N/KN edition of Windows), please follow this guide: https://codecguide.com/windows_media_codecs.htm

Additional guide if above still no work: https://codecguide.com/media_foundation_codecs.htm

Cactism commented 2 months ago

Works fine on my end, with public version of .5 release and mp4/mkv container using av1/vp9/hevc codec.

If you're in EU/Korea (using N/KN edition of Windows), please follow this guide: https://codecguide.com/windows_media_codecs.htm

Additional guide if above still no work: https://codecguide.com/media_foundation_codecs.htm

I already had the extensions installed and they work fine in VLC Media Player too :( image image

I also downloaded the portable version from GitHub to make sure my current installation wasn't bugged and no luck either :')

I'll share the problematic videos so you can test them yourself if you'd like: https://files.catbox.moe/j0zqm4.mkv https://files.catbox.moe/ijputl.mp4

bagusnl commented 2 months ago

VLC uses its own codec system. Try to open the files in Windows app like Photos/Movies

Cactism commented 2 months ago

VLC uses its own codec system. Try to open the files in Windows app like Photos/Movies

It works in the Photos app too MKV: image MP4: image

Cactism commented 2 months ago

I tried using the same .mkv and .mp4 files I uploaded above on another computer, and they worked oddly enough.

I don't know what's wrong with using them on this current computer though 🤔

I'll close this issue for now since it's not reproducible