UnityPlugin-AVProVideo icon indicating copy to clipboard operation
UnityPlugin-AVProVideo copied to clipboard

Video encoded with 4:2:2 chroma subsampling doesn't load and then freezes application every time I try to CloseMedia()

Open benwager opened this issue 3 years ago • 7 comments

Describe the issue I have a video which doesn't load and then freezes the application every time try to close it. I get a ReadyToPlayEvent, a MetaDataReadyEvent and then a ResolutionChanged event and then it gets no further.

The application doesn't actually freeze until I try to CloseMedia() or destroy the GameObject.

Your Setup (please complete the following information):

  • Unity version: 2020.1.16f1
  • AVPro Video version: 2.1.5 Ultra Edition
  • Operating system version: Win 10
  • Device model:
  • Video specs (resolution, frame-rate, codec, file size):

`General Complete name : C:\Users...\testvid.mp4 Format : MPEG-4 Format profile : Base Media Codec ID : isom (isom/iso2/avc1/mp41) File size : 12.9 MiB Duration : 7 s 8 ms Overall bit rate : 15.5 Mb/s Writing application : Lavf57.83.100

Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High 4:2:[email protected] Format settings : CABAC / 4 Ref Frames Format settings, CABAC : Yes Format settings, Reference frames : 4 frames Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 7 s 8 ms Bit rate : 15.5 Mb/s Width : 3 840 pixels Height : 2 160 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 29.970 (29970/1000) FPS Color space : YUV Chroma subsampling : 4:2:2 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.062 Stream size : 12.9 MiB (100%) Writing library : x264 core 152 r19 ba24899 Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=36 / lookahead_threads=6 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=30.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00 Language : English Codec configuration box : avcC

Other ID : 2 Type : Time code Format : QuickTime TC Duration : 7 s 8 ms Frame rate : 29.970 (29970/1000) FPS Time code of first frame : 00:00:00:00 Time code, striped : Yes Language : English Default : No `

benwager avatar Jun 22 '21 12:06 benwager

Hey @benwager

Do you think you could send a copy of your video to [email protected] with the subject line #829 for testing?

Thanks

kahnivore avatar Jun 22 '21 14:06 kahnivore

Yes, I have just sent it. Thanks

benwager avatar Jun 22 '21 14:06 benwager

Hi @benwager

Seems like a hardware/media issue. Reproduced the freeze not only when trying to close the media, but even just trying to play it. Re-encoded with a chroma subsampling profile of 4:2:0 (from 4:2:2) and that fixed it. Obviously the freeze is less than ideal so will look into this further, but wanted to provide a fix in the meantime.

kahnivore avatar Jun 23 '21 15:06 kahnivore

I think we have an issue on this already - basically h.264 videos with certain specs (like 4:2:2 or 4:4:4) cause this behaviour of not displaying, and then freezing on closing.

AndrewRH avatar Jun 24 '21 02:06 AndrewRH

Yeah it's #759 - it just doesn't mention 4:2:2, only 4:4:4. Summary of the issue here.

kahnivore avatar Jun 24 '21 07:06 kahnivore

Is there some programmatic means of preventing the crash in the mean time, while you work on a long term solution?

benwager avatar Jun 25 '21 10:06 benwager

We don't currently have a way to prevent the crash. Unfortunately the crash is a result of a bug in the Media Foundation/H.264 decoder which we can't do anything about. To prevent a crash you'd need to implement a way to pre-process the files to check if they are this format and avoid playing them if they are. We are planning to implement a way to do this in the future (i.e. to easily retrieve this type of info), but in the meantime you could use something like Media Info's API to do this.

kahnivore avatar Jun 30 '21 12:06 kahnivore