RenderHeads / UnityPlugin-AVProVideo

AVPro Video is a multi-platform Unity plugin for advanced video playback
https://www.renderheads.com/products/avpro-video/
239 stars 29 forks source link

Switching audio tracks in causes a hard crash in Media Foundation when the Use Hap/NotchLC option is enabled in the Trial/Ultra Edition #752

Closed AndrewRH closed 2 months ago

AndrewRH commented 3 years ago

In Windows, AVPro Video 2.1.0, Unity 5.6.5:

using the 2 track media amaze_aac_aac.mp4 and switching tracks using Media Foundation causes a crash.. This may be down to the custom Hap filter.

Media info:

General Complete name : C:\Users\Andrew\Downloads\Browser\amaze_aac_aac.mp4 Format : MPEG-4 Format profile : Base Media / Version 2 Codec ID : mp42 (mp42/isom) File size : 102 MiB Duration : 6 min 50 s Overall bit rate mode : Variable Overall bit rate : 2 078 kb/s Encoded date : UTC 2021-04-23 15:21:35 Tagged date : UTC 2021-04-23 15:21:35

Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : Baseline@L4 Format settings, CABAC : No Format settings, RefFrames : 1 frame Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 1 min 3 s Bit rate mode : Variable Bit rate : 11.2 Mb/s Maximum bit rate : 20.0 Mb/s Width : 1 920 pixels Height : 1 080 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 24.000 FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.225 Stream size : 84.7 MiB (83%) Default : Yes Alternate group : 1 Encoded date : UTC 2021-04-23 15:21:35 Tagged date : UTC 2021-04-23 15:21:35 Color range : Limited Color primaries : BT.709 Transfer characteristics : BT.709 Matrix coefficients : BT.709

Audio #1 ID : 2 Format : AAC Format/Info : Advanced Audio Codec Format profile : HE-AAC / LC Codec ID : 40 Duration : 1 min 0 s Bit rate mode : Variable Bit rate : 62.7 kb/s Maximum bit rate : 66.4 kb/s Channel(s) : 2 channels Channel positions : Front: L R Sampling rate : 48.0 kHz / 24.0 kHz Frame rate : 23.438 FPS (1024 SPF) Compression mode : Lossy Stream size : 460 KiB (0%) Default : Yes Alternate group : 2 Encoded date : UTC 2021-04-23 15:21:35 Tagged date : UTC 2021-04-23 15:21:35

Audio #2 ID : 3 Format : AAC Format/Info : Advanced Audio Codec Format profile : LC Codec ID : 40 Duration : 6 min 50 s Bit rate mode : Variable Bit rate : 336 kb/s Maximum bit rate : 496 kb/s Channel(s) : 2 channels Channel positions : Front: L R Sampling rate : 48.0 kHz Frame rate : 46.875 FPS (1024 SPF) Compression mode : Lossy Stream size : 16.5 MiB (16%) Default : No Alternate group : 2 Encoded date : UTC 2021-04-23 15:21:35 Tagged date : UTC 2021-04-23 15:21:35

AndrewRH commented 3 years ago

Confirmed - the crash is related to the Hap MFT being ASYNC - without ASYNC it doesn't crash, but it does seem to have a video buffering issue.

This all seems down to the MFT not properly supporting Format Change.

See: https://docs.microsoft.com/en-us/windows/win32/medfound/handling-stream-changes#implementing-format-changes

AndrewRH commented 3 years ago

It doesn't seem to be crashign any more since 2.1.8, but the audio doesn't switch when using the Hap MFT

A workaround is to disable the "Use Hap/NotchLC" option:

image

Ste-RH commented 2 months ago

Closing due to age of issue.