Search Unity

[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
    Yes HLS is supported on all platforms. We only support AES HLS streams where the key information is already in the m3u8 manifest, we don't support supplying it externally. I hope that helps. In the near future we should be able to offer external AES setting on Android as we're looking into this now.
    Thanks,
     
  2. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    We don't currently support DRM. On Android though we do have a "file offset" option which can be used to hide video files within existing files. We've used this successfully on a number of projects.
     
  3. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    Could you link me to documentation about "file offset"? I'm not sure how that would be done.
     
  4. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes there isn't much information in our documentation about this. We'll fix this in the next release.

    So you can append your video file to an existing file to hide it. For example you could have a dummy video file which you append your video to. The offset value would then by the real byte size of the dummy video file. In Windows you can use this command to glue two files together:

    copy /b DummyVideo.mp4 + %1 %~n1-hidden.mp4

    Currently this only works for videos in the StreamingAssets folder, but we have a fix in the next version coming so it works with files in other locations too.

    I hope that helps.
     
    LostPanda likes this.
  5. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    Thanks, and how would you point AVPro to the hidden file? Also do you have a timeline for when you expect to be releasing the next version with that fix to work outside StreamingAssets?
     
  6. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Just like normal...You just copy the file to StreamingAssets and point to it. :)
     
  7. MarkTS

    MarkTS

    Joined:
    Aug 18, 2017
    Posts:
    1
    Hi,
    Thanks for making AVPro. We are currently trying to use it to stream an m3u8 video file (only up to HD quality) to an iPad Pro app without any audio in the stream (the reason for this is that adding audio increases the lag in the stream and we want it as close to realtime as possible).
    AVPro doesn't display the video for the stream with no audio. If we add audio to the stream (either from the microphone or via a faked placeholder audio stream) then AVPro shows the stream OK. The display of the stream failing is reproducible in editor as well as on device but the same stream can be viewed via the Safari browser on both iPad and Mac.
    Is this a known issue and is there anything we can do to get it working?
     
  8. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi, thanks for reporting this. This certainly isn't a known issue.
    Perhaps you could email us (www.renderheads.com/contact/) with the URL to your stream so we can debug it?
    Having access to both the stream with and without audio would be ideal.
    Thanks,
     
  9. Xuejia

    Xuejia

    Joined:
    Aug 2, 2017
    Posts:
    7
    Hi,i have made a video player with your plugin and it works well on my pc(win10+nv 760).
    But on my friend's pc (win7+ nv 1070),it can not work.No error debugs but there is also no texture.
    Another friend with(win7 + Amd R9_390).it can work.
    So what can i do to make the player works well on Win7+nv 1070
    i am using the package 1.6.2.whether this proble will be fixed after i update the package
     
    Last edited: Aug 21, 2017
  10. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi, perhaps you could send us the output_log.txt file from your friends machine where it doesn't work?
    Can it play our sample video files?
    Does any audio play?

    Thanks,
     
  11. Cambesa

    Cambesa

    Joined:
    Jun 6, 2011
    Posts:
    119
    I haven't found anything special in the adb logcat yet.

    I experimented a bit and even if I simply declare:
    _Color("Main Color", Color) = (1,1,1,1)
    in the top properties and use:
    uniform Color _Color;
    right before the 2nd void main() and wirte:
    gl_FragColor=_Color;
    in the 2nd void main(), I also have the graphical glitch.

    How is it possible that a simple color output can cause these kind of things?

    Even setting:
    gl_FragColor = vec4(1.0,0.0,1.0,1.0);
    causes the graphical issues.

    Kind regards,

    Yorick
     
  12. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi, I'm not sure why yours doesn't work, but using Unity 5.5.3 and OES mode, this shader works for us and adds support for Color tinting:

    Code (CSharp):
    1. Shader "AVProVideo/VR/InsideSphere Unlit (stereo) - Android OES ONLY"
    2. {
    3.     Properties
    4.     {
    5.         _MainTex ("Base (RGB)", 2D) = "black" {}
    6.         _Color("Color", Color) = (0.0, 1.0, 0.0, 1.0)
    7.         [KeywordEnum(None, Top_Bottom, Left_Right, Custom_UV)] Stereo("Stereo Mode", Float) = 0
    8.         [Toggle(STEREO_DEBUG)] _StereoDebug("Stereo Debug Tinting", Float) = 0
    9.         [Toggle(APPLY_GAMMA)] _ApplyGamma("Apply Gamma", Float) = 0
    10.     }
    11.     SubShader
    12.     {
    13.         Tags{ "Queue" = "Geometry" }
    14.         Pass
    15.         {
    16.             //ZTest Always
    17.             Cull Front
    18.             ZWrite Off
    19.             Lighting Off
    20.  
    21.             GLSLPROGRAM
    22.  
    23.             #pragma only_renderers gles gles3
    24.             #pragma multi_compile MONOSCOPIC STEREO_TOP_BOTTOM STEREO_LEFT_RIGHT STEREO_CUSTOM_UV
    25.             #pragma multi_compile __ STEREO_DEBUG
    26.             //#pragma multi_compile __ GOOGLEVR
    27.  
    28.             #extension GL_OES_EGL_image_external : require
    29.             #extension GL_OES_EGL_image_external_essl3 : enable
    30.             precision mediump float;
    31.  
    32.             #ifdef VERTEX
    33.  
    34. #include "UnityCG.glslinc"
    35. #define SHADERLAB_GLSL
    36. #include "AVProVideo.cginc"
    37.  
    38.         varying vec2 texVal;
    39.         uniform vec3 _cameraPosition;
    40.         uniform mat4 _ViewMatrix;
    41.  
    42. #if defined(STEREO_DEBUG)
    43.         varying vec4 tint;
    44. #endif
    45.  
    46.             void main()
    47.             {
    48.                 gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
    49.                 texVal = gl_MultiTexCoord0.xy;
    50.                 texVal = vec2(1.0, 1.0) - texVal;
    51.  
    52. #if defined(STEREO_TOP_BOTTOM) | defined(STEREO_LEFT_RIGHT)
    53.                 bool isLeftEye = IsStereoEyeLeft(_cameraPosition, _ViewMatrix[0].xyz);
    54.  
    55.                 vec4 scaleOffset = GetStereoScaleOffset(isLeftEye);
    56.  
    57.                 texVal.xy *= scaleOffset.xy;
    58.                 texVal.xy += scaleOffset.zw;
    59. #elif defined (STEREO_CUSTOM_UV)
    60.                 if (!IsStereoEyeLeft(_cameraPosition, _ViewMatrix[0].xyz))
    61.                 {
    62.                     texVal = gl_MultiTexCoord1.xy;
    63.                     texVal = vec2(1.0, 1.0) - texVal;
    64.                 }
    65. #endif
    66. #if defined(STEREO_DEBUG)
    67.                 tint = GetStereoDebugTint(IsStereoEyeLeft(_cameraPosition, _ViewMatrix[0].xyz));
    68. #endif
    69.             }
    70.             #endif
    71.  
    72.             #ifdef FRAGMENT
    73.  
    74.             varying vec2 texVal;
    75. #if defined(STEREO_DEBUG)
    76.             varying vec4 tint;
    77. #endif
    78.  
    79.             uniform vec4 _Color;
    80.             uniform samplerExternalOES _MainTex;
    81.  
    82.             void main()
    83.             {        
    84. #if defined(SHADER_API_GLES) || defined(SHADER_API_GLES3)
    85.  
    86. #if __VERSION__ < 300
    87.                 gl_FragColor = texture2D(_MainTex, texVal.xy) * _Color;
    88. #else
    89.                 gl_FragColor = texture(_MainTex, texVal.xy) * _Color;
    90. #endif
    91.  
    92. #else
    93.                 gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);
    94. #endif
    95.  
    96. #if defined(STEREO_DEBUG)
    97.                 gl_FragColor *= tint;
    98. #endif
    99.             }
    100.             #endif      
    101.                
    102.             ENDGLSL
    103.         }
    104.     }
    105.    
    106.     Fallback "AVProVideo/VR/InsideSphere Unlit (stereo+fog)"
    107. }
     
    Cambesa likes this.
  13. Xuejia

    Xuejia

    Joined:
    Aug 2, 2017
    Posts:
    7
    Hi,can not play any videos,here is the oputput_log
    And the same program on the same PC but on the Win8.1 can play all the video(we install Win7 and Win8.1 on the same PC).
    We have checked that the AVProVideo.dll is indeed in the fold E:/development build/DpnVideoPlayer_PC_Data/Plugins/
     

    Attached Files:

  14. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    The log file says it can't load the AVProVideo DLL ('找不到指定的模块。).

    This either means:

    1) the file is not there, check it exists in the _data/Plugins folder
    2) the file is there, but it is the wrong architecture, like 64-bit instead of 32-bit. You can check in Unity using the Inspector that the plugin files have the correct platform architecture assigned
    3) there are some missing dependencies on your system. Check that you aren't running the Windows N or KN editions, as these don't ship with any Media components and require a download from Microsoft called "media feature pack". You can also use the app depends.exe (http://www.dependencywalker.com/) to open the AVProVideo DLL file on that system and it should tell you which dependencies it can't find. Sending us a screenshot of this would be useful.

    Let me know if you find out what the issue is.

    Thanks,
     
  15. Cambesa

    Cambesa

    Joined:
    Jun 6, 2011
    Posts:
    119
    Thanks for the shader! With a couple of modifications I got it to work, in our case we are using a different queu and not as background but as simple texture on a model and some other small differences

    Thanks
     
  16. hirose

    hirose

    Joined:
    Oct 28, 2013
    Posts:
    1
    Hello
    I would like to use this asset for UWP development.
    However, the Windows version can not request using custom http headers.
    As with Android and IOS, is it possible to add requests using UWP with custom http headers?
     
  17. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    I'm afraid not, this isn't something that's easy to do. We'll add it to the request list but we can't make it a high priority.
    Thanks,
     
  18. AndrewRH

    AndrewRH

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

    AVPro Video version 1.6.14 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 / iOS / tvOS
    • Fixed issue where audio-only media would not update current time
    • Improved error reporting
    iOS
    • Fixed texture error when using Unity 4.x
    Android
    • Fixed file offset not working for videos in StreamingAssets folder. Until now file offset only worked for files at other locations in the file system
    Windows
    • Fixed regression introduced in 1.6.12 that would cause DirectShow videos to not play when using Direct3D9 or OpenGL
    • AudioOutput component now handles different sample rates and channel counts set in Unity’s audio settings and automatically detects number of audio channels in source media
    Thanks,
     
  19. ZealUnity

    ZealUnity

    Joined:
    Apr 13, 2014
    Posts:
    64
  20. Xuejia

    Xuejia

    Joined:
    Aug 2, 2017
    Posts:
    7
    Hi,I have solved this problem.
    Root cause:
    1.Load VCOMP140.dll failed
    2.Microsoft DirectShow H.264 decoder can not play video whose resolution is higher than 1920*1080

    How to fix:
    1.install Microsoft.VC++.2015.Redistributable
    2.install LAV Filters

    Thank you so much!
     
  21. richardzzzarnold

    richardzzzarnold

    Joined:
    Aug 2, 2012
    Posts:
    140
    I am have made some video buttons, putting the displayUGUI on a UI.button.Any idea how I would go about rounding the corners? I have looked at applying a mask or a 2d mask but they don't appear to do anything.
    Thanks
     
  22. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Glad it's working for you now :)

    1) This was a bug in version 1.6.2 and has since been fixed. That dependency is no longer needed.
    2) Yes if you're using Windows 7 or below and want to play videos over 1080p then an external decoder is needed such as LAV.

    Thanks,
     
  23. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes, we have a demo for 180 videos included in the plugin. I'm pretty sure it should work for SBS too...
     
  24. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    If you add a Mask component to your button and have the DisplayUGUI component as a child of the button, then it will be masked by the button. This is a hard mask though, but there are scripts available that can also do a soft mask.
    Thanks,
     
  25. NatsupyYui

    NatsupyYui

    Joined:
    Jul 11, 2017
    Posts:
    18
    Hi,
    While using this, can get spectrum or create a waveform of audio?
     
  26. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi,
    There isn't any feature to do this currently. The only way would be using our (Windows only) AudioOutput component - this reads in audio data from the plugin, so you could then use those values to create a waveform / levels.
    thanks,
     
  27. NatsupyYui

    NatsupyYui

    Joined:
    Jul 11, 2017
    Posts:
    18
    Thank you so much for that info!
     
  28. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    I'm having an odd issue with AVPro. I have a looping video I'm playing first. I then transition to a video I want to play once before going back to the looping video. When I transition to the the video I want to play one time I use:
    sphereMediaPlayer.Control.SetLooping(false);
    but it only seems to work if I have the media player selected in the hierarchy. The second video also just loops if I don't have it selected or if I make a build.
     
  29. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Ahh, yes I think I know this bug..
    As a workaround you could try this:

    sphereMediaPlayer.m_Loop = false;
    sphereMediaPlayer.Control.SetLooping(false);

    Hopefully that works for you. The bug is caused by the inspector UI setting the looping state...We'll fix this in the next update.

    Thanks,
     
    265lutab likes this.
  30. Mon0waR

    Mon0waR

    Joined:
    Aug 16, 2017
    Posts:
    7
    Hey,
    I have some very strange issue with Snapdragon-powered Samsung Galaxy S-series.
    With primitive cardboard/daydream/gearvr 360 player
    Source video is 2048x2048 for S6 and 4096x2048 for S7&8 at 60fps. I've tried different bitrates and codecs (AVC, HEVC)
    Thus in EU versions (with Exynos/Mali) I can get 60fps easily without any lags
    But appeared, that in US versions of S7&8 (with Snapdragon/Adreno) it is possible to get smooth playback only with 2048x2048@30fps
    According to Qualcomm specs, their SoCs should play 4k UHD, even with 10-bit!
    So I'm curious how to debug and address this issue.
    Any ideas are welcome!
    Thanks.
     
  31. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi,
    This is interesting - could you link to the specs?
    We've found using H.265 with 3840x1920@30 or 2048x2048@60 to work best.
    I'm not aware of differences between hardware capabilities and have found it quite difficult to discover the detailed specs of the video decoders..
    Thanks,
     
  32. Mon0waR

    Mon0waR

    Joined:
    Aug 16, 2017
    Posts:
    7
    Well, this is what I've found
    https://developer.oculus.com/docume.../mobile-media-overview/#mobile-media-overview
    The conservative specs for panoramic video are: 2880x1440 @ 60 FPS or 2048x2048 @ 60 FPS stereo. If the camera is stationary, 3840x1920 @ 30 FPS video may be considered. The GALAXY S7 decoder allows 4K at 10-bit color, 3840x2160 @ 60 FPS (HEVC) or 8-bit, 3840x2160 @ 60 FPS (VP9). The GALAXY S8 decoder allows 4k at 3840x2160 @ 60 FPS.​
    https://www.qualcomm.com/media/documents/files/snapdragon-820-processor-product-brief.pdf
    • 10-bit 4K decode
    • 1080p240 FPS decode
    • 4K HEVC video (Decode: 60 fps,10-bit. Encode: 30 fps)

     
  33. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    I have a file that I am playing from the PersistantDataPath. I need to be able to delete the file and update it after playing it. How would I go about closing the file so I can delete it? Control.Stop() is not closing the file. It still can't be deleted or overwritten until the app is closed and opened again.
     
  34. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    I did notice that playing another video will close the file and allow the first one to be updated, but stopping it does not close the file. Maybe a bug in the stop function?
     
  35. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    You should be able to call CloseVideo() on the MediaPlayer component.

    Cheers,
     
  36. Beloudest

    Beloudest

    Joined:
    Mar 13, 2015
    Posts:
    247
    Hi I'm working with Samsung S8 and GEAR VR. I've made a 360 video app and decided to try out the Fast OES feature, I also updated the sphere mesh material to the VR - Android OES shader.

    When I press play in the unity editor I still see the video play. When I build and test on the device I dont see any videos play. Do you have any suggestions on how to make the OES feature work or next steps to debug?

    Also is the "Display Rate" value on the Media Player component essentially the frame rate playback speed? My video is 29.9 fps and the display rate drops to around 20. Is this common? Is there any quick tricks for good frame rate speed on Android? Thanks
     
  37. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi!
    To use the OES feature, you will either need an older Unity like 5.5.3, or the latest patched version of 2017 as they recently fixed a bug in GLSL compiling. You also need to assign a material to the sphere that uses an OES shader.

    Yes, the display rate is the actual rate that the decoder achieves. To improve frame rate, make sure that multi-threaded rendering is enabled (in Player Settings), and OES can also help.

    Thanks,
     
    Beloudest likes this.
  38. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    Does AVPro support 4096x4096 video on android? I'm creating something with stereo 360 video and would like it to be 4k if it can be. What is the suggested format for something like that. The video will be 5-10min long.
     
  39. Beloudest

    Beloudest

    Joined:
    Mar 13, 2015
    Posts:
    247
    Yes it does for me
     
  40. Beloudest

    Beloudest

    Joined:
    Mar 13, 2015
    Posts:
    247
    Is there any support coming for ambix audio in the future?
     
  41. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    What video codec and format are you using?
     
  42. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    When I try to play anything larger than 2048x2048 on a Galaxy S7 running android 7.0 it is failing to play. The larger videos I've tried are using is H.264, 30fps, Level 5.2. Is Level 5.2 not supported? Should I be using a different Codec?
     
  43. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    Also didn't you just say that the video was not playing when built to an android device or does it work fine if you don't use OES with the 4096x4096 video?
     
  44. Wanderer13

    Wanderer13

    Joined:
    Feb 11, 2016
    Posts:
    19
    Hi there! Does some special steps required to support multiple audio tracks? I created video with 2 audio tracks using ffmpeg and all tracks can be played in media player software (VLC for example), but mediaPlayer.Info.GetAudioTrackCount() reports that there is just 1 audio track. Sample video & ffmpeg command:
    https://drive.google.com/file/d/0B6NjHK3ceiPKZVRWUVZtVWRfWjQ/view?usp=sharing
     
  45. Beloudest

    Beloudest

    Joined:
    Mar 13, 2015
    Posts:
    247
    H.264 mp4 is working for me 3840 x 1920 monoscopic 360 video. Not sure about profiles but I go for 10 - 20 Mbps bitrate settings. OES Path was the problem for me when testing but fine otherwise.
     
  46. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    That's too high - maximum is 3840x2160, but recommended is 3840x1920. See Oculus guide here:
    https://developer.oculus.com/docume.../mobile-media-overview/#mobile-media-overview

    Also, if you're doing stereo videos, they don't have to be square. You can have a 3840x1920 stereo video. The video is mapped to geometry so its aspect ratio doesn't matter.

    Thanks,
     
  47. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes....We have some ambisonic support is coming very soon for Android and Windows! Currently it's in Beta..
     
  48. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Which platform is this on?
     
  49. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    Do you know if H.264 is the best codec for something like this on android? Would H.265 be better? Something else? Also do you know if it would be recommended to use side by side or top bottom for a 3840x2160 stereo video?
     
    Last edited: Sep 6, 2017
  50. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    In our experience H.265 works really well on high-end Android devices, so I would recommend that.
    3840x1920 top-bottom would give you 3840x960 per eye
    3840x1920 left-right would give you 1920x1920 per eye
    So it depends whether you value horizontal resolution or vertical resolution..Perhaps left-right would be best, but I'd love to hear someone else's opinion.