AVPro Video User Manual
AVProVideo-UserManual
AVProVideo-UserManual
AVProVideo-UserManual
AVProVideo-UserManual
AVProVideo-UserManual
User Manual: Pdf
Open the PDF directly: View PDF .
Page Count: 52
AVProVideo
forAndroid,iOS,tvOS,OSX,
WindowsDesktop,WindowsPhone*andUWP*
*beta
Unitypluginforfastandflexiblevideoplayback
Version1.3.9
Released15July2016
Contents
1. Introduction
1. Features
2. TrialVersion
3. MediaCredits
2. SystemRequirements
1. Platformsnotsupported
3. Installation
1. PlatformNotes
2. TrialVersion&WatermarkNotes
3. VideoFileLocations
4. StreamingNotes
5. VirtualRealityNotes
6. HapCodecNotes
7. TransparencyNotes
4. QuickStartExamples
1. QuickStartFastestStartforUnityExperts
2. QuickStartFullscreenVideoPlayerusingPrefabs
3. QuickStart3DMeshVideoPlayerExampleusingComponents
5. Usage
1. GettingStarted
2. UnsupportedPlatformFallback
3. Components
i. MediaPlayerComponent
ii. DisplayIMGUIComponent
iii. DisplayuGUIComponent
iv. ApplyToMesh/MaterialComponent
4. Scripting
i. Namespace
ii. MediaPlayerScripting
iii. Events
6. AssetFiles
1. Demos
2. Prefabs
3. Scripts
7. SupportedMediaFormats
1. Android
2. iOS,tvOSandOSX
3. Windows
8. ScriptingReference
9. Support
10. AboutRenderHeadsLtd
AppendixAFAQ
AppendixBVersionHistory
AppendixCRoadmap
2/52
AVProVideo©2016RenderHeadsLtd
1.Introduction
AVPro Video is the newest video plugin from RenderHeads, who previously developed the
AVPro QuickTime and AVPro Windows Media plugins for Unity. In this new generation of
plugins we aim to create an easy to use, crossplatform video playback system that uses the
nativefeaturesofeachplatform.
1.1Features
● VersionsforiOS,tvOS,OSX,Android,Windows,WindowsPhoneandUWP
● OneAPIforvideoplaybackonallsupportedplatforms
● 4Kvideosupport(onsupportedhardware)
● VRsupport(equirectangularandcubemap)
● Fastflexiblevideoplayback
● UnityPro4.6.9and5.xsupported
● Freewatermarkedtrialversionavailable(downloadhere)
● FastnativeDirect3D,OpenGLandMetaltextureupdates
● LinearandGammacolourspacessupported
● Gracefulfallbackineditor
● Unity4.6uGUIsupport
● Easytouse,draganddropcomponents
● StreamingvideofromURL(whensupportedbyplatform)
1.2TrialVersion
WeofferanunlimitedtrialversionofAVProVideofordownloadfromourwebsiteat
http://renderheads.com/product/avprovideo/.Thetrialversionhasnomissingfeaturesor
timerestrictionsbutitdoesapplyawatermarktotherenderedoutput.Thewatermarking
doeshaveasmallperformanceimpactwhichisonlyreallynoticeableonveryhighresolution
videos.InWindowsiftheGPUdecodingpathisusedwhenthewatermarkisn’tdisplayed
insteadeveryfewsecondsthevideosizewillscaledown.
1.3MediaCredits
BigBuckBunny_360p30.mp4(c)copyright2008,BlenderFoundation/
www.bigbuckbunny.org
BigBuckBunny_720p30.mp4(c)copyright2008,BlenderFoundation/
www.bigbuckbunny.org
SampleSphere.mp4(c)copyrightDanielArnett,https://vimeo.com/97887646
3/52
AVProVideo©2016RenderHeadsLtd
2.SystemRequirements
● Unity5.xorUnityPro4.6andabove
● iOS8.1andabove
● tvOS9.0(AppleTV4thGen)andabove
● OSX10.7andabove,64bitonly
● Android4.1(JellyBean,APIlevel16)andabove(ARM7andx86)
● WindowsXPandabove(32bitand64bit)
● Windows8.0andabove(32bitand64bit)
● WindowsPhoneUWP8.1(32bitandARM)
● WindowsDesktopUWP8.1(32bit,64bitandARM)
● UniversalWindowsPlatform10(32bit,64bitandARM)
2.1PlatformsnotSupported
● WebGL*
● WebPlayer
● Linuxdesktop
● GameConsoles(XBox,PS4etc)
*=comingsoon
4/52
AVProVideo©2016RenderHeadsLtd
3.Installation
1. OpenupafreshUnitysession(toclearanylockedpluginfiles)
2. Import the unitypackage file into your Unity project. If prompted to upgrade some
scriptsclickYes.
3.1PlatformNotes
3.1.1Android
● ThispluginrequiresanAPIlevelminimumof16
● Underthehoodwe’reusingtheMediaPlayerAPI
● If you want to support streaming don’t forget to set the “Internet Access” option in
PlayerSettingsto“require”
● ForrenderingwesupportsOpenGLES2.0andOpenGLES3.0
● Multithreadedrenderingissupported
3.1.2iOS/tvOS/MacOSX
● Underthehoodwe’reusingtheAVFoundationAPI
● If you want to support streaming you need to enable HTTP downloads explicitly. For
iOS this is an option in newer versions of Unity, but for Mac OS X and older versions
of Unity you have to do this explicitly by editing the plist file. There are notes below
onhowtodothis.
● ForrenderingonMacOSXwesupportOpenGLLegacyandOpenGLCore
● For rendering on iOS and tvOS we support OpenGL ES 2.0, OpenGL ES 3.0 and
Metal
● Multithreadedrenderingissupported
3.1.3Windows
● Under the hood we’re using the Media Foundation and DirectShow API’s. Media
Foundation is used for Windows 8 and beyond while DirectShow is used as a
fallbackforWindows7andbelow.
● ForrenderingwesupportDirect3D9,Direct3D11andOpenGLLegacy
● Multithreadedrenderingissupported
3.1.4WindowsStore/UWP/Hololens
● ForGPUdecodingaddthislinetoApp.cs:
5/52
AVProVideo©2016RenderHeadsLtd
m_AppCallbacks.AddCommandLineArg("forced3d11nosinglethreaded");
3.2TrialVersion&WatermarkNotes
3.2.1Watermark
Ifyouareusingatrialversionofthepluginthenyouwillseeawatermarkdisplayedoverthe
video.Thewatermarkisintheformofa“RenderHeads”logothatanimatesaroundthe
screen,orathickhorizontalbarthatmovearoundthescreen.
ThefullversionofAVProVideohasnowatermarksforanyplatforms.Ifyouuseoneofthe
platformspecificpackages(egAVProVideoforiOS,orAVProVideoforWindows)thenyou
willnotseethewatermarkontheplatformyoupurchasedfor,butyouwillseethewatermark
ontheotherplatforms.ForexampleifyoupurchasedAVProVideoforiOSthenyouwillstill
seethewatermarkintheUnityeditorasthisisrunningonWindows/OSX,butthevideos
playedbackwhenyoudeploytoyouriOSdevicewillbewatermarkfree.
3.2.2UpdatingfromTrialVersion
Ifyouareupgradingfromthetrialversion,makesureyoudeletetheold/Assets/Plugins
folderasthiscontainsthetrialpluginandcouldconflict.YoumayneedtocloseUnityfirst,
deletethefilesmanuallyandthenrestartUnityandreimportthepackage(becauseUnity
locksnativepluginfilesoncetheyareloaded).
YoucancheckwhichversionyouhaveinstalledbyaddinganMediaPlayercomponentto
yoursceneandclickingonthe‘about’buttonintheInspectorforthatcomponent.The
versionnumberisdisplayedinthisbox.
3.2.3InstallingMultipleAVProPlatformPackages
IfyouhaveinstalledtheiOSpackagethenitwillalsocontainpluginsforalloftheother
platformsbutwiththewatermarkenabled.Thismeansthatifyouthentrytoinstallanother
AVPropackageitmaynotoverridethepluginscorrectly.Hereishowtoresolvethisusing
theiOSandAndroidpackageasexamples:
1. StartUnityfresh
2. ImporttheiOSpackage
3. DeletethePlugins/Androidfolder
a. IfyoualreadyhaveotherAndroidpluginsinstalledthenyoucan’tjustdelete
thewholefolderandmustspecificallydeletetheAVProfiles.Checkthelist
belowfortheAVPronativepluginfiles.
4. ImporttheAndroidpackage
6/52
AVProVideo©2016RenderHeadsLtd
Similaroperationworksforotherpackagecombinations.
Listofnativepluginfiles:
● Plugins/Android/AVProVideo.jar
● Plugins/Android/libs/armeabiv7a/libAVProLocal.so
● Plugins/Android/libs/x86/libAVProLocal.so
● Plugins/AVProVideo.bundle
● Plugins/iOS/libAVProVideoiOS.a
● Plugins/tvOS/libAVProVideotvOS.a
● Plugins/WSA/PhoneSDK81/ARM/AVProVideo.dll
● Plugins/WSA/PhoneSDK81/x86/AVProVideo.dll
● Plugins/WSA/SDK81/ARM/AVProVideo.dll
● Plugins/WSA/SDK81/x86/AVProVideo.dll
● Plugins/WSA/SDK81/x86_64/AVProVideo.dll
● Plugins/WSA/UWP/ARM/AVProVideo.dll
● Plugins/WSA/UWP/x86/AVProVideo.dll
● Plugins/WSA/UWP/x86_64/AVProVideo.dll
● Plugins/x86/AVProVideo.dll
● Plugins/x86_64/AVProVideo.dll
3.3VideoFileLocation
Videofilescanbeplayedinalmostanylocation,howeverwerecommendplacingvideofiles
inthe/Assets/StreamingAssets/folderinyourUnityprojectasthisistheeasiestfolderto
getstartedwith.StreamingAssetsisaspecialfolderthatUnitycopiestothebuildwithout
processing.Filescopiedelsewherewillrequiremanualcopyingtothebuildlocation.
TheMediaPlayercomponentallowsyoutobrowseforvideofilesandspecifythemrelativeto
aparentfolder:
TheVideoLocationfieldspecifiesthemasterlocationofthevideofilewhiletheVideoPath
fieldspecifieswheretolocatethefilerelativetotheLocation.
7/52
AVProVideo©2016RenderHeadsLtd
Forexampleifyourfileisstoredin“Assets/StreamingAssets/video.mp4”youwouldsetthe
Locationto“RelativeToStreamingAssetsFolder”andsettheVideoPathto“video.mp4”.
Subfoldersarealsosupportedsoavideolocatedat
“Assets/StreamingAssets/myfolder/video.mp4”wouldhaveit’sVideoPathsetto
“myfolder/video.mp4”.
Youcanalsospecifyabsolutepaths,URLsorpathsrelativetootherlocations:
3.3.1RelativeToStreamingAssetsFolder
Thisisthebestandmostcommonlocationforvideofiles.Thisfolderislocatedat
“Assets/StreamingAssets/”andyoumustcreateitifitdoesn’texist.Filescopiedtothis
folderwillnotbeimportedorprocessedbyUnitybuttheywillbecopiedwiththebuild
automatically.
3.3.2AbsolutePathorURL
HereyoucanspecifyafullURLorabsolutepathtothevideofile.AURLcouldbeinthe
form“http://myserver.com/myvideo.mp4”or“rtsp://myserver.com:8080/mystream.rtsp”
dependingontheplatformsupportandstreamingserviceused.
Anabsolutepathwouldlooklike:
● C:/MyFolder/AnotherFolder/MyVideo.mp4(Windows)
● /Users/Mike/downloads/MyVideo.mp4(Mac/Linux)
● /Storage/SD/Videos/MyVideo.mp4(AndroidexternalSDCARD)
●/Storage/emulated/0/MyFolder/MyVideo.mp4(Androidlocalfilesystem)
Usingabsolutepathscanbeusefulfortestingbutisn’tusefulwhendeployingtoother
machinesthatdon’tnecessarilyhavethesamefilestructure.
3.3.3RelativeToProjectFolder
TheprojectfolderisthefolderofyourUnityproject,sothefoldercontainingtheAssets,
LibraryandProjectSettingssubfolders.Specifyingfilesrelativetotheprojectfoldercanbe
usefulwhenyoudon’twanttoincludethevideofilesinyourUnityAssetsfolderbutwantto
keepthemwithintheprojectfolderstructure.Oftenmakingasubfoldercalled“Videos”is
useful.Onepossibleproblemofusingthislocationisthatwhenmakingabuildyourvideo
fileswillnotbecopiedautomaticallytothebuilddestinationsotheyrequiremanualcopying.
Forbuildsthisfoldershouldbelocated:
● WindowsatthesamelevelasyourEXE
● MacatthesamelevelastheContentsfolderinyourappbundle
● iOSatthesamelevelastheAppName.app/Datafolder
● AndroidnotaccessibleduetoAPKpackagingunlessyoubuildtheAPKmanually.
8/52
AVProVideo©2016RenderHeadsLtd
3.3.4RelativeToDataFolder
ThedatafolderisspecifiedbyUnityhere:
http://docs.unity3d.com/ScriptReference/ApplicationdataPath.html
Itisn’tthatusefultoputvideofilesintothisfolderdirectlyastheywouldthenbeprocessed
byUnityintoMovieTexture’sandwillbloatyourprojectsize.IfyouwanttostopUnity
processingthevideofilessimplyrenametheextensiontosomethingUnitydoesn’t
understand,so“myvideo.mp4”couldberenamedto“myvideo.mp4.bin”.Fileswithinthe
datafolder(Assetsfolderintheeditor)arenotcopiedautomaticallytobuildssoyouwould
havetomanuallycopythem.
3.3.5RelativetoPersistentDataFolder
ThepersistentdatafolderisspecifiedbyUnityhere:
http://docs.unity3d.com/ScriptReference/ApplicationpersistentDataPath.html
9/52
AVProVideo©2016RenderHeadsLtd
3.4StreamingNotes
AVProVideosupportsseveralstreamingprotocoldependingontheplatform:
HTTPProgressive
Streaming
HLS
RTSP
Windows
Desktop
Yes
No
OnlywithASF
stream
MacOSX
Yes
Yes
No
iOS
Yes
Yes
No
tvOS
Yes
Yes
No
Android
Yes
Yes,butbetteron
newerversions
Yes
HTTPProgressiveStreaming
WhenencodingMP4videosforstreamingmakesuretheyareencodedwiththevideo
headerdataatthebeginningofthefile.Younormallydothisbyselecting“FastStart”in
QuickTimeencoder,orusethe“movflagsfaststart”inFFMPEG,Otherencoderswillhavea
similaroption.ToprepareanMP4forstreamingusingFFMPEGyoucanusethefollowing
command:
ffmpegi%1acodeccopyvcodeccopymovflagsfaststart%1streaming.mp4
IfyouarestreamingvideosfromVIMEOasMP4thenyoushouldnotethatyoucanreplace
the“.mp4”partintheURLwith“.m3u8”toinsteadmakeitanHLSstream.Thismaybe
particularlyusefulifyouaredevelopingappsfortheApple’sAppStoreasyouwouldneedto
useHLSstreamingtopasscertification(asforApril2016).
3.4.1OSX,iOSandtvOSStreaming
ThisplatformsupportsstreamingofHLSstreamswhichtypicallyendwiththem3uorm3u8
extension.
IfyouhaveanHTTPSURLitshouldworkfinebecauseAppletruststhesecureconnection.
IfyoucanonlyuseHTTPthenyouapphastohaveaspecialflagsettoletituseHTTP
10/52
AVProVideo©2016RenderHeadsLtd
connections(thisisasecurityissueforApple).
ThissettingisexposedintheUnityPlayerSettingshereforiOSandtvOS:
ThesettingisalsoexposedinthescriptingAPIhere:
http://docs.unity3d.com/ScriptReference/PlayerSettings.iOSallowHTTPDownload.html
IfforsomereasonyourversionofUnitydoesn’texposethisthenyouwillhavetoaddit
manually.IntheUnityeditoryouneedtoedit"Unity.app/Contents/Info.plist"andinyourbuilt
applicationyouwouldneedtoedit"your.app/Contents/Info.plist".Thesefilesneedtohave
thesekeysadded:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Youcanfindmoreinformationaboutthishere:
http://ste.vn/2015/06/10/configuringapptransportsecurityios9osx1011/
We’vealsoincludedapostprocessbuildscriptcalled“PostProcessBuild.cs”intheproject
whicheditstheplistandaddsthisattribute.Currentlyit’sonlysetforiOSbutyoucanedit
the#defineatthetoptoallowMacOSXtoo.
3.4.2AndroidStreaming
RequirestheInternetAccesssetting(inPlayerSettings)tobesettoRequired
.
11/52
AVProVideo©2016RenderHeadsLtd
3.4.3TestStreams
Wefoundthesestreamshandyfortesting(noguaranteethatthey’restillworking):
● StreamingMP4
○ http://downloads.renderheads.com/2016/BigBuckBunny_360p30_Streaming.
mp4
● HLS
○ http://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov/playlist.m3u8
○ http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/sl.m3u8
● RTSP
○ rtsp://rtmp.infomaniak.ch/livecast/latele
3.5Augmented/VirtualRealityNotes
SofarwehavetestedAVProVideowith:
● OculusRift
● GoogleCardboard
● GearVR
● HTCVive
● MicrosoftHololens
VRisstillverynewandyoushouldalwayscheckforthelatestrecommendedinstallation
stepswhencreatingyourproject.Wefoundalotofoutofdatesetupinstructionsonthe
net.
AVProVideosupports4KMP4playbackforcreating360degreeexperiences.Stereo4K
videosinbothtopbottomandsidebysideformatsarealsosupported.
SeetheFAQfortipstoachievehighresolutionvideoplaybackforVR.
Reducingthecomplexityoftheencodedvideowillgivethedecodingengineamucheasier
timeandcouldresultinhigherframesratesandlowerCPU/GPUusage.Possibleencoding
tweaksinclude:
● Usethelowestprofilelevelpossible
● Don’tusetoomanyreferenceframes
● Don’tusetoomanybframes
● DisableCABAC
3.5.1StereoVR
AVPro Video supports stereoscopic videos in the topbottom and leftright formats. You can
12/52
AVProVideo©2016RenderHeadsLtd
setthestereopackingformatofyourvideointheMediaPropertiespanel:
NowwhenusingtheInsideSphereshaderonameshitwillautomaticallymaptherightpart
ofthevideotoeacheye.Seethe“Demo_360SphereVideo”sceneforanexampleofhow
thisworks.
Theincludedshader“InsideSphere.shader”allowsyoutoeasilysetwhatformatyourvideo
isinviaadropdowninthematerial:
Select“StereoDebugTinting”tocolourtheleftandrighteyesdifferentcolourssoyoucanbe
surethestereoisworking.
NOTE:Besuretoaddthe"UpdateStereoMaterial”componentscripttoyourscenewhen
usingthismaterialwhenusingUnity5.3orbeloworUnity5.4andabovewithouttheSingle
PassVRoptionenabled.OftenstereoVRrequires2cameras,eachsettoadifferentlayer
maskand2spheresalsosettoadifferentmask.AVProVideodoesn’trequirethisandjust
usesyournormalsinglecameraandsinglesphere.
3.5.2VRAudio
SomeVRsystemssuchastheOculusRifthavetheirownaudiooutputdevice.AVPro
Videohasanoption“ForceAudioOutputDevice”forWindows(currentinDirectShowplayer
modeonly)thatallowsyoutospecifythenameofthisaudiodevice:
13/52
AVProVideo©2016RenderHeadsLtd
The device name to use can be retrieved from the VR API or hard coded. For Oculus Rift
thenameisusually“RiftAudio”andforHTCViveitis“HTCVIVEUSBAudio”.
3.6HapCodecNotes
TheHapcodecisnativelysupportedandgivesextremelylowCPUusageforextremelyhigh
resolutionvideos.AVIandMOVcontainerscanbothbeused.Hapisonlysupportedon
WindowsandMacOSXplatforms.
3.6.1WindowsSupport
CurrentlyonlytheHapandHapAlphavariantsofHaparesupportedforWindowswithHapQ
andHapQwithAlphacominginthefuture.Hapcurrentlyrequiresthe“ForceDirectShow”
optiontobeselected:
3.6.2MacOSXSupport
Hap,HapAlphaandHapQaresupported.
3.7TransparencyNotes
Not many video codecs have native support for transparency / alpha channels. Formats
supportedbysomeplatformsofAVProVideoare:
● HapAlpha
○ Great support on Windows and Mac OS X. Fast and low overhead format,
though file size can get large depending on the content. Currently this is the
formatwerecommendfortransparentvideo.
● UncompressedRGBA
● UncompressedYUVA
○ Uncompressed isn’t ideal for file size or disk bandwidth but can still be used
asafallback
● ProRes4444
○ BestsupportisonMacOSX.Filesarehuge.
14/52
AVProVideo©2016RenderHeadsLtd
● VP6
○ Legacy format. We support it only via 3rd party DirectShow plugins for
Windows(egLAVFilters)
4.QuickStartExamples
4.1QuickStart:FastestStartforUnityExperts
1. PutvideofilesintheStreamingAssetsfolder
2. UsetheMediaPlayerscripttoplayyourvideo(setVideoPathtothefilenameofyour
videofile).
3. Useoneofthedisplayscriptstodisplayyourvideo(egDisplayIMGUI,DisplayUGUI,
ApplytoMaterial)
4.2QuickStart:FullscreenVideoPlayerusingPrefabs
AVProVideoincludesanumberofexampleprefabsyoucanusetoeasilyaddvideo
playbacktoyourproject.Thefollowingstepswillcreateanapplicationthatplaysbacka
fullscreenvideo:
1. CreateanewUnityproject
2. ImporttheAVProVideopackage
3. FromtheAVPro/PrefabsfolderintheProjectwindow,dragtheFullscreenVideo
prefabtoyourHierarchywindow
15/52
AVProVideo©2016RenderHeadsLtd
4. CreateafoldercalledStreamingAssetsinyourProjectwindowandcopyyourvideo
file(sayMP4file)intothatfolder
5. Enterthefilename(includingextension)intotheVideoPathfieldintheMediaPlayer
component(egmyvideo.mp4)
6. Buildanddeployyourapplication,thevideowillbedisplayedfullscreen
TheDisplayIMGUIcomponentscriptisjustoneofthecomponentsfordisplayingvideo.It
usesthelegacyUnityIMGUIsystemwhichalwaysrendersontopofeverythingelse.Try
usingtheDisplayBackgroundorDisplayUGUIcomponentsformorecontrolifyoudon’twant
yourvideotobeontop.
4.3QuickStart:3DMeshVideoPlayerusingComponents
AVProVideoincludesanumberofeasytousescriptcomponentsyoucanaddtoyour
scene.Inthisexampleweshowhowtousethecomponentstoplayavideoontoamaterial
whichisappliedtoa3Dmodelinthescene.
1. CreateanewUnityproject
2. ImporttheAVProVideopackage
3. CreateanewGameObjectfromthe“GameObject>AVProVideo>MediaPlayer”
menucommand
4. Clickthe“AddComponent”buttonandadd“AVProVideo>ApplyToMesh”
16/52
AVProVideo©2016RenderHeadsLtd
5. DragtheMediaPlayerscripttothe“Media”fieldintheApplyToMeshscript,thistells
theApplytoMeshscriptwhichmediaplayertouse
6. Createasphereviathe“GameObject>3DObject>Sphere”menucommand
7. DragtheMeshRenderercomponenttothe“Mesh”fieldintheApplyToMeshscript,
thistellstheApplytoMeshscriptwhichmeshtouse
8. CreateafoldercalledStreamingAssetsinyourProjectwindowandcopyyourvideo
file(sayMP4file)intothatfolder
9. Enterthefilename(includingextension)intotheVideoPathfieldintheMediaPlayer
component(egmyvideo.mp4)
10. Buildanddeployyourapplication,thevideowillbedisplayedonyour3Dsphere
17/52
AVProVideo©2016RenderHeadsLtd
5.Usage
5.1GettingStarted
Theeasiestwaytogetstartedistolookattheincludeddemosandseewhatscript
componentshavebeenused.Forvideoplaybackyouneed3thingsinyourscene:
1. Thevideofiletoplay:
Createa“StreamingAssets”folderinyourProjectwindow
Copyyourvideofile(usuallyMP4file,butconsultthelistofsupportedformatsfor
yourplatformbelow)totheStreamingAssetsfolder
2. AMediaPlayerscripttoloadandplaythevideo:
CreateaGameObjectandaddtheMediaPlayerscripttoit
SettheVideoPathfieldtothenameofyourvideofile(e.g.myvideo.mp4)
3. Ascripttodisplaythevideo:
Decidehowandwhereyouwantyourvideofiletoappear.Thereareanumberof
differentdisplaycomponentscriptsincludedfordifferentusagescenarios.Ifyou
wanttodisplaythevideoontopofeverythinginyourscenejustaddthe
DisplayIMGUIscripttoaGameObjectinyoursceneandsettheMediaPlayerfield
yourMediaPlayercomponent.Otherdisplaycomponentsworksimilarly.
5.2UnsupportedPlatformFallback
AVProVideoisdesignedtostillfunctionevenonplatformsthataren’tnativelysupported.
Insteadofdisplayingtheactualvideothough,adummy10secondlong“AVPro”visualis
shown.Allofthevideocontrolsshouldstillwork.Forexampleifyouarerunningyoureditor
inLinuxthedummyvideoplayerwillappearintheeditorandtherealvideowillappearwhen
youdeploytosupportedplatforms.Ifyoudeploytoanunsupportedplatformsuchas
SamsungTVyouwillalsoseethedummyvideoplayer.Thecodeiseasilyextendableto
addcustomvideoplayersforanyunsupportedplatform.
5.3.Components
Includedareanumberofcomponentstomakethisasseteasytouse.Thecomponentsare
locatedintheAVProVideo/Scripts/Componentsfolderoryoucanaddthemfromthe
Componentsmenu:
18/52
AVProVideo©2016RenderHeadsLtd
5.3.1MediaPlayerComponent
Thisisthecorecomponentforplayingmedia.Thiscomponentonlyhandlestheloadingand
playbackofmediaanddoesn’thandlehowitisdisplayed.Usethedisplayscript
componentstocontrolhowandwherethevideoisdisplayed.Fieldsare:
19/52
AVProVideo©2016RenderHeadsLtd
● VideoLocation
○ WheretolookforthefilespecifiedintheVideoPathbelow.Thiscanbean
absolutepath/URL,orrelativetooneoftheUnityfolders.The
StreamingAssetsfolderistheeasiesttouse.Optionsare:
■ AbsoluteorURL
● Thisisanabsolutepathonyourdevice,oranhttpURL
■ RelativetoProjectFolder
● TherootfolderisthefolderaboveyourAssetsfolder
■ RelativetoStreamingAssetsFolder
● Therootfolderis/Assets/StreamingAssets
■ RelativetoDataFolder
● Therootfolderis/Assets
● Unitymanualhasmoreinformation:
http://docs.unity3d.com/ScriptReference/ApplicationdataPath.
html
■ RelativetoPersistentDataFolder
● Unitymanualhasmoreinformation:
http://docs.unity3d.com/ScriptReference/Applicationpersistent
DataPath.html
● VideoPath
○ ThefilepathtothevideointheStreamingAssetsfolder(e.g.myvideo.mp4or
AndroidVideos/myvideo.mp4ifyouwanttouseasubfolder)
● AutoOpen
○ Whethertoopenthefilewhenthiscomponentisenabled/starts
● AutoStart
○ Whethertoplaythevideoonceavideoisopened
● Loop
○ Whethertoloopthevideo
● PlaybackRate
○ Setsamultiplierthataffectsvideoplaybackspeed
○ NotsupportedonAndroid
● Volume
○ 0..1rangeforaudiovolume
● Muted
○ Whethertheaudioismuted
● Persistent
○ AppliesDontDestroyOnLoadtotheobjectsothatitsurvivesscene/levelloads
● DebugGui
○ Whethertodisplayanoverlaywithstatisticsonthevideoplaybackusefulfor
debugging
● Events
○ Thiseventcanbehookeduptoscriptingfunctionswhichwillgetcalledwhen
anonloopingvideocompletesplayback.SeetheEventssectionbelowfor
moredetailsandascriptingexample
● Platformoverrides
20/52
AVProVideo©2016RenderHeadsLtd
○ Theseallowyoutosetadifferentfileperplatform.
5.3.2DisplayIMGUIComponent
Thisisthemostbasiccomponentfordisplayingthevideo.ItusesthelegacyUnityIMGUI
systemtodisplaythevideotothescreen.IMGUIisalwaysrenderedontopofeverything
elseinthescene,soifyourequireyourvideotoberenderedin3Dspaceoraspartofthe
uGUIsystemit’sbettertousetheothercomponents.Fieldsare:
● MediaPlayer
○ Themediaplayertodisplay
● DisplayinEditor
○ Whethertodisplaytherectangleintheeditorusefulfordebugging
● ScaleMode
○ Howtofitthevideotothescreen
● Color
○ Thecolortotintthevideo,includingalphatransparency
● AlphaBlend
○ Whetherthevideotexturecontrolstransparency.Leavingthisoffforopaque
videosisaminoroptimisation
● Depth
○ TheIMGUIdepthtodisplayat.Usethistochangetheorderofrenderingwith
otherIMGUIscripts
● FullScreen
○ WhethertoignoretheX,Y,Width,Heightvaluesandjustusethewhole
screen
● X
○ Thenormalised(0..1)xposition
21/52
AVProVideo©2016RenderHeadsLtd
● Y
○ Thenormalised(0..1)yposition
● Width
○ Thenormalised(0..1)width
● Height
○ Thenormalised(0..1)height
5.3.3DisplayuGUIComponent
ThiscomponentisusedtodisplayavideousingUnity’suGUIsystem.Fieldare:
● MediaPlayer
○ Themediaplayertodisplay
● DefaultTexture(optional)
○ Atexturetodisplaywhilethevideoisn’tplaying(whileitisbufferingfor
example).
● NoDefaultDisplay
○ Willnotshowanythinguntilthereareframesavailable
● Color
○ Thecolortotint,includingalphatransparency
● Material
○ StandarduGUIfield
● UVRect
○ StandarduGUIfield
● SetNativeSize
○ WhenthevideoloadswillresizetheRectTransformtothepixeldimensionsof
thevideo
● KeepAspectRatio
○ Whethertokeepthecorrectaspectratioorstretchtofill
5.3.4ApplyToMeshComponent
22/52
AVProVideo©2016RenderHeadsLtd
ThiscomponenttakesthetexturegeneratedbytheMediaPlayercomponentandassigsitto
thetextureslotofthematerialona3DMesh.Thisisusefulforplayingvideoson3D
meshes.Fieldare:
● Mesh
○ Themesh(renderer)toapplythetextureto
● Media
○ Themediaplayer
● DefaultTexture(optional)
○ Atexturetodisplaywhilethevideoisn’tplaying(whileitisbufferingfor
example).
5.3.5ApplyToMaterialComponent
ThiscomponenttakesthetexturegeneratedbytheMediaPlayercomponentandassignsit
toatextureslotinaMaterial.Thisisusefulforplayingvideoson3Dmeshes.Fieldsare:
● Material
○ Thematerialtoapplythetextureto
● TexturePropertyName(optional)
○ Bydefaultthisscriptassignstothemaintexture(_MainTex)butifyouwantto
assigntoanotherslotyoucanputthenameinhere
● Media
○ Themediaplayer
● DefaultTexture(optional)
○ Atexturetodisplaywhilethevideoisn’tplaying(whileitisbufferingfor
example).
23/52
AVProVideo©2016RenderHeadsLtd
24/52
AVProVideo©2016RenderHeadsLtd
5.4Scripting
5.4.1Namespace
AllscriptsusethenamespaceRenderHeads.Media.AVProVideosobesuretoadd“using
RenderHeads.Media.AVProVideo”tothetopofyoursourcefiles.
5.4.2MediaPlayerScripting
MostscriptingislikelytocenteraroundtheMediaPlayer.csscript.Thisscripthandlesthe
loading,playbackandupdatingofvideos.Thescriptexposesanumberofinterfacesrelated
todifferentusecasesandcanbefoundinInterfaces.cs
MediaPlayerexposes3maininterfaces:
● InfoInterface
○ TheIMediaInfointerfaceisexposedbytheInfoproperty
○ Thisinterfaceisusedtoaccessinformationaboutthemedia,eg:
MediaPlayermp;
mp.Info.GetVideoWidth();
● ControlInterface
○ TheIMediaControlinterfaceisexposedbytheControlproperty
○ Thisinterfaceisusedtocontrolplayback,eg:
MediaPlayermp;
mp.Control.Pause();
● TextureProducerinterface
○ TheIMediaProducerinterfaceisexposedbytheTextureProducerproperty
○ Thisinterfaceisusedtogetinformationabouthowtodisplaythecurrent
textureandisusedbytheDisplaycomponents,eg:
MediaPlayermp;
TexturevideoTexture=mp.TextureProducer.GetTexture();
TheMediaPlayerscriptalsohasanumberofmethodsforcontrollingloadingofmedia:
● OpenVideoFromFile()
○ Loadsthevideospecified.Usefulifyouneedmanualcontroloverwhenthe
videoisloaded
● CloseVideo()
○ Closesthevideo,freeingmemory
25/52
AVProVideo©2016RenderHeadsLtd
5.4.3Events
MediaPlayercurrentlyhastheseevents:
● MetaDataReadyCalledwhenthewidth,height,durationetcdataisavailable
● ReadyToPlayCalledwhenthevideoisloadedandreadytoplay
● StartedCalledwhentheplaybackstarts
● FirstFrameReadyCalledwhenthefirstframehasbeenrendered
● FinishedPlayingCalledwhenanonloopingvideohasfinishedplaying
Scriptingexample:
//Addtheeventlistener(canalsodothisviatheeditorGUI)
MediaPlayermp;
mp.Events.AddListener(OnVideoEvent);
//Callbackfunctiontohandleevents
publicvoidOnVideoEvent(MediaPlayermp,MediaPlayerEvent.EventTypeet)
{
switch(et)
{
caseMediaPlayerEvent.EventType.ReadyToPlay:
mp.Control.Play();
break;
caseMediaPlayerEvent.EventType.FirstFrameReady:
Debug.Log("Firstframeready");
break;
caseMediaPlayerEvent.EventType.FinishedPlaying:
mp.Control.Rewind();
break;
}
Debug.Log("Event:"+et.ToString());
}
26/52
AVProVideo©2016RenderHeadsLtd
6.AssetFiles
6.1Demos
● Demo_360SphereVideo.unity
○ Democontainsavideoplayerthatplaysa360
degreevideousingequirectangular(latlong)
mapping.
○ Thevideoisappliedtoasphere,insideofwhich
isthemaincamera.
○ Ifthetargetdevicehasagyroscopethenmoving
thedevicearoundwithrotatethecameratoview
thevideofromdifferentangles.Forplatforms
withoutgyroscopethemouse/touchcanbeused
tolookaround.
○ Aspecialshaderandscriptareusedtoallowa
singlecameratorenderinstereoonaVR
headset.Clickonthematerialtosetwhetherit
shoulddisplaythevideoasmonoscopic,stereo
topbottomorstereoleftright.
● Demo_360CubeVideo.unity
○ Sameasthespheredemoabove,butusinga
cubemap3x2layoutsourcevideo.
● Demo_BackgroundShader.unity
○ Basicdemothatplaysavideousingthe
backgroundmaterialwhichallowsthevideoto
appearbehindallcontent.
● Demo_FrameExtract.unity
○ Showsgotoreadframesoutofthevideofor
savingtodisk(jpg/png)oraccessingpixeldata.
● Demo_imGui.unity
○ BasicdemothatplaysavideoandusesthelegacyIMGUIdisplaycomponent
todrawthevideotothescreen.
○ Alsohasanaudiocliptoshowaudioonlymediaplayback.
○ Alsohas3differentstreamingURLstodemonstratestreaming.
○ IMGUIisdrawnontopofallothervisualcomponents.
● Demo_Mapping3D.unity
○ Democontainingavideoplayeranda3Dscene
○ Someofthe3Dmodelshavethevideomappedtothemviathe
ApplyToMaterialscript
● Demo_Multiple.unity
○ Thisdemoallowsyoutoprogrammaticallymultipleloadvideosandtest
multiplevideosplayingatonce.DisplayisviatheAVProVideouGUI
component
● Demo_uGUI.unity
○ ThisdemoshowshowtodisplayvideoswithintheuGUIsystem.Itusesthe
27/52
AVProVideo©2016RenderHeadsLtd
DisplayUGUIcomponentinthecanvashierarchy.
○ Italsousesacustomshadertooverlaytextwithavideotexture.
● Demo_VideoControl.unity
○ Thisdemoshowshowtoquerythevideostateandcontrolplayback
6.2Prefabs
● 360SphereVideo.prefab
○ Prefabcontainingavideoplayerandmappingtoasphere.Usefulfor
playbackofequirectangular360degreevideos
● BackgroundVideo.prefab
○ Prefabcontainingavideoplayerandaquadmodelwithaspecialbackground
materialapplied.Thismaterialmakesthequadgetdrawnbeforeeverything
elsesoitappearsinthebackground.
● FullscreenVideo.prefab
○ PrefabcontrolsavideoplayerandtheIMGUIdisplaycomponentforvery
easybasicvideoplaybackcreation
6.3Scripts
● Components
○ ApplyToMaterial.cs
■ AppliesthetextureproducedbytheMediaPlayercomponenttoaunity
materialtextureslot
○ ApplyToMesh.cs
■ AppliesthetextureproducedbytheMediaPlayercomponenttoa
Untiymesh(viaMeshRenderer)bysettingthemainTexturefieldofall
itsmaterials
○ DisplayBackground.cs
■ DisplaysthetextureproducedbytheMediaPlayercomponentbehind
allothercontent(notcompatiblewithSkyBox)
○ DisplayIMGUI.cs
■ DisplaysthetextureproducedbytheMediaPlayercomponentusing
Unity’slegacyIMGUIsystem
○ DisplayUGUI.cs
■ DisplaysthetextureproducedbytheMediaPlayercomponentusing
Unity’snewuGUIsystem
○ MediaPlayer.cs
■ Themainscriptforloadingandcontrollinganinstanceofvideo
playback
○ UpdateStereoMaterial.cs
■ AhelperscriptforVRstereorenderingtoupdatethecameraposition
variableinasphericalmaterialtohelpworkoutwhicheyetorender
○ ApplyToTextureWidgetNGUI.cs
■ AppliesthetextureproducedbytheMediaPlayercomponenttoan
NGUITexturewidgettextureslot
28/52
AVProVideo©2016RenderHeadsLtd
● Editor
○ DisplayUGUIEditor.cs
■ TheeditorscriptthatcontrolshowtheDisplayUGUIcomponentis
renderedintheInspector
○ MediaPlayerEditor.cs
■ TheeditorscriptthatcontrolsoftheMediaPlayercomponentis
renderedintheInspector
● Internal
○ AndroidMediaPlayer.cs
■ Androidspecificmediaplayer
○ BaseMediaPlayer.cs
■ Commonbaseclassforallplatformmediaplayers
○ Interfaces.cs
■ Interfacesandevents
○ NullMediaPlayer.cs
■ Thefallbackdummymediaplayerforunsupportedplatforms
○ OSXMediaPlayer.cs
■ iOSandOSXspecificmediaplayer
○ WindowsMediaPlayer.cs
■ Windowsspecificmediaplayer
29/52
AVProVideo©2016RenderHeadsLtd
7.ScriptingReference
AVProVideoisdesignedtobeusedmainlywiththesupplieddraganddropcomponentbut
therearealwaystimeswhenabitofscriptingisneeded.Theassetincludessamplescenes
whichgivesomeexamplesofhowtousescriptingtocontrolvideoplayback,applyvideo
texturestomaterialsetcwhichareusefultolearnfrom.Thefullclassreferenceisavailable
onlinehere:
http://downloads.renderheads.com/docs/AVProVideoClassReference/
Inthisdocumentwehaveincludedasimplifiedversionofthehighlights.
MediaPlayerclass
TheMediaPlayerclassisthemainclassforvideoplaybackandiswherevideofilesare
specifiedandcontrolled.ThisclassismainlycontrolledviatheUnityInspectorUIandfor
scriptingthroughtheinterfacepropertiesitexposes.
Properties
● Events
○ returnstheMediaPlayerEventclass
● Info
○ returnstheIMediaInfointerface
● Control
○ returnstheIMediaControlinterface
● TextureProducer
○ returnstheIMediaProducerinterface
Methods
Allofthesemethodsusetheinterfacesexposedaboveandarejusthandyshortcuts
● voidOpenVideoFromFile(FileLocationlocation,stringpath,boolautoPlay)
○ Opensthevideospecified
● voidCloseVideo()
○ Closesthecurrentvideoandfreesupallocatedmemory
● voidPlay()
○ Startsplaybackofthevideo
● voidPause()
○ Pausesthevideo
● voidStop()
○ Pausesthevideo
● voidRewind(boolpause)
○ Rewindsthevideowithanoptiontopauseitaswell
● Texture2DExtractFrame(Texture2Dtarget,floattimeSeconds,inttimeoutMs)
30/52
AVProVideo©2016RenderHeadsLtd
○ Extractsaframefromthespecifiedtimeofthecurrentvideoasareadable
Texture2D.Thiscanthenbeusedtosaveoutthepixeldata.Thetexture
mustbedestroyedbytheuser.Thetexturecanbepassedinagainviathe
“target”parametertoreuseit.
IMediaInfointerface
Thisinterfaceisusedtoquerypropertiesofthevideo
Methods
● floatGetDurationMs();
○ Returnsthedurationofthevideoinmilliseconds
● intGetVideoWidth();
○ Returnsthewidthofthevideoinpixels
● intGetVideoHeight();
○ Returnstheheightofthevideoinpixels
IMediaControlinterface
Thisinterfaceisusedtocontrolloadingandplaybackofthevideo
Methods
● boolOpenVideoFromFile(stringpath);
○ StartsloadingthefilefromthespecifiedpathorURL.Returnsfalseifany
errorwasencountered.Thisfunctionisasynchronoussothevideoproperties
willnotbeavailableimmediately.Thisfunctionshouldn’tbeused,instead
usetheMediaPlayerOpenVideoFromFilefunction.
● voidCloseVideo();
○ Closesthevideoandanyresourcesallocated
● voidSetLooping(boollooping);
○ Setswhethertheplaybackshouldloopornot.Thiscanbechangedwhilethe
videoisplaying.
● boolCanPlay();
○ Returnswhetherthevideoisinaplaybackstate.Sometimesvideoscantake
afewframesbeforetheyarereadytoplay.
● voidPlay();
○ Startsplaybackofthevideo
● voidPause();
○ Pausethevideo
● voidStop();
○ Stopsthevideo(essentiallythesameasPause)
● boolIsPlaying();
31/52
AVProVideo©2016RenderHeadsLtd
○ Returnswhetherthevideoiscurrentlyplaying
● boolIsPaused();
○ Returnswhetherthevideoiscurrentlypaused
● boolIsFinished();
○ Returnswhetherthevideohascompletedplayback
● boolIsBuffering();
○ Returnswhetherastreamingvideohasstoppedandisbuffering.Abuffering
videowillresumeafterithasdownloadedenoughdata.
● voidRewind();
○ Setsthecurrenttimetothebeginningofthevideo
● voidSeek(floattimeMs);
○ Setsthecurrenttimetoaspecifiedvalueinmilliseconds
● voidSeekFast(floattimeMs);
○ Setsthecurrenttimetoaspecifiedvalueinmillisecondsbutsacrifices
accuracyforspeed.Thisisusefulifyoujustwanttojumpforward/backina
videobutyoudon’tcareabouttheaccuracy.
● boolIsSeeking();
○ Returnswhetherthevideoiscurrentlyseeking.Duringseekingnonew
framesareproduced.
● floatGetCurrentTimeMs();
○ Returnsthecurrenttime(playbackposition)inmilliseconds
● voidSetPlaybackRate(floatrate);
○ Setsthecurrentplaybackrate.1.0fisnormalrate.Negativeratesaren’t
supportedonallplatforms.
● floatGetPlaybackRate()
○ Returnsthecurrentplaybackrate
● voidMuteAudio(boolmute)
○ Setstheaudiomuteornot
● voidSetVolume(floatvolume)
○ Setsthevolumebetween0.0and1.0
● floatGetVolume()
○ Returnsthevolumelevelbetween0.0and1.0
IMediaProducerinterface
Methods
● TextureGetTexture();
○ ReturnsaUnityTextureobjectifthereisatextureavailableotherwisenullis
returned.
● intGetTextureFrameCount();
○ Returnsthenumberoftimesthetexturehasbeenupdatedbytheplugin.
Thiscanbeusefultoknowwhenthetexturewasupdatedasthevaluewill
incrementeachtime.
● boolRequiresVerticalFlip();
32/52
AVProVideo©2016RenderHeadsLtd
○ Sometexturesaredecodedupsidedownandneedtobeverticallyflipped
whendisplayed.Thismethodreturnswhetherthetextureneedstobeflipped
duringdisplay.
33/52
AVProVideo©2016RenderHeadsLtd
8.SupportedMediaFormats
IngeneralthemostcommonformatthatissupportedareMP4fileswithH.264encodingfor
videoandAACencodingforaudio.Thisformatissupportedacrossallplatformsthoughnot
necessarilyallbitratesandprofiles.
Containersupport:
Windows
Desktop
MacOSX
Desktop
iOS,tvOS
Android
MOV
Yes
Yes
Yes
Yes
MP4
Yes
Yes
Yes
Yes
AVI
Yes
?
?
?
MKV
YesinWindows
10
?
?
?
Webm
No
No
No
Yes
ASF/WMV
Yes
No
No
No
MP3
Yes
Yes
Yes
Yes
WAV
Yes
?
?
?
AudioCodecsupport:
Windows
Desktop
MacOSX
Desktop
iOS,tvOS
Android
MP3
Yes
Yes
Yes
Yes
FLAC
YesinWindows
10
No
No
Yes
AAC
Yes
Yes
Yes
Yes
AC3
Yes
Yes
?
?
WMA
Yes
No
No
No
MIDI
Yes
?
?
?
ALAC
No
Yes
Yes
No
34/52
AVProVideo©2016RenderHeadsLtd
µLAW
Yes
Yes
Yes
No
ADPCM
Yes
Yes
Yes
No
LinearPCM
Yes
Yes
Yes
Yss
VideoCodecsupport:
Windows
Desktop
MacOSX
Desktop
iOS,tvOS
Android
HEVC/H.265
YesinWindows
10
Notyet**
Notyet**
Yes
H.264
Yes
Yes
Yes
Yes
H.263
Yes
?
?
Yes
MJPEG
Yes
No
No
No
WMV
Yes
No
No
No
VP8
Yeswithcodec*
No
No
Yes
VP9
Yeswithcodec*
No
No
Yes
Hap
Yes***
Yes
No
No
HapAlpha
Yes***
Yes
No
No
HapQ
Notyet
Yes
No
No
ProRes422
No
Yes
No
No
ProRes4444
No
Yes
No
No
DV
Yes
Yesin
Yosemite
andabove
No
No
UncompressedRGBA
Yes
?
?
?
UncompressedR10K
No
Yesin
Yosemite
andabove
No
No
UncompressedV210
?
Yesin
Yosemite
andabove
No
No
35/52
AVProVideo©2016RenderHeadsLtd
Uncompressed2VUY
?
Yesin
Yosemite
andabove
No
No
*TheVP8/VP9WindowsMediaFoundationcodeccanbedownloadedat
http://www.webmproject.org/ie/
**ApparentlyApplewillreleasesupportsoon
***Requiresoption“ForceDirectShow”tobeticked
Cellswith“?”areone’swe’renotsureabout.Wewilldomoretestingandcontinueto
updatethistable.Formoredetailsonwhichcodecsandwhattypeofencodingisbest,see
theperplatformdetailsbelow.
8.1Android
Androidsupportsmanymediaformats.ForacompletelistchecktheAndroiddocumentation
here:http://developer.android.com/intl/ko/guide/appendix/mediaformats.html
ThefollowingtableshowsthecapabilitiesofsomeAndroiddevicesandcanbeusedasa
guidetocheckforsupportedvideoformats.
Device
MaxTextureSize
GoogleGalaxyNexus
2048
GoogleNexusOne
1024/2048/4096
GoogleNexusS
2048
HTCOneS
4096
LGP880
2048
MotorolaXoom
2048
SamsungGalaxyNote4
8192(GL3.0)/16384(GL3.1)
SamsungGalaxyTab
2048
SamsungOmnia2
2048
SamsungOmniaHD
2048
SonyEricssonXperiaArc
4096
SonyEricssonXperiaPlay
4096
SonyEricssonXperiaS
4096
36/52
AVProVideo©2016RenderHeadsLtd
TMobileG1
1024
8.2iOS,tvOSandOSX
ManymediaformatsaresupportedoniOSincludingH.264.Foracompletelistcheckthe
iOSdocumentationhere:
https://developer.apple.com/library/ios/documentation/Miscellaneous/Conceptual/iPhoneOS
TechOverview/MediaLayer/MediaLayer.html
ThefollowingtableshowsthecapabilitiesofsomeiOSdevicesandcanbeusedasaguide
tocheckforsupportedvideoformats.
Device
MaxTextureSize
AppleiPad3
4096
AppleiPad2
2048/4096(newermodel?)
AppleiPad
2048
AppleiPhone5
4096
AppleiPhone4S
4096
AppleiPhone4
2048
AppleiPhone3GS
2048
AppleiPhone3G
1024
AppleiPhone
1024
InOSX,ProRes422andProRes4444aresupported.
OSXYosemiteandabove,supportsthefollowingadditionalformats:
● DV
● UncompressedR10k
● Uncompressedv210
● Uncompressed2vuy
8.3Windows
37/52
AVProVideo©2016RenderHeadsLtd
Afulllistofsupportedformatscanbefoundhere:
https://msdn.microsoft.com/enus/library/windows/desktop/dd757927(v=vs.85).aspx
https://msdn.microsoft.com/enus/windows/uwp/audiovideocamera/supportedcodecs
H.264decodersupportsuptoprofileL5.1:
https://msdn.microsoft.com/enus/library/windows/desktop/dd797815(v=vs.85).aspx
Windows10addsthefollowingformats:
● H.265/HEVC
● MKV
● FLAC
8.4WindowsPhone
Thisplatformisn’tsupportedyet,butdetailsonmediasupportedbythisplatformcanbe
foundhere:
https://msdn.microsoft.com/library/windows/apps/ff462087(v=vs.105).aspx
https://msdn.microsoft.com/enus/windows/uwp/audiovideocamera/supportedcodecs
38/52
AVProVideo©2016RenderHeadsLtd
9.Support
If you are in need of support or have any comments/suggestions regarding this product
pleasecontactus.
Email:unitysupport@renderheads.com
Website:http://renderheads.com/product/avprovideo/
UnityForum:
http://forum.unity3d.com/threads/releasedavprovideocompletevideoplaybacksolution.38
5611/
9.1BugReporting
If you are reporting a bug, please include any relevant files and details so that we may
remedytheproblemasfastaspossible.
Essentialdetails:
● Errormessage
○ Theexacterrormessage
○ Theconsole/outputlogifpossible
○ Ifit’sanAndroidbuildthenan“adblogcat”capture
● Hardware
○ Phone/tablet/devicetypeandOSversion
● Developmentenvironment
○ Unityversion
○ DevelopmentOSversion
○ AVProVideopluginversion
● Videodetails:
○ Resolution
○ Codec
○ Framerate
○ Betterstill,includealinktothevideofile
Betterstill,sendusafullorreducedcopyofyourUnityproject
39/52
AVProVideo©2016RenderHeadsLtd
10.AboutRenderHeadsLtd
RenderHeads Ltd is an award winning creative and technical company that has been
designing and building cutting edge technology solutions since its formation in 2006. We
specialise in creating interactive audiovisual software for installations at auto shows,
museums,showsandexpos.
10.1Services
● Unityplugindevelopment
● Unitygame/interaction/virtualandaugmentedrealitydevelopment
● Unityconsulting
10.2OurUnityPlugins
ManyoftheappsandprojectswedeveloprequirefeaturesthatUnitydoesn’tyetprovide,so
wehavecreatedseveraltoolsandpluginstoextendUnitywhicharenowavailableonthe
UnityAssetStore.Theyallincludeafreetrialordemoversionthatyoucandownload
directlyfromthewebsitehere:
http://renderheads.com/productcategory/fordevelopers/
10.2.1AVProVideo
PowerfulcrossplatformvideoplaybacksolutionforUnity,featuringsupportfor
Windows,OSX,iOS,AndroidandtvOS.Thisisournewestplugin.
10.2.2AVProWindowsMedia
VideoplayerforWindowsonly,basedonDirectShow.Featuressupportforthe
Hapvideocodec.
10.2.3AVProMovieCapture
40/52
AVProVideo©2016RenderHeadsLtd
VideocapturetoAVIfilesdirectfromtheGPUandencodedtofilesusingDirectShow
codecs.Featuresinclude4Kcaptures,latlong(equirectangular)360degreecaptures,
offlinerenderingandmore.Windowsonly.
10.2.4AVProLiveCamera
Exposeshighendwebcams,tvcardsandvideocaptureboardstoUnityviaDirectShow.
Windowsonly.
10.2.5AVProBroadcast
CurrentlyunreleasedproductforinputandoutputofbroadcastsignalsusingBlackmagic
Decklinkhardware.Contactusfordetails.
10.2.6ScreenshotAnnotatorPro
Highlyproductivetoolallowingingameandineditorannotationofscreenshotswhichcan
thenbesharedwithyourteamviaFTP,Email,SlackorTeamwork.comwiththeclickofthe
mouse.Crossplatform.
10.2.7AVProQuickTime
VideoplaybackforWindowsandMacusinglegacyQuickTimesystem.This
pluginisquitedatednowbutstillusefulattimes.FeaturessupportfortheHap
videocodec.Thispluginisnowdeprecatedandhasbeenremovedfromthe
AssetStore.
41/52
AVProVideo©2016RenderHeadsLtd
AppendixAFrequentlyAskedQuestions
1. Whywon’tmyhighresolutionvideofileplayonWindows?
The ability to play back high resolution videos depends on the version of Windows
operatingsystemandwhichvideocodecsyouhaveinstalled.
By default AVPro Video will try to use the standard Microsoft codecs that come with
Windows.Thesehavelimitations,forexample:
Decoder
Windows7and
below
Windows8+
h.264
1080p
2160p(4K)
If you want to use 3rd party codecs you can install them to improve the range of
resolution and format options available. These come in the form of Media
Foundation or DirectShow codecs. The LAV Filters are a great example of
DirectShowcodecsthatwillallowforhigherresolutionvideodecoding.
2. DoesTime.timeScaleaffectvideoplaybackspeed?
Yes we have BETA support for time.timeScale and time.captureFramerate. Simply
enable the option on the Media Player component in the panel labelled “Global
Settings”.
3. DoesAVProVideosupportplayingYouTubevideosorlivestreams?
Yes and no. If you enter a YouTube URL into AVPro Video it will not be able to play
it because this is the URL to the website and not the video. It is possible to gain
access to the underlying MP4 file or HLS stream URL which will work with AVPro
Video.ThismaybeagainstthetermsandconditionsofYouTubethough.
4. HowcanIgetsmoothervideoplaybackformyWindowsVRapp?
This is usually caused by the video decoding taking too much CPU time. Some
videos (especially highly compressed ones) require a lot of CPU time to decode each
frame.
Try launching your app/Unity with the “forced3d11nosinglethreaded”
commandline switch. This will enable your application to use GPU decoding which
is much faster. This option is only supported on Windows 8.1 and above and when
D3D11graphicsAPIisused.
42/52
AVProVideo©2016RenderHeadsLtd
You could also try reencoding your video using settings that are less demanding for
the decoder. Most H.264 encoders have a ‘fast decode’ preset, or you can manually
change settings such as disabling CABAC, reducing bitrate, disabling Bframes,
disablingtheloop(deblocking)filteretc.
You could also try switching to another video codec that allows for less CPU
intensive decoding. Codecs such as H.264 / H.265 are generally very heavy on the
CPU.Hapisanextremelyfastcodecbutwillresultinlargefiles.
5. IsGPUhardwaredecodingavailable?
Yes it is on some platforms. Android, iOS, tvOS and macOS mostly use GPU
decoding but it depends on the codec. For Windows software decoding is used by
default.
For Windows try launching your app/Unity with the “forced3d11nosinglethreaded”
commandline switch. This will enable your application to use GPU decoding which
is much faster. This option is only supported on Windows 8.1 and above and when
D3D11graphicsAPIisused.
6. Ismultichannelaudiosupported?
Audio with more than 2 channels should be supported on desktop platforms. On
Windows you will need to set your sound settings in the Control Panel for the number
of channels you want to output. If you leave your Windows sound settings as stereo
thentheaudiowillgetmixedtostereo.
7. Whyisn’tseekingaccurate/responsive?
The way seeking works depends on the platform. Some platforms support frame
accurate seeking but most will only seek to the nearest keyframe in the video. In
general to improve seek accuracy and responsiveness you can reencode your
videos with more frequent keyframes (smaller GOP). The downside of this is that
the size of the video file will increase (more keyframes = larger file). We have two
seek functions: Seek() and SeekFast(). SeekFast can be used when accuracy isn’t
important but whether it’s faster or not depends on support from the platform and can
varybasedonthevideocodecused.
8. PublishingforMacAppStoreandgeterror“InvalidSignature”?
We’re not sure why this happens but we’ve had reports that simply deleting all of the
.metafilesinsidetheAVProVideo.bundlewillresolvethisissue.
9. iOSCanIplaybackavideofromtheVideoslibrary?
43/52
AVProVideo©2016RenderHeadsLtd
Yes if the video is not content protected and you have it's URL. URL's for items in
thevideolibrarytakethefollowingform:
ipodlibrary://item/item.m4v?id=1234567890123456789
You can get the URL of an item by using the MPMediaQuery class from the
MediaPlayerframework.
10. iOSCanIplaybackavideofromthePhotoLibrary?
Yes. You need to use the UIImagePickerController to select the video. This will
result in the video being processed into your app's temp folder where you can access
itviatheURLreturnedfromthecontroller.
11. AndroidWhydoesn’tmyhugevideofileplayfromStreamingAssetsfolder?
Files in the StreamingAssets folder for Android are packed into a JAR file and so
before we can play them we must extract them to the apps persistent data folder.
Huge files can take a long time to extract and copy and sometimes they could even
cause the device to run out of storage space or memory. For really large files we
recommend placing them the videos in other folders on the device and then
referencing the absolute path to that file. This also has the added benefit of not
havingacopyhugefilesandwaitageswhendeployingbuildstotheAndroiddevice.
12. AndroidWhydoesmybuildfailwithamessageaboutDEXandzipclasses?
This can happen when there is a conflict in the Java code. We include a JAR called
zip_file.jar which contain classes for handling zip files. If you have another plugin in
your project that also contains these classes then Unity will fail the build. Read the
exact Unity error message and if it is related to zip classes then you can try deleting
zip_file.jarfile.
13. WillyousupportMPEGDASHoranotheradaptivestreamingsystem?
We hope to support these sorts of streaming systems eventually. It’s currently not
high on our list of priorities. The plugin already supports some basic streaming
protocols and for now we’re focusing on basic features before we look at advanced
featuressuchasthese.
14. What’sthedifferencebetweenyourdifferentUnityvideoplaybackplugins?
Wecurrentlyhave3videoplaybackpluginsforUnity:
a. AVProVideo
b. AVProWindowsMedia
c. AVProQuickTime(deprecated)
44/52
AVProVideo©2016RenderHeadsLtd
Hereisatablegivingaroughcomparisonofthepluginfeatures:
AVProVideo
AVProWindowsMedia
AVProQuickTime
FirstReleased
2016
2011
2011
WindowsXP
Yes
Yes
Yes(withQT
installed)
WindowsVista
Yes**
Yes
Yes(withQT
installed)
Windows7
Yes**
Yes
Yes(withQT
installed)
Windows8
Yes
Yes
Yes(withQT
installed)
OSX
Yes
No
Yes
Android
Yes
No
No
iOS
Yes
No
No
tvOS
Yes
No
No
64bit
Yes
Yes
No
2KH.264
Yes
Onlywith3rdparty
codec
Yes
4KH.264
Yes
Onlywith3rdparty
codec
Yesbutveryslow
StreamingURL
Yes
Notreally
Yesabit
HapCodec
Yes***
Yes
Yes
MP4Container
Yes
Onlywith3rdparty
codec
Yes
WorkswithVR
Yes
Yesbestwith3rdparty
codecs
Notgreat
ASyncLoads
Yes
No
Yes
Transparency
Yes*
Yes
Yes
Speed
Fast
Medium,fastwith3rd
partycodecs
Medium
* Currently only using the Hap5 codec for Windows 7 and below. More support
comingsoon.
**CurrentlyonlyusingDirectShowpath,addingMediaFoundationpathsoon.
45/52
AVProVideo©2016RenderHeadsLtd
*** Currently only Hap and Hap Alpha supported. HapQ and HapQ+Alpha coming
soon.
46/52
AVProVideo©2016RenderHeadsLtd
AppendixBReleaseHistory
● Version1.3.915July2016
○Android
■FixedbugforUnityversions<5.2.0thatcausedvideosnottodisplay
■FixedbugforAndroidversions<6thatcausedvideopausingand
otheroperationstobreakplayback
■Removedzipclassesfrompluginpackagetofixconflictswithother
pluginsusingthesamezipclasses
○General
■BettererrorhandlingvianewGetLastError()functionandanewError
eventtype
■NGUIsupportaddedvianewcomponent
■TimeScalesupportfeaturenowdisabledbydefaultandexposedin
newGlobalSettingspanel
■ApplyToMesh/Materialscriptimprovedwithnewscaleandoffset
parameters
■AddedplatformoverridesforWindowsPhoneandWindowsUWP
■Improveddocumentation
○Workflow
■AddednewAndroidwarningforloadingabsolutepathwithoutexternal
permissionsetinPlayerSettings
○VR
■FixedVRaudiooutputdevicenotworking
■Newhighqualityoptionforsphereshadertoimprovequalityatthe
polesandgeneraloptimisations
■Fixedissuewithleft/righteyesbecomingswappedsometimes
■Minorfixestocubemapscript
● Version1.3.830June2016
○Bugfixes
■FixedstereoVRscriptbrokeninv1.3.6
■FixedissueswithUWPandHololenssupport
■FixedWindowsDirectShowissuepreventingHapvideosplayingwhen
anothersourcefilterisinstalled
■FixedWindowsDirectShowbuginwatermarkforHapvideos
○Workflow
■Improvedrecentfilelisttobesortedbywhenthefileswerelastused
● Version1.3.627June2016
○General
■Added(BETA)supportforUniversalWindowsPlatform10and
WindowsPhone8.1
■Added(BETA)supportforTime.timeScaleand
47/52
AVProVideo©2016RenderHeadsLtd
Time.captureFramerateallowingvideoplaybacktoworkproperlywith
videocapturesystemsthatalterUnitytime
■AddedExtractFramefunctiontoMediaPlayer
■AddedExtractFramesdemoscene
■AddedSeekFastfunctionwhichwilltrytoseektokeyframesonlyso
it’slessaccuratebutfaster.Onunsupportedplatformsitwilljustdoa
normalseekoperation
■Addedfunctionstochangetheplaybackrate.Notethatthebehaviour
ofthisvariesbetweenplatformsandisnotavailableyetonAndroid
■GeneralAPIimprovements,platformoverridessystemimproved
■FixedbugwheredisabledgameObjectwouldcauserenderingtostop
■FixedbugwheredestroyingMediaPlayerwhileuGUIcomponentis
usingitcouldcauseacrash
■FixedrarebugwhereuGUIcomponentwouldbecomeoffsetorhidden
■Fixedrarebugwherem_eventswouldbenull
○VR
■FixedVRsphereshadercoordinatesonsomeplatforms,especially
cardboard
■Added“MediaProperties”sectiontoMediaPlayerwhereyoucan
definethestereopackingofavideo.Thisthenautomaticallyadjust
thesphereshadertorenderthevideocorrectlypereye
■FixedbuginInsideSphereshaderwherestereorenderingwouldflip
theeyesatsomeangles
■AddedsupportforUnity5.4“SinglePassStereoRendering”to360
InsideSphereshader
■AddednewVRsamplewith“cubemap3x2”(facebooklayout)support
○Workflow
■AddedbuttoninpreviewpaneltosaveframetoPNG
■Addedpersistentoptiontopreservethemediaplayerbetweenlevel
loads
■AddedmultiobjectMediaPlayercomponenteditingsupport
■Textureproperties(wrapmode,filtering)canbesetviaMedia
Propertiespanel
■DebugGUInowshowspreviewofvideo
○Android
■Fixedbugwherenovisualswouldappearwhenolddevices
■SwitchedfromAARtoJAR/SOfilestoimproveUnity4compatibility
■Addedx86support
■FixedbugwherePausingastoppedvideowouldlockitup
○OSX/iOS/tvOS
■LargeperformanceboostoniOSandtvOS(removedtexturecopy)
■StreamingvideobufferingstallsnowrecoverandIsBufferingfunction
added
■Seekaccuracyimproved
■Loopinghandledbettertoreduceseamtime
■FixedtexturememoryleakinMetalrenderingpath
48/52
AVProVideo©2016RenderHeadsLtd
■FixedmutenotworkingwithautoStart
○Windows
■DirectShowvideoplaybacksmoother
■FixedDirectShowsupportforshowingimagesorvideoswithzero
duration
■AddedplatformoverrideoptiontoforceDirectShowplayer
■Addedplatformoverrideoptiontoforceaudiooutputdevice.Thisis
usefulforVRhardwarethathasitsownaudiodevice.
■Fixedposterframenotdisplaying
■FixedvideosnotdisplayingduetoemptyRGB32alphachannel
■FixedD3D9lostdeviceissue
■FixedD3D9issueoftexturenotbeingreleased
■FixedDirectShowplayertimedisplayingNaNsometimesattheendof
video
■FixedcrashbugifyouclosedUnitywithvideowasplaying
■FixedWindowsNeditioncrash
● Version1.3.020April2016
○Android
■Addedmultithreadedrenderingsupport
■Fixedvariousrarebugs
○Windows
■ExposedGPUvideoplayerpath(whenusingcommandlineargument
“forced3d11nosinglethreaded”),thisrequiresWin8.1minimumand
D3D11
■WindowsXP,WindowsVistaandWindows7supportaddedbyadding
DirectShowplaybackpath
■Hap1andHap5codecsupportaddedforWindows7andbelow(via
DirectShowplaybackpath)
■Fixedaudioonlymedianotbeingseekable
○iOS
■FixediOS8.2compatibilityissue
○Workflow
■Editorpausebuttonnowpauses/resumesplayingvideos
■Addednew‘about’sectionwithhandylinks
■ImprovementstoeditorUI
■UIfixesforstandardUnityeditor‘light’skin
○Bugs
■FixedIsFinishedPlayingeventnotfiringonsomeplatforms
■Fixedplayerfreezingwhencomponentisdisabled.Itnowpauses
OnDisable()andresumesOnEnable().
■FixedcrashinVCRdemorelatedtouGUIcomponentwhenchanging
videos
■Fixedbugclosingapplicationwithmanyvideosopen
■Fixedseekingbugforaudioonlymedia
○Documentation
49/52
AVProVideo©2016RenderHeadsLtd
■UpdatedFAQ
■Addedstereovirtualrealitynotes
● Version1.2.01April2016
○General
■Improvedsupportforaudioonlymedia
■Improvedstreamingsupport
■AddedHasVideo,HasAudioandHasMetaDatafunctions
■AddedMetaDataReadyevent
■Firstframenowdisplayswithoutstartingplayback
■AddednewApplyToMeshcomponent
■Removedtroubled#AVPROdefines
○Android
■FixedissuewhereFinishedeventwouldn’tfire
■MinimumAPIlevelbumpedfrom15to16
○Mac,iOS,tvOS
■improvedperformanceofmultiplevideoplayback
○Windows
■Improvedperformance(duplicateframehandling)
■AddedmissingIsSeekingfunction
■FixedIsFinishedfunctionalwaysreturningfalse
■FixedURLparsing
■FixedOpenGLtexturecleanup
■FixedminorD3D11leakcausedbyviewsnotbeingreleased
■Improvedinit/deinit
○Workflow
■Resultingfilenameisnowdisplayedclearlyandiscopyable
■Morefileextensionsininspectorfilebrowser
■ComponentsnowhaveAVProicon
■AddedwarningsforincorrectPlayerSettingsforstreamingvideos
■Editorplatformoverridetabisrestored
○Debugging
■Improvedlogging
○VR
■Improved360SpheredemosupportforGearVR
■InsideSphereshaderhascolortintoptionforstereodebugging
○Docs
■Addedvideostreamingnotes
■AddedVRnotes
■Improvednotesonsupportedformats
● Version1.1.011March2016
○AddedWindowssupport
○AddedlatlongstereotopbottomandleftrightvideosupportforVR
○Addedperplatformfilepathoverrides
○Absoluteandrelativepathloadingsupportadded
○AndroidloadingfromOBBsupportadded
50/52
AVProVideo©2016RenderHeadsLtd
○Workflowimprovements
■Addedbrowsebutton
■Addedrecentfilelist
■Addedrelativefoldersupport
■ImprovedMediaPlayerUI,includingpreviewineditor
○Createdascriptingclassreference
○Improveddocumentation
○FixedLinearcolourspacesupportinWindows
○Fixedshutdownandmemoryfreeing
○Variousbugsfixed
● Version1.0.025February2016
○Initialreleaseontheassetstore
○Addednewevents
● Version0.9.017February2016
○Initialbetarelease
AppendixCRoadmap
●Version1.4.0
○macOSHapsupport
○FixesforiOSMetalrenderingflickeringissue
○SupportformacOSMetalrendering
○webGLsupport
●Version1.5.0
○Addglobalaudiovolume
○SidebysideandTopbottomtransparencysupport
○BetterstreamingsupportforWindows+streamingdemo
○Audiobalance
○Addusecasestodocumentation
○Glitchfreemultivideoplayerwithoptionaltransitions
●VersionX.X.X
○WebGLsupport
○Splitoutmediadefinitionsfromplayer
○Playmakersupport
○AudiostreamingbacktoUnity
○Loadingfrommemory/resources
○FallbacktousingMovieTextureonsomeplatforms?
○10bitHEVCsupport?
● VersionX
○←Yoursuggestionshere,letusknow:)
51/52
AVProVideo©2016RenderHeadsLtd
52/52
AVProVideo©2016RenderHeadsLtd