Search Unity

  1. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice
  2. We're running great holiday deals on subscriptions, swag and Asset Store packages! Take a peek at this blog for more information!
    Dismiss Notice
  3. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  4. Unity 2017.2 is now released.
    Dismiss Notice
  5. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  6. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  8. Unity 2017.3 beta is now available for download.
    Dismiss Notice

Video Creating a thumbnail for an MP4 video on device?

Discussion in 'Audio & Video' started by JoWi_Uniform, Nov 14, 2017.

  1. JoWi_Uniform

    JoWi_Uniform

    Joined:
    Jul 14, 2017
    Posts:
    2
    Hi, i'm currently trying to get around some issues using the native camera primarily with IOS

    What I want to happen
    I have an app that allows you to record a video, which then saves to camera roll and is moved to the persistent data path.
    What I want to do is to create a thumbnail for each video, rather than load the entire video and hold it paused on the first frame.

    What i'm currently doing
    My attempts to do this so far haven't worked well:
    Firstly it seems that you have to load the entire video in to be able to create a thumbnail, i'm hoping there's some way around this?
    Secondly i'm using a video player that loads a URL, then when the video is prepared and paused on the first frame a Texture2D is created which then uses .ReadPixels() to grab the first frame of the video.

    The problems i'm having
    The problem i'm having is that I seem to be unable to grab an image of the current video, but can reliably grab an image of the previous video.
    I'm not sure why this is happening as everything seems to be in the right order script-wise.
    I've also tried adding a delay to make sure the pixels are actually read before saving but nothing seems to work.

    Extra Info
    Any suggestions or ideas at this point are welcome, i'm using the "CameraShot" asset for the native camera if that helps:
    https://www.assetstore.unity3d.com/en/#!/content/19682

    Another issue i'm having right now is that video recorded in Landscape mode loads into the video player correctly but any video taken in Portrait mode loads in incorrectly (seems to only show 1 pixel of the full video) even though both videos work fully as individual MP4/MOV files outside of the App.

    Cheers,
    Joe.