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

MovieTexture.duration does not work with OGV videos

Discussion in 'Developer Preview Archive' started by deram_scholzara, Feb 3, 2012.

  1. deram_scholzara

    deram_scholzara

    Joined:
    Aug 26, 2005
    Posts:
    1,043
    From here in the scripting reference:
    file:///Applications/Unity/Unity.app/Contents/Documentation/Documentation/ScriptReference/MovieTexture-duration.html

    MovieTexture.duration returns -1 instead of an accurate value for MovieTextures that are imported from ogv format.

    Furthermore, if you look at the imported audio clip contained in the imported video asset, you can see in the preview window that it has a duration of 0.

    This was not happening with the AVI files I was using previously.
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    it works correctly but you must call .Play() first, before the movie is fired up there is no duration as its header data is not loaded.

    For AVI it potentially worked cause the in-editor conversion (only ogg theora is supported at all by unity) potentially stored it along the conversion
     
  3. Wahooney

    Wahooney

    Joined:
    Mar 8, 2010
    Posts:
    281
    I'm having the same issue, my .ogv video plays fine and as a debug test I print the movieTexture.duration in my Update() and I just get a whole lot of -1's in my console. That is after converting using both Miro and Any Video Converter.

    Any suggestions?