Search Unity

[Released] AVPro Video - complete video playback solution

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

  1. jinghua1988

    jinghua1988

    Joined:
    Jul 26, 2016
    Posts:
    7
    hello,

    Have you resolved the problem that I mentioned before?
    "When I play the video in a period of time, I use Rewind(false) or Seek(0.0f) to replay the video. It will stop at start position. How can I replay the video from first frame.
    platform: ipad air 9.3.3 and Mac 10.12"

    Thanks.
     
  2. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes, it should be fixed in the latest version - please upgrade to version 1.5.7, thanks!
     
  3. KOP3R

    KOP3R

    Joined:
    Feb 18, 2015
    Posts:
    13
    Hi - related screenshots are from version 1.5.7t (scripts v1.5.7)

    Sometimes it rewinds proper to first frame and sometimes to black screen.
     
  4. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Interesting! And does this happen only with your videos, or also with our included sample videos?
     
  5. KOP3R

    KOP3R

    Joined:
    Feb 18, 2015
    Posts:
    13
    It looks like it only happens in my videos. These videos are ~1sec long, maybe it's the issue.

    Also, it not happens always. It's random. Sometimes it is rewound very well and sometimes it's rewound to black screen. I have seen it happens only from Rewind() from code - button rather worked well.
     
    Last edited: Nov 23, 2016
  6. phileday

    phileday

    Joined:
    Feb 8, 2014
    Posts:
    123
    Hi
    Thanks for your suggestions. I've removed the audio source option for now as I want to test it more before submitting it as a Oculus Store build so I've gone back to the original method.

    I do have another question. This relates to the IsPlaying command. I've got a setup when the video plays from a different file/source when you hit play. The problem is the audio plays instantly but the video sometimes takes a second to start. Is there an easy way to check that the video is actually playing rather than it's been sent the command to play and is still in preroll.

    Also in case you don't know (this could be a problem my end but I'm mentioning it anyway) you script reference doesn't seem to be working.

    https://rh-downloads.s3-eu-west-1.amazonaws.com/docs/AVProVideoClassReference/

    I get this error.
    This XML file does not appear to have any style information associated with it. The document tree is shown below.
    "); vertical-align: bottom; height: 10px;"><Error>
    <Code>AccessDenied</Code>
    <Message>Access Denied</Message>
    <RequestId>481246FF45622F5C</RequestId>
    "); vertical-align: bottom; height: 10px;"><HostId>
    zEstXp3H3KH2kAykWLIxH3C9L4/E6W4/Rd/q763KLHADlQE3WFiF3ZEjuAt1NtuNjqpq3MbJv0Q=
    </HostId>
    </Error>

    All the best

    Phil
     
  7. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Could you send me one of your videos to test with? Thanks,
     
  8. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Okay, the fix for the scripting reference will be in the next release (later today).
    You should be able to query mp.TextureProducer.GetTextureFrameCount() and only when it is > 0 then it has a frame and is good to play. I hope that helps!
     
  9. phileday

    phileday

    Joined:
    Feb 8, 2014
    Posts:
    123
    Cheers :) that's much appreciated.
     
  10. AndrewRH

    AndrewRH

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

    AVPro Video version 1.5.8 has just been released!

    You can find the updated version on the Asset Store and the free trial version / demos on our website.

    Changes include:

    macOS
    • Fixed issue with OpenGLCore where texture wouldn’t update due to GL state not being restored correctly when using a uGUI mask
    • Fixed issue where RelativeToProjectFolder was pointing to inside the .app package instead of at the same level
    Android
    • Streaming video no longer blocks while loading (but video frame-rate may now not be available)
    • Removed duplicate function call, minor performance win
    • Fixed number of audio tracks reported for streams
    • Fixed potential case issue with URL detection
    Windows
    • Platform specific settings exposed better in the editor
    General
    • Fixed some shader build errors for older versions of Unity
    • Added some in-editor warnings for using unsupported file extensions on various platforms
    • Fixed broken scripting reference link in ‘About’
    Thanks,
     
    Last edited: Nov 23, 2016
  11. dave_e3ct

    dave_e3ct

    Joined:
    Nov 7, 2016
    Posts:
    12
    Hi All,
    anyone had any problems with WebGL text inside a browser build after playing a movie with AvPro?

    I've had an issue where the text characters just disappear, which I assumed was a unity issue with WebGL & Dynamic fonts. I swapped to using non-dynamic fonts by using TextMesh Pro and I now get some odd texture corruption - see below.

    Left image is what I get if I don't play a video, right is if I do. Could be an issue with WebGL, not sure.

    As mentioned, this only happens when playing in a browser under WebGL. Editor version of WebGL is fine, as are android and iOS versions, both in the editor and on device.

    Any thoughts anyone?
    Thanks,
    Dave
    character_error.jpg
     
  12. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Thanks for reporting this Dave - I did also get your email :) This is most likely a GL state bug where a GL state isn't being restored. I suspect it could be glBlend.... We will look into this and should get a fix out soon. I'm away for a few days though right now.
     
  13. dave_e3ct

    dave_e3ct

    Joined:
    Nov 7, 2016
    Posts:
    12
    Thanks for the update - I'm on a tight deadline (Friday!) so will put in the unity WebGL player for a stop gap for now. Keep me posted!
    Thanks,
    Dave
     
    AndrewRH likes this.
  14. PaintNPixels

    PaintNPixels

    Joined:
    Apr 15, 2015
    Posts:
    5
    Is there a best practices guide available for upgrading a project's AVPro with each release?
     
  15. jamesbdh

    jamesbdh

    Joined:
    Sep 22, 2015
    Posts:
    7
    Is it possible to adjust the overall transparency of a video, so it can be faded in/out?
     
  16. pgeorges-dpt

    pgeorges-dpt

    Joined:
    Apr 7, 2016
    Posts:
    43
    Hi,

    We love your plugin! Very well done! How difficult would it be to have a Chromakey shader for the AVPro material that plays the movie?

    Cheers
     
  17. emrahozer_rightsoft

    emrahozer_rightsoft

    Joined:
    Sep 29, 2016
    Posts:
    6
    Hi,

    I bought windows only version. I'll be using up to 3 media players playing different videos as 3 columns in my app. I display the videos in UGui. I have two questions:

    1) There is a huge performance drop when I play two videos (960x1080) side by side. Even though I don't render one of it. It works fine with my pc which has a gtx 1080, but is really terrible at my MacBook pro 2015 in which I can run ~20 hd videos playing same time when I develop native uwp apps.

    Can you give me any insight about how to improve the performance? Any specific codecs or any specific settings (aside hardware decoding)? A quick note, I face this problem mostly with the build, it doesn't seem that bad in the editor.

    2) I change the playing video depending on a user interaction. This causes couple frames of blank white background. How can I overcome this issue? (A solution I can come up is to get a snapshot of the video to be replaced, but an image until the second video is loaded. Shall I give this a go, is taking snapshot fast enough to cover this transition) Any advice would be welcome.

    Cheers
     
  18. DavidChuang

    DavidChuang

    Joined:
    Nov 28, 2016
    Posts:
    3
    Hello,

    I have one question about video formats.

    I have a Stereoscopic 3D 360 Video for mp4 formats to play in AVPro video. But it is not Up-down video in Unity.

    Can you give me some advice to solve this problem?



     
  19. JFTripleBoris

    JFTripleBoris

    Joined:
    Oct 31, 2016
    Posts:
    2
    Hi,

    I updated from 1.4.4 to 1.5.7 and the backward Seek seems to be broken on Mac OS.

    Are you aware of this issue?

    Thanks.
     
  20. greenyello

    greenyello

    Joined:
    Apr 19, 2013
    Posts:
    18
    how to make seamless video with avpro?

    i tried this with two video, and pingpong
    but has little lag before start second video
    ( i play second video in first video's MediaPlayerEvent.FinishedPlaying )

    i found there is video call back, but dont know where i should play second video, and where i should stop first video

    plz give me sample code for making seamless video

    if i solve this issue , i would buy avpro quickly and release app

    and last question
    sample video has no lag when loop, but my video has lag,
    is there any video encoding setting for seamless video?
     
    Last edited: Nov 29, 2016
  21. infinite360VR

    infinite360VR

    Joined:
    Apr 19, 2016
    Posts:
    23
    @AndrewRH

    Does AVPro Player Android support playing video from bytes. lets say I have a video.dat file strored in my phone. We want to restrict user to be able to play the video only from our app. But a mp4 video saved in phone is accessible from file manager. and can be played and distributed. Is there a solution to use encryption/binary serialization ?

    Thanks
     
  22. desarrollori

    desarrollori

    Joined:
    Sep 22, 2016
    Posts:
    2
    Hello, can you tell me how I can use AVPro Video using a url in android, in ios the url works well but in android it does not work
     
  23. NathanRH

    NathanRH

    Joined:
    Oct 24, 2012
    Posts:
    447
    Hi,
    AVPro Video for Android allows you to specify an offset into a file where the video is located. So for example you can have video.dat and store a video file inside it at some location. The offset value is specified in the "Android" section of the "Platform Specific" panel in the MediaPlayer component. This makes it harder for people to extract the video. They would still be able to copy of the file, but not be able to play/extract the video contents without some advanced skill and determination. I'm afraid the plugin doesn't have any support for encryption.
    Thanks,
     
    infinite360VR likes this.
  24. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi should work the same way on Android. For Android you do need to make sure that in Unity's Player Settings that you've enabled the Internet Access option. Also make sure that the beginning is lowercase, eg: "http://" instead of "HTTP://". If it's still not working please share the URL so we can test it. Thanks,
     
  25. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes, in the PDF documentation we have a section on installation and upgrades. Hopefully the steps are easy to follow. If you're having a specific issue just let us know. Thanks,
     
  26. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Okay, I see the problem here. This video is encoded with metadata that specifies that it is a packed stereo format. Our plugin doesn't support this and will only display one of the 'eyes'. If you remove this metadata from the video file then it should play as expected.
    Thanks,
     
  27. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes, you can do this. AVPro Video simply renders a video to textures and then they are displayed in Unity via the standard methods - uGUI, materials etc. You would need to adjust the component that is doing the actual displaying of the video. For example if you're using the DisplayIMGUI or DisplayGUI components, then they have options for colour value that you can adjust. If you're displaying using ApplyToMesh then you will be able to adjust the mesh material properties to do the fading. Not all materials/shaders support transparency though so you would need to check this.

    Thanks,
     
  28. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    It should be very easy! We plan to write one soon but just haven't had time to do it yet. But if someone wanted to integrate it themselves it should be very easy. AVPro Video just uses standard Unity textures and materials.
     
  29. AndrewRH

    AndrewRH

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

    1) First of all, which version of Unity+AVPro Video + macOS are you using? Are you saying that you're running Windows on your MacBook Pro 2015? (if so please provide OS version). Perhaps you could send us a sample scene demonstrating the issue? Even a video of the performance issue would be very helpful. You can email us at unitysupport@renderheads.com

    2) Taking a snapshot is a good idea and it should work. We also sometimes use two MediaPlayers and ping-pong between them. For example when the first player finishes, we start the loading of the second player and once it has completed loading (by checking the FirstFrameReady event), we switch the MediaPlayer field on the DisplayUGUI component to the second player.

    Thanks,
     
  30. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    I think you can know when to play the second video when you receive the FirstFrameReady event. This is the point at which the second video is displayable.

    For seamless playback, you should remove B-frames from your video and make the GOP as small as possible (I use a GOP size of 2 in the sample video). Encoding tools such as FFMPEG have options for these. It also has a "fastdecode" tuning option which does most of these for you. We also have some notes in the PDF documentation about this - just search it for "ffmpeg".

    Thanks,
     
  31. gizmovr

    gizmovr

    Joined:
    Nov 16, 2016
    Posts:
    4
    Hi,
    How to make uGUI controls to be stereo while watching stereo video in the sphere?
     
  32. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hmmm we're not aware of this issue! I've just tried to replicate it but didn't manage to.

    We tested using Unity 5.4.2f2, macOS 10.12.1 and AVPro Video 1.5.8

    Perhaps you could explain exactly your setup and what you're doing to get the issue.

    Thanks,
     
  33. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi,
    I don't think this question is related to AVPro Video. uGUI controls are just a standard Unity component. I guess you may have to render them in World space to get the stereo 3D effect. Maybe someone else has a better answer for this.
    Thanks,
     
  34. TheLZR

    TheLZR

    Joined:
    Jul 3, 2015
    Posts:
    1
    Hi,

    I need put a video in the background and over this put a few rawimages in a canvas, I tried using IMGUI or GUI or Background Shader, but all the time the video hide the canvas, put evething behing him. How I can fix this?

    Thanks
     
  35. AndrewRH

    AndrewRH

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

    The Background Shader example should definitely work. Alternatively using uGUI should also work, as long as you have your elements in the right order.

    You could also simply use two cameras to draws your scene - this will allow you to control what is in the background/foreground. Each camera has a "depth" field which controls the order of rendering in the frame. Let the "clear flag" of the second camera to "Depth Only" and use the culling mask to allow each camera to only render certain elements.

    I just tried loading the "01_Demo_BackgroundShader" example scene, and adding a RawImage object via Canvas to the scene. It works perfectly with the background video behind the GUI. This is in Windows in the Unity Editor. Perhaps you're doing this on a different platform and having this issue? Which platform, Unity version and AVPro Video version are you using?

    I hope this works for you. Thanks,
     
  36. ickydime

    ickydime

    Joined:
    Nov 20, 2012
    Posts:
    110
    Hey Andrew, we migrated our projects to Unity 5.5 and for some reason we now get an Access Violation whenever we have AVPro in our UWP project.

    Unfortunately we don't get much more detail than that. It happens immediately on starting up the project.

    I even created an empty scene. Imported your latest library. Published to Windows 10 UWP, Hololens. Opened Visual Studio and built locally (doesn't need a hololens to see error) and it crashes with access violation.

    Any insight or help would be appreciated. Let me know if I can provide more detail.
     
  37. KOP3R

    KOP3R

    Joined:
    Feb 18, 2015
    Posts:
    13
    Hi, do you have any idea how to nice Seek() video on startup?
    I would like to start a video not from the beginning but from 2050ms but in Awake() and Start() MediaPlayer.Control is null.

    UPDATE: I've resolved it with event EventType.ReadyToPlay
     
    Last edited: Dec 2, 2016
  38. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,052
    @AndrewRH we were yesterday fighting with the F****** codesigning in macOS because as you know Unity has abandoned this platform years ago and the support it's really sh** and instead of generating a Xcode project it generates the *.app that you need later to make a PostProcessBuild to overwrite Info.plist (many values are wrong or missing like CFBundleSupportedPlatforms that if it doesn't exist with Application Loader it thinks that it's an ipa??? what????), *.icns file and UnityPlayerIcon.png because despite of dragging it to "Default Icon" player settings it outputs the default Unity icon logo and the iconset file (icns) it's not correct also (whaaaat???). And also you need to codesign the app with all it's plugins and frameworks. And apply a macOS retina bug that it's documented in Unity Manual that code snippet (what????).

    We fought an entire day with all that sh** and found some "bugs" on AVPro:

    1. PostProcessBuild it's not required in some Unity version that added. Correct me if I'm wrong that this should apply to macOS also but maybe Unity only set this for iOS and it's another bug from Unity: https://docs.unity3d.com/ScriptReference/PlayerSettings.iOS-allowHTTPDownload.html

    So it can set "NSAllowsArbitraryLoads" value. I don't know exactly what version added that but I know that in 5.4 it's not required.

    That script on line 1 has a typo: "#if UNTIY_IOS".

    2. Info.plist value it's wrong on macOS when you want to publish that for AppStore. If you see:

    <key>CFBundleIdentifier</key>
    <string>com.renderheads.AVProVideoPlugin</string>

    And read: https://developer.apple.com/library...KeyReference/Articles/CoreFoundationKeys.html

    It's not really clear but the result is that all "Info.plist" of each "*.bundle" in an app needs the same CFBundleIdentifier because when you upload it with Application Loader it checks if that identifier exists and it's not in use. If we use "com.renderheads.AVProVideoPlugin" it says that it's duplicated (used by who? the first who uploaded an app with AVPro package?) so I had with a PostProcessBuild edit your Info.plist to point to my identifier.

    I hope that it helps all this information.
     
  39. ultraschall

    ultraschall

    Joined:
    Feb 14, 2013
    Posts:
    30
    @AndrewRH Hello Andrew, after updating to 5.5 and building for iOS we get the following error in XCode
    Please have a look. thanks.

    Undefined symbols for architecture armv7:
    "_UnityEndCurrentMTLCommandEncoder", referenced from:
    -[AVPPlayerMetalWatermarkedTextureDelegate renderPlayerTexture:] in libAVProVideoiOS.a(AVPPlayerMetalWatermarkedTextureDelegate.o)
    ld: symbol(s) not found for architecture armv7
     
  40. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes, Unity changed some things in 5.5, which means the iOS plugin no longer works - we're working on a fix right now. Unfortunately it seems like this fix will make the plugin no longer work in Unity 5.3 and below, so we're trying to find a solution to this... It shouldn't be long - Thanks,
     
  41. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Thanks, we'll look into this and get back to you. If there is a bug there then we'll release a new version with the fix. Unity 5.5 changes quite a few things, so there is a good chance that either our plugin needs updating, or that there is a bug in Unity 5.5.

    Thanks,
     
  42. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Thanks, there is a lot of information here - let us go through it and get back to you. Thanks,
     
  43. thomasbiddulph

    thomasbiddulph

    Joined:
    Oct 27, 2016
    Posts:
    4
    Hi, can this plugin play .mp4 files which are created at runtime? I'm working on a HoloLens app at the moment where I need to capture and display video at runtime. I've had no problems capturing the video, unfortuantely it's in mp4 format so I'm having trouble displaying it with a movie texture.
     
  44. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi,
    Yes the AVPro Video plugin can play back MP4 files that have been captured at runtime. There is a free trial version on the website that you can try :) Thanks,
     
  45. magglemitch

    magglemitch

    Joined:
    Dec 8, 2013
    Posts:
    112
    Hey,

    Are there any classes available for checking what video is currently playing? Wanting to write an if statement to do something while a specific video is playing. Eg, if "filename.mp4" is currently playing then do this.

    Been scrolling through the documentation and haven't noticed anything like that yet.
     
  46. Doddler

    Doddler

    Joined:
    Jul 12, 2011
    Posts:
    269
    After having enough with constant issues with the built-in unity movietexture, I've taken the plunge and grabbed avpro. Converting over from using movietextures to avpro has been quite painless, with very little difficulty. Re-encoding my videos took longer than getting avpro set up and working in place. Overall I'm quite happy.

    I do want to re-iterate my hopes for one day having a linux version, so that I can target the 3 desktop platforms with one tool and be rid of movietextures forever. :p
     
  47. JFTripleBoris

    JFTripleBoris

    Joined:
    Oct 31, 2016
    Posts:
    2
    Hi Andrew,

    I use Unity 5.4.0f3, macOS 10.11.6 and AVPro 1.5.7.

    I call Control.Seek to go back in the video and nothing happens. Same code on windows works fine. And it was working fine with 1.4.4.

    Thanks
     
  48. ilia94

    ilia94

    Joined:
    Dec 5, 2016
    Posts:
    1
    I am trying to get a 360 video playing in a HoloLens. I've tried the sample 360 sphere scene as well as my own 360 videos and everything works in the editor, but each time when I build - the build succeeds but the HoloLens only displays white all around on the sphere instead of playing the video. I've tried adding the line m_AppCallbacks.AddCommandLineArg("-force-d3d11-no-singlethreaded"); to app.cs but that didn't fix the problem. I'm doing this in a new Unity Project with only AVPro and HoloToolkit plugins imported. (The AVPro component has AutoStart and AutoOpen checked).
     
  49. chuckfletcher

    chuckfletcher

    Joined:
    Aug 6, 2014
    Posts:
    2
    Hi Andrew - any updates on the 5.5 fix? I'm in desperate need of it.

    Also emailed you.

    Chuck
     
  50. ultraschall

    ultraschall

    Joined:
    Feb 14, 2013
    Posts:
    30
    If you can provide a 5.5 Only version that does not work in 5.3 - its also fine for us !