Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Video Player texture gets squished in the middle

Discussion in 'Audio & Video' started by GeorgeMincila, Nov 17, 2021.

  1. GeorgeMincila

    GeorgeMincila

    Joined:
    Feb 28, 2016
    Posts:
    36
    I have a video that is recorded using screen recording on my iPhone 11 Pro. The video is resolution is 498 x 1080. So these are the values I used for the Render Texture size.

    The Raw Image is set to full screen, canvas resolution is the same as an iPhone 11 Pro, so 1125 x 2436.
    The video Player Aspect Ratio is either Fit Horizontally, Fit Inside and the result looks totally strange:
    the video is squished in the center of the screen, as you can see in the attached screnshots.

    Any idea why this bug is happening? Any trick to get over it and preserve the video aspect ratio?
     

    Attached Files:

  2. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    260
    Hi!

    Since the video has been shot in portrait orientation, this could be because the VideoPlayer and the VideoClip importer don't support (not very well anyways) videos that have a rotation that is set through metadata. Typically mobile devices store the data in landscape layout, but add the 90 degrees rotation through metadata. This is something we'll try to improve in the long term.

    You could try to remove this metadata before importing unity using ffmpeg:

    ffmpeg -i input.mp4 -c copy -metadata:s:v:0 rotate=0 output.mp4

    If this is indeed the issue, then the video will be imported without the 90 degrees rotation, which you can compensate for by rotating the objects in the scene.

    Let me know if this was the issue; if it wasn't, then we can keep digging together.

    Dominique Leroux
    A/V developer at Unity.
     
    geoinnovacion likes this.