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

[Released] AVPro Video - complete video playback solution

Discussion in 'Assets and Asset Store' started by AndrewRH, Feb 12, 2016.

  1. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi Paulo,

    We have replicated the bug and fixed it. The fix will be included in the next release of the plugin. Thanks once again for reporting this issue.
     
  2. sam598

    sam598

    Joined:
    Sep 21, 2014
    Posts:
    60
    Hard drive space quickly gets filled on OSX.

    It seems that whenever the video stops playing and the VideoEvent "FinishedPlaying" is called, the application takes up a portion of storage roughly equivalent to the size of the video file. If a large video file is used and played multiple times, this takes up gigabytes of space and causes the application to crash.

    No storage is taken up when the file is first played, and no storage is taken up when seeking or starting to play from the first frame multiple times. Tried on Windows 8.1 as well and it works fine.

    Only seems to be in OSX when the video reaches it's end.

    Hardware:

    Mac OSX 10.9.5, 2.3 GHz Intel Core i7, 16GB 1600 MHz DDR3, SSD

    Development Environment:

    Unity 5.3.4f1, OSX, AVPro Video 1.3.0

    Video details:

    1920x1080 H.264 30fps and 1920x1080 ProRes 422, 30fps
     
  3. yingwang

    yingwang

    Joined:
    May 8, 2016
    Posts:
    5
    Looking at the Demo_VideoControls scene, I notice there is a flicker after clicking the 'Next Video' button when transitioning to the new video. This is understandable as OpenVideoFromFile() is loading the next video asynchronously.

    Is there any way to play video files without the flicker? Perhaps even a workaround?
     
  4. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi Sam598.

    Thanks for the very detailed issue report! This is mighty strange. Video playback taking up disk space? We will of course look into this and get back to you. I can only imagine that for some reason Apple's ProRes decoder is expanding the file to some temporary location... Very strange. I presume that doesn't happen if you use a non ProRes video? If you could email us unitysupport@renderheads.com a copy of your test video that would really help. Also you mentioned that this doesn't happen on Windows - how were you playing a ProRes file on Windows? I didn't know it was supported..

    We will try to get this resolved ASAP. Please get back to us with answers to be above questions.

    Thanks,
     
  5. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes certainly. There is another sample scene called "imgui" that demonstrates how to get around this nicely. It can transition smoothly between multiple videos.

    Thanks,
     
  6. sam598

    sam598

    Joined:
    Sep 21, 2014
    Posts:
    60
    Thanks Andrew! It's actually both H264 and ProRes files. Playing around further it seems to happen when displaying video on a Unity GUI object (the newer GUI system). I'll send over a video and scene sample.

    The new plugin is fantastic by the way!
     
  7. phileday

    phileday

    Joined:
    Feb 8, 2014
    Posts:
    120
    Hi
    I'm using the Windows original version of this plugin in my player and I'm having reports from people that mkv files don't play back very well. Is there any information about this or any possible solutions? I'm not sure how to reply to these problems as I don't seem to be able to easily recreate them. Have you or anyone else experienced any similar issues?
     
  8. yingwang

    yingwang

    Joined:
    May 8, 2016
    Posts:
    5
    Thanks for the quick response, Andrew. I see the scene you pointed me to uses a black fade between video loads. If I deselect the 'Fade to Black During Loading' option the video transitions exhibit the flickering. I assume there is no way to load and play the new video immediately given that the video sources are located in the StreamingAssets folder? Essentially, I want to make it appear that the new video is a seamless continuation of the currently playing one.
     
  9. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes it's possible. You can have two MediaPlayer components and ping-pong between them. Use the inactive one for loading and once it has a frame you can switch to it and stop the playing MediaPlayer. So it's totally possible to do. We'll add component for this in the future so you can just drop them in :)

    Cheers,
     
  10. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi Philip,

    We don't use MKV files at all and haven't had any reports of them causing problems. I believe Windows 10 has native support for MKV but I have not tested it. Once we get the DirectShow fallback then at least 3rd party filters (such as Haali Splitter / LAV can be used).
     
  11. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Thanks sam598! Very weird that the disk space gets used.. Thanks for sending over the files, we'll take a look and get back you to.
     
  12. paulo.zaffari

    paulo.zaffari

    Joined:
    Jul 9, 2013
    Posts:
    3
    Cool. And when will the next release be?
     
  13. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    We don't have a release date for the next version yet and we have a lot of new features to get into the next version :) Within 4 weeks certainly! If you need it urgently please email me at unitysupport@renderheads.com and I can try to get you a beta version containing the bug-fix. Thanks,
     
  14. SingularDeviation

    SingularDeviation

    Joined:
    Mar 24, 2015
    Posts:
    2
    Hi,

    I use this plugin to stream videos hosted on the internet to an iPad. Unfortunately I have two issues while doing so. One of the issues that sometimes occurs is already meantioned by Tom Goethals ("When i have a progressive download stream it almost immediately starts playing it but then stops a few seconds in. sometimes after 3 seconds. sometimes after 30s. The wifi connection seems okay and the same codebase on android does not show this problem. It never resumes once it stops.") but from what I understand you already looked into this.

    Another issue I have is that the video sometimes shows a past or future frame (I think it's a future frame). When I set the video to loop, it always happens at the same frame. When restarting the application or video it does not happen at the exact same frames of the previous playback, but at random other frames. It looks like sometimes a few frames are downloaded/stored in the wrong order.
    It seems this only occurs with higher resolution/bitrate videos, (720p), I have not yet encountered this issue while using a low-res video.

    Please let me know if there is anything I can do to fix or work around these issues, or if it is possible to release an early fix (I don't think our client can wait 4 weeks).
     
    Last edited: May 10, 2016
  15. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi thanks for reporting these issues. We're looking into them at the moment and will hopefully have a fix very soon :) If we forget to contact you then do remind us. Thanks,
     
  16. lacucaracha

    lacucaracha

    Joined:
    May 11, 2016
    Posts:
    8
    Hello Andrew,
    I'm working with : Windows Media and QuickTime

    By the time i used those plugins, I had needs for my clients so i modified your plugin.
    For Windows, I don't want my user to install an external codec package with the player.
    Plus i wanted a full support of local files and url files/stream.

    My solution was to develop a new Dll using ffmpeg in order to replace your Dll in unity. So all the call avpro windows does in your Dll, i replaced them by my code compiled in a Dll too.
    So i just use your code in my apps for all the texture conversion, interface etc.. I change the codec part.

    I pretty much did the same for Mac, mostly for the performance and the streams part.

    I decode everything with ffmpeg, then i pass the texture to unity via pointer and opengl.
    So i have 2 plugins in my apps, both with modified dll code and calls in order to interact with your code.

    Is it worth it to use this new plugin ?
    What about the performance ?
    Can i decode and display streams ?

    i read your online documentation but it only said "support = yes" i need more info.
    Consider i have the same needs for windows and osx ! ( i dont use iPad, android etc..)

    I tried your demo unity package, but nothing worked. I can't see anything. Local files or Url.

    Thanks for your time.
     
  17. Tunkali

    Tunkali

    Joined:
    Feb 5, 2013
    Posts:
    54
    Is stereo 360 L/R supported for android / google cardboard / gear VR ?
     
  18. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi Tunkali,

    Yes it is. You can try it for yourself using the free trial version from our website.
    There is a 360 video player sample included and the material on the scene can be changed to stereo L/R setting in the inspector.

    Good luck!
     
  19. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi lacucaracha,

    It sounds like you're been having a lot of fun with DLL's ,great work!.

    Overall the performance of the new AVPro Video plugin is much better than the old plugins. This is partly due to better code design and also because it's based on newer OS media player libraries. In the old plugins we were using DirectShow and QuickTime which are deprecated technologies that haven't been updated in years. The new plugin is based on AVFoundation and Media Foundation which are much newer and have faster decoders.

    AVPro Video has some support for streaming video yes. Naturally though it won't be able to cover the huge format range that ffmpeg can. We try to keep away from ffmpeg due to legal reasons.

    I am VERY interested to know why the demo unity package didn't work. Please let me know which version of Unity you were using to test it with and what happened when you imported the UnityPackage. Were there any error messages or any fields in the inspector that were garbled? It is a high priority for us to make sure the trial demo version works well.

    Thanks,
     
  20. lacucaracha

    lacucaracha

    Joined:
    May 11, 2016
    Posts:
    8
    Re,

    We try to keep away from ffmpeg due to legal reasons.

    My application is available for free for everyone, correct me if i'm wrong but i won't have any problem with ffmpeg thus ?

    About the demo application, I retried the demo and still doesn't work BUT the demo is "UnityPlugin-AVProVideo-v1.1.0-Trial" which is not up to date ! (I imported the package, no error, still no video, even the bunny ones)

    So I looked at your assets page to be sure, the new link for the demo is "UnityPlugin-AVProVideo-v1.3.0-Trial".
    THIS ONE IS OK, works great !


    So i really dont remember from where but there is a link for a demo package that gave me this morning the oldest version of your demo ;)


    PS: This unity forum message verification is really horrible, i cant post a simple message without editing every single word... "spam"
     
  21. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Thanks! I found the link to the old broken version and have removed it now - awesome :)
     
  22. MornFall

    MornFall

    Joined:
    Jan 11, 2013
    Posts:
    160
    Hello Everyone,

    I have a quick question regarding a 360 VR exp i am making :
    I need to have the video play in reverse. the video is paused at the beginning, start playing when the user look at a specific spot, and plays in reverse when the user looks away.
    Is that possible ? If so, i did not see any "Reverse" public void in the media player component. Any pointers would be greatly appreciated :)
     
  23. nsc_creative

    nsc_creative

    Joined:
    Nov 3, 2015
    Posts:
    14
    I'm developing for Android GearVR and was wondering what you recommend regarding codec compression etc.

    The maximum quality will be 4kx4k 60fps.

    We use ffmpeg for conversion on most files so I am well versed in using this command line tool to create the videos. I've created mp4 with h265 but I seem to loss audio sync. I've actually had problems with h264 which I'm currently trying to work out.

    Any help would be appreciated. If you've documented it and I've missed it please let me know.

    All the best

    Phil
     
  24. Tom-Goethals

    Tom-Goethals

    Joined:
    Mar 6, 2015
    Posts:
    102
  25. nsc_creative

    nsc_creative

    Joined:
    Nov 3, 2015
    Posts:
    14
    Thanks Tom this is very useful :)
     
  26. kideternal

    kideternal

    Joined:
    Nov 20, 2014
    Posts:
    82
    Ran into a crashing bug that I found a workaround for, and thought it worth sharing in case others encounter the same.

    AVPro Windows Media on Windows 7, building 64-bit .exe on Unity 5.4.0b17, using OpenVR w/HTC Vive.

    Switching to next/previous videos worked great in the editor, but upon running a compiled version while wearing the Vive it resulted in a "nvwgf2umx.dll caused an Access Violation" crash to desktop when playing local files. (There was no crash when playing streaming videos, or with the Vive unplugged.)

    I narrowed the problem down to OpenVideoFromFile(), and after attempting multiple workarounds finally discovered that doing just a " yield return new WaitForEndOfFrame();" just before OpenVideoFromFile() prevents the crash. Fun with threads, kids! (Enjoy debugging THAT one, Andrew!)

    While I'm here, I should mention that doing a SceneManager.LoadScene(0) while a video is playing causes its audio to continue streaming until you close Unity. (Hitting "Stop" isn't enough.) Same thing at runtime; you must close the app to enjoy silence. I noticed my Dispose() method wasn't being called, so not sure what's going on there, but I'm stopping it another way and am done debugging for today.
     
    KrabbyQ likes this.
  27. ccklokwerks

    ccklokwerks

    Joined:
    Oct 21, 2014
    Posts:
    62
    Hi,

    I'm testing the 1.3 trial version at the moment. In general, I make the call to load a video in my own scripts. In one usage case I want to load the video and only display the first frame, which I hooked to the FirstFrameReady event.

    This works on other platforms, but on Android specifically, I am not receiving the FirstFrameReady event after ReadyToPlay. Adding a Seek(0) when ReadyToPlay occurs seems to force an update and trigger FFR, but I think this is a small bug.

    Otherwise, the plugin is looking REALLY good.

    Is the ability to alter playback speed scheduled for a future update?
     
  28. L05

    L05

    Joined:
    May 18, 2014
    Posts:
    3
    +1 for being able to push sound from a Media Player instance to an Audio Source so that we can do positional audio.

    We're ready to pull the trigger on buying the whole $450 package as soon as this is implemented!
     
  29. nsc_creative

    nsc_creative

    Joined:
    Nov 3, 2015
    Posts:
    14
    Hi
    I'm also getting a crash when loading a new video in 5.4.0b17, using Oculus although mine happens in the editor as well. Whenever I try and load a video it just crashes. I tried the "yield return new WaitForEndOfFrame();" but it wouldn't allow it in my code as I'm using javascript. If anyone knows the equivalent I'll give that a go.

    Phil
     
  30. ccklokwerks

    ccklokwerks

    Joined:
    Oct 21, 2014
    Posts:
    62
    Ok, this is somewhat weird: if the MediaPlayer and my output texture (currently just a RawImage, on which I set the texture) are located within a Mask, the video doesn't render properly. (This is still with the 1.3 trial.)

    edit: this might not have been a Mask issue. It might just be this intermitted issue I'm seeing where a video fails to play properly in the editor - but it's fine in a build.
     
    Last edited: May 20, 2016
  31. Ivy-SM

    Ivy-SM

    Joined:
    Apr 18, 2013
    Posts:
    31
    Have you looked at this issue? I sent a couple of emails to unitysupport@renderheads.com, but got no answer.
     
  32. ooldsnake

    ooldsnake

    Joined:
    May 6, 2016
    Posts:
    2
    hi all,

    Im trying to play a 360 stream via network (http://IP) on Android/iPhone devices with AVPro VIdeo Free Trial.
    I can see the sphere but no texture on it.....

    It is working when i build for my PC. It is NOT working when i build for Mac (Error:: Failed, not playalable).
    Some videos found in the net are working on devices...
    Is the problem around the codecs or player settings option (i checked the requires internet on Android)?
    Thanks
     
  33. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi all! We're a bit busy at the moment but we'll reply to your questions ASAP.
    Thanks for your patience.
     
  34. Tom-Goethals

    Tom-Goethals

    Joined:
    Mar 6, 2015
    Posts:
    102
    Hi Andrew,

    Hope you like busy, here's another feature request! ;-)

    The MP4 container allows for multiple audio streams, would be great if we could select the audio stream (programmatically or/and through the IDE).

    360 4K video is so large already, making localized versions of videos where only the Voice Over changes could benefit from this feature.

    Any work around to allow for that now? (Android platform)
     
  35. hirotetsu

    hirotetsu

    Joined:
    Mar 14, 2013
    Posts:
    9
    Hi.
    I try build for Mac App Store version.
    Unity5.3.4f1
    AVProVideo 1.3.0

    Got some error
    Invalid Signature - A sealed resource is missing or invalid. The binary at path [MyApp.app/Contents/Plugins/AVProVideo.bundle/Contents/MacOS/AVProVideo] contains an invalid signature.

    I tried
    /usr/bin/codesign --deep --force --timestamp=none --sign \"3rd Party Mac Developer Application: MyCerts\" --entitlements "/PathToProject/Assets/Editor/entitlements.entitlements" "/PathToApp/MyApp.app/Contents/Plugins/AVProVideo.bundle"

    /PathToApp/MyApp.app/Contents/Plugins/AVProVideo.bundle: unsealed contents present in the bundle root
    /PathToApp/MyApp.app/Contents/Plugins/AVProVideo.bundle/Contents/MacOS/AVProVideo: unsealed contents present in the bundle root

    these 2 errors.

    What should I do?
    Please teach me how to fix these 'Invalid Signature' error.
    thanks.
     
  36. hirotetsu

    hirotetsu

    Joined:
    Mar 14, 2013
    Posts:
    9
    I found countermeasure.
    Delete all *.meta file in AVProVideo.bundle
    then build fine and uploaded.
     
    NathanRH likes this.
  37. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
  38. hsmayamel

    hsmayamel

    Joined:
    May 25, 2016
    Posts:
    1
    My version —— AVPro Video (Windows)
    My video size----3840 *1080
    Format -----MP4
    HI !dear
    Problem:
    Sound and the picture is not synchronous, the sound is fast, the picture is slow。
    Thank you, very urgently
     
  39. SirWackelDackel

    SirWackelDackel

    Joined:
    Dec 3, 2015
    Posts:
    5
    Hello !

    Just wanted to ask if somebody could explain to me how I could switch videos randomly with one media player.
    I´m currently not understanding how the scripting reference works.

    In another post I saw that there will be a playlist option soon, do you know when it will be ready?

    Thank you !
     
  40. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    I have a pretty serious problem.

    I have a quad that it's playing a video.
    I have a path, and my camera is walking on that path.
    I'm doing a 360 Video Rendering... and the main problem is that while the rendering is a bit slow... the video is being played at the normal speed + I also have some jitters.

    There where others that had this problem and from what i found out AVPro "does not support time scale".

    Any update on this? This is a pretty serious problem for us :(

    Thank You
     
  41. kideternal

    kideternal

    Joined:
    Nov 20, 2014
    Posts:
    82
    I'm not the developers, but perhaps there's a way for you to adjust the framerate of your video source? i.e. if it's a video stream, perhaps you can adjust its playback rate on the fly? (Not an expert here, but all video decoders support playback rate.)
     
  42. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    It's not the framerate. Both have been set to 25 like the video source.
    When I render my 360 video the Unity Plugin takes a screenshot for every frame... and ofc this screenshot process is not real time, however the video from AVPro plays at normal speed.
     
  43. headHeartDev

    headHeartDev

    Joined:
    Feb 8, 2016
    Posts:
    3
    I have the same problem I've been trying to work with the 360 video demo just inserting my own video. The video was originally 4k 60fps but here's what I've done to little to no affect. The computer isn't the issue as I am using an i5 4590 processor and a r9 390 gpu
    • Reduced the resolution from 1920x1080 (haven't tried lower but it already is much worse looking)
    • Set the sphere to static in the editor (this is the only one that seemed to have any true effect, a little one at that)
    • Not moving the headset (I thought perhaps my DK2 was reading it incorrectly and giving me the jitters. Turns out that just running it without anything still has framerate dips below 60fps. Which is a killer to VR)
    • Building the project and running the exe (I thought maybe having the editor running might be a bit too much had no effect at all)
    I'm wondering if anyone else has figured out a solution that helps with the framerate. I think I'll try using a sphere with less polygons next, but I have doubts that it'll have a strong effect.
     
  44. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    Well one of our programmers made a script that was calculating and setting a timescale for the whole project so the video works fine.

    It's a bit weird because it's working fine on his PC where he has an AMD CPU ... old CPU... 2010 equivalent however that script does not work on my PC, still getting sitters. A bit weird.

    Considering that I'm making a 360 video we are just going to insert the video in After Effects.

    Just to clarify. I'm making a 360 video using this asset. That asset takes a Stereostophic screenshot every frame and then it makes a video out of those frames. When I'm doing this the game moves much slower however my video that I placed on a QUAD using AVPro ... moves at normal speed.
     
  45. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi All,

    Thanks for your patience. I'm back again and am currently going through all of the emails and forum messages left in my absence. Expect emails and forum responses today and tomorrow.

    Thanks!
     
  46. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hey Tom,

    Great idea!! We will add it to the list. We'll have to look at all of the platforms and see how much we can support this but it's certainly a very useful feature to have. Thanks for the suggestion! Currently we don't have any workaround for this :( We will start looking at Android support for this soon. Cheers,
     
  47. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Wow great find! We're not sure why this happens but we'll add it to the documentation FAQ in case other users have the same issue. Cheers,
     
  48. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes sorry it is a bit confusing. AVPro Windows Media (your second link) is one of our older plugins and AVPro Video is our latest plugin. AVPro Video doesn't include AVPro Windows Media becuase they are two separate products. But AVPro Video does include 90% of the functionality of AVPro Windows Media, so effectively it replaces it. We will be removing the old AVPro Windows Media as soon we we have implemented the last remaining missing features. It's only really the Hap codec support that is still better in AVPro Windows Media but this is something we will resolve very soon.

    I would say that you should use AVPro Video as it is far better in most regards. There are trial versions available for both on the website if you want to test them for yourself.

    I hope that helps.
     
  49. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    MP4 videos can be encoded in all sorts of ways. You might want to try reencoding it with more keyframes or less reference frames or something to make the decoding player. Alternatively you can launch your app / Unity Editor with the "-force-d3d11-no-singlethreaded" flag which will example GPU decoding on Windows 8 and above. I hope this helps you. If you're still having problems you can email us and send us the video file.
     
  50. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes the playlist feature is coming in the next version which also has a ton of other great features :) I'm not sure when it will be ready. We plan to release a minor update soon with a few bug fixes (v1.3.5) and then we'll push for v1.4.0 which I hope will come out within 3 weeks.

    You should take a look at the SimpleController.cs script which shows you how to load different videos. Here's a script snippet which I hope helps:

    Code (CSharp):
    1. using UnityEngine;
    2. using RenderHeads.Media.AVProVideo;
    3.  
    4. class VideoSwitch
    5. {
    6.    public MediaPlayer mediaPlayer;
    7.    public string[] filenames;
    8.  
    9.    void Update()
    10.    {
    11.        // every 100 frames
    12.        if ((Time.frameCount % 100) == 0)
    13.        {
    14.            SwitchRandomVideo();
    15.        }
    16.    }
    17.    private void SwitchRandomVideo()
    18.    {
    19.       MediaPlayer.FileLocation location = MediaPlayer.FileLocation.RelativeToStreamingAssetsFolder;
    20.  
    21.        string videoFilename = filenames[Random.Random(0, filenames.Length)];
    22.  
    23.        mediaPlayer.m_AutoStart = true;
    24.        mediaPlayer.OpenVideoFromFile(location, videoFilename);
    25.      }
    26. }