Search Unity

Mobile Movie Texture

Discussion in 'Assets and Asset Store' started by DanTreble, Dec 17, 2011.

  1. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    OpenStream takes a raw file path, so you should be able to give it the path in persistentDataPath.

    NB persistentDataPath is iCloud synced on iOS, you really want to use the temporary one
     
  2. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Can you send me the source video please and the converted one? I'll take a look
     
  3. Surreal

    Surreal

    Joined:
    Dec 10, 2011
    Posts:
    29
    Dan,

    Having an issue with continuous looping -- just got the control from the asset store.
     
  4. Swearsoft

    Swearsoft

    Joined:
    Mar 19, 2009
    Posts:
    1,632
    This happens with non-square textures as far as I have understood.
     
  5. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Can you elaborate please? I'm sorry I can't guess what your issue is, I wish I could
     
  6. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    They _should_ work fine non square. At best this is a bug in my theora wrapper and I can fix it. If it is in theora itself, I don't fancy my chances.

    I'll report back...
     
  7. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Found and fixed. Thank you so much for the example.

    Problem was that the uv scale/offset needs to be different for the CrCb planes than it does for the Y plane. As they are different sizes the extra 16 pixels of padding means they need different correction.

    Replace the View attachment $YCrCbtoRGB.shader and the View attachment $MobileMovieTexture.cs file and you should be fine.

    I'll have to migrate the other shaders to account for it.
     
  8. pat_sommer

    pat_sommer

    Joined:
    Jun 28, 2010
    Posts:
    586
    i notice whenever it resets the "demo" watermark there is a second delay, is this normal for the demo? and would this go away with the full version?

    i often need to play full screen 1024 by 768 videos, it seems to play smooth besides the "demo" refresh, can i be assured it wont freeze up in full version?
     
  9. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    It does do a bunch of extra work that frame to copy the demo text into the frame buffer, that is also a key frame which may be more complicated to decode. I can't say I have noticed a pause myself though. Did you encode the bit rate on the high side? Anything over 8000 will trouble an iPad2.

    The 3GS will struggle at that resolution as will a lot of androids. iPad2 handles that depending on bit rate, as I mentioned.

    So my assurances can only be based on your target device, resolution and bit rate.
     
  10. android_dev

    android_dev

    Joined:
    Jul 9, 2011
    Posts:
    19
    Thanks! Looks fine now
     
  11. android_dev

    android_dev

    Joined:
    Jul 9, 2011
    Posts:
    19
    When I set loop to false the whole application will freeze at the end of the video. I'm not getting any logs but I'll check my build settings perhaps I'll find something there.
     
  12. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Sorry, my fault. Infinite loop if you didn't have a onFinished delegate.

    Fixed in the attached version. View attachment $MobileMovieTexture.cs
     
  13. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    @DanTreble

    So what's the biggest impact on frame rate barring size? Would reducing the bitrate help speed up playback? We currently use Miro to convert our images but there aren't any settings persay... Would it be better to ffmpeg2theora them?
     
  14. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Bitrate

    Yup :)

    The one that lets you control bitrate is better :)

    It has all kinds of switches I haven't yet explored for maximising size/quality.

    Code (csharp):
    1. ffmpeg2theora-0.28.exe rukou_ya.ogv -o rukou_yasmall.ogv -V 3600 --optimize --two-pass
     
  15. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    Is there ANYWAY to get transparency working well on movies? Right now we have issue getting anything to look worth anything at all. Basically the problem we have is that a lot of our source videos "had" transparency in them... but when we move over to theora we have to put them on black (or a color). So i tried setting up say a blue bg.. but the animated pieces have transparency on them and pickup said colors. Is there anyway to get a good fidelity transparency?
     
  16. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    I just wrote a shader for another client to solve this problem. PM me and I'll mail you the package.
     
  17. Raigex

    Raigex

    Joined:
    Jul 6, 2012
    Posts:
    154
    I am debating on whether or not to buy this. I have alot of different movies that i would need to play, thus i cannot package them in my apk. This plugin sounds crazy good for what i need (need to play movie on a small portion of layout) but I use assetBundles since they are a bit more secure than just storing images, models, and etc than just placing them in the persitant path as anyone with a rooted android device will be able to take them. Now is the problem with asset bundles that your plugin does not support playing a video from an asset bundle or is it that movies cannot be stored in an asset bundle (which i havent seen written anywhere). And if so how is a video being in an asset bundle different than a video being compressed in an apk? As as far as i can tell asset bundles have the same compression and settings are the videos do in android.

    Also videos can be changed at runtime right? (eg: scene started with an empty video plane, obtain some variables from previous scene and play a video based on those variables)
     
    Last edited: Jul 12, 2012
  18. Adiel

    Adiel

    Joined:
    Feb 20, 2012
    Posts:
    8
    Hi Raigex, I've been in that exact situation.
    Anyway, there are several ways to solve this issue, I've done the following:
    A. read here http://developer.android.com/guide/google/play/expansion-files.html about expansion files and how to use them with your android app.
    B. You can use the "Google Play OBB Downloader" that is now in the AssetStore to request and download your main OBB expansion file from the Google servers(saves a lot of headache).
    C. use a zip .net lib to extract your compressed expansion file at runtime. I used http://www.icsharpcode.net/opensource/sharpziplib/ to extract the OBB file that I have compressed previously(which contains all my OGV files). Extract them to the correct location that the expansion files guide tells you to. here's a block of code which returns that correct path-
    Code (csharp):
    1.  
    2. private string GetPathToApplicationExternalData()
    3.     {
    4. #if UNITY_ANDROID  !UNITY_EDITOR
    5.         using (AndroidJavaClass cls_UnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
    6.         {
    7.             using (AndroidJavaObject obj_Activity = cls_UnityPlayer.GetStatic<AndroidJavaObject>("currentActivity"))
    8.             {
    9.                 using(AndroidJavaObject fileDir = obj_Activity.Call<AndroidJavaObject>("getExternalFilesDir", ""))
    10.                 {
    11.                     return fileDir.Call<string>("getAbsolutePath") + "/";
    12.                 }
    13.             }
    14.         }
    15. #endif
    16.         return string.Empty;
    17.     }
    18.  
    D. In order for MobileMovieTexture plugin to support playing the files located elsewhere(rather than StreamingAssets) and are now not part of the apk you'll have to change 2 blocks of code in MobileMovieTexture.cs and AssetStream.cs-
    in AssetStream.cs:
    Code (csharp):
    1.  
    2.  public static string GetApkPath()
    3.     {
    4. #if UNITY_ANDROID  !UNITY_EDITOR
    5.     //use this instead for loading files from external SD card
    6.     using (AndroidJavaClass cls_UnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
    7.         {
    8.             using (AndroidJavaObject obj_Activity = cls_UnityPlayer.GetStatic<AndroidJavaObject>("currentActivity"))
    9.             {
    10.                 using(AndroidJavaObject fileDir = obj_Activity.Call<AndroidJavaObject>("getExternalFilesDir", ""))
    11.                 {
    12.                     return fileDir.Call<string>("getAbsolutePath") + "/";
    13.                 }
    14.             }
    15.         }
    16. #else //UNITY_ANDROID  !UNITY_EDITOR
    17.         return "";
    18. #endif //UNITY_ANDROID  !UNITY_EDITOR
    19.     }
    20.  
    in MobileMovieTexture.cs, in the Open() function, inside the #if UNITY_ANDROID block change the last line to:
    Code (csharp):
    1.  
    2. m_nativeContext = OpenStream(AssetStream.GetApkPath() + m_path, 0, 0, m_loop, pot );
    3.  
    Now, if you've extracted all your files from within your compressed zip file into the correct folder that your changed GetApkPath function retrieves, you're all set and the OGV files will play OK.

    About using Asset bundles in terms of security...you should know that asset bundles are just like zip files but are compressed with LZMA compression instead...
    Also, the zip lib which I've linked to can extract password protected zips, if that helps.

    Good luck.
     
    Last edited: Jul 15, 2012
  19. Raigex

    Raigex

    Joined:
    Jul 6, 2012
    Posts:
    154
    @Adiel
    Thanks for the info but I have decided to go another way (using android and surfaceView plugin). As the video will only be played in a single position (no transformations necessary) so it is a bit easier to use it that way.

    I will keep your post in mind if I ever decide to come back to using this option for this or another project.

    @DanTreble
    Your plugin is great, keep up the good work.
     
  20. MrYigit

    MrYigit

    Joined:
    Aug 26, 2011
    Posts:
    20
    It has been a while for me lurking in this topic..

    A question for you guys: anyone else experiencing sync-problems when playing chromakey-videos with audio? Both are (offcourse) the same length.
    Any tips/tricks I could try? The problems seems to differ depending on the hardware. (Mostly iPad2/3, iPhone4(S), Android-phones.)
     
  21. neoRiley

    neoRiley

    Joined:
    Dec 12, 2008
    Posts:
    162
    Hey guys! It FINALLY launched ;) We were using the Mobile Movie Texture for the iPad3 version of this site for NIKE and while that app is still being approved, you can see the app in action here:

    http://nikeinc.com/news/explore-the-nike-innovation-arena#/inline/10879

    If you are in the press box (first landing place), and rotate to the back of the room where there are 2 boxes, click on the one that says Nike+ Basketball to see the keyed wire animation ;)

    Thanks again for a great product!!
     
  22. golden_gate

    golden_gate

    Joined:
    Jul 22, 2009
    Posts:
    81

    Great stuff on the website.. But I could not find the wire animation.... Can you post a pic or give a better way of finding it...?? There is a lot on the website that says nike + ....
     
  23. neoRiley

    neoRiley

    Joined:
    Dec 12, 2008
    Posts:
    162
    Here's a screenshot of it in action:

     
  24. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Looks slick. Congratulations!

    Always feels great submitting a project to the app store.

    Shipping is truth :)
     
  25. Muckel

    Muckel

    Joined:
    Mar 26, 2009
    Posts:
    471
    Hi,
    well works awesome on iPad 1 !!
    So does it also work on Windows Mac Standalone ?
    Great Plugin !
    thx
     
  26. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Thanks Muckel! It works out of the box windows standalone. Mac requires a small modification I think, it is mentioned somewhere in this thread.
     
  27. shibomb

    shibomb

    Joined:
    Jul 23, 2012
    Posts:
    2
    Hi.

    Can I change "Path property" or ".ogg file" on runtime?

    I want to play the movie from www server.
    Like this...
    ---------------- a C# script --------------
    private WWW www = null;
    public MobileMovieTexture m_movieTexture;

    public void Load(string file) {
    m_trackableName = trackableName;
    www = new WWW("http://example.com/moviefiles/" + filename + ".ogg");
    StartCoroutine(getContentCoroutine());
    }

    private IEnumerator getContentCoroutine() {
    Debug.Log("Loading " + www.url);
    yield return www;

    if (www.error != null) {
    return false;
    }

    m_movieTexture.Path = www.movie;
    m_movieTexture.Play();
    }
    --------------------------------------------
    Help me, please.

    Thanks.
     
  28. Raigex

    Raigex

    Joined:
    Jul 6, 2012
    Posts:
    154
    @shibomb
    From my own trials of this, your best bet is to download the movie, then write the byte array into some location (preferably, Application.peristantPath + filename

    then use that string path to pass video to the plugin.
     
  29. shibomb

    shibomb

    Joined:
    Jul 23, 2012
    Posts:
    2
    @Raigex
    Thanks for you hint!
    I got a solution ;-)

    Thanks.
     
  30. Muckel

    Muckel

    Joined:
    Mar 26, 2009
    Posts:
    471
    Hey Dan,
    can you maybe implement it in the next Update ?
    I'm in progress to made many different APP's for Win Mac and i have to implement it every time...
    @ Line 268
    If you use Mac OS X to compress to OGG then you can best use XiphQT.
    You can find it here: http://xiph.org/quicktime/download.html
    put the Component in Library/Components
    a other great APP is iFFmpeg for Video files ... it has also great OGG support !
    All this APP's working in 10.8 !
     
  31. MrYigit

    MrYigit

    Joined:
    Aug 26, 2011
    Posts:
    20
    Sounds interesting! Do you think this will solve my problem that I've got with audio-video sync?
     
    Last edited: Jul 24, 2012
  32. Muckel

    Muckel

    Joined:
    Mar 26, 2009
    Posts:
    471
    if your Video data rate is too high on low end devices than the fps drops down your sound is async...
    i did no test with audio together but i saw different fps with different quality setting in the ogg encoder...
    i'm not shure if there is a fixed frame rate for ogg Video in the playback component...
    Normally the Video will play in the framerate you do the encoding 15-25 fps... if you use 15 maybe the async problem will gone...
    because there are only 15 frames to decode in a second.... instead 25 or 30....
    if it is not a high speed Video like with fast motion than 15 fps will be ok ;-)
    try plz report back if it works.
     
  33. DanielTortosa

    DanielTortosa

    Joined:
    Jul 25, 2012
    Posts:
    5
    Hello, is there any chance to know when the video looping is starting again?

    I need to loop 3 times and then onfinished, it's possible?
     
  34. Paolo-Boniforti

    Paolo-Boniforti

    Joined:
    Jul 25, 2012
    Posts:
    1
    Hello, can we have demo of last version?
    the last version of demo dowload is 1.1.1
     
  35. wilco64256

    wilco64256

    Joined:
    Jul 3, 2012
    Posts:
    20
    Is there a way to make it so the material starts out as black, rather than a bright pink? Sometimes there's a touch of lag before the video gets started and it's quite jarring to see that pink flash.
     
  36. freaksed

    freaksed

    Joined:
    Sep 15, 2010
    Posts:
    22
    I am getting a DllNotFoundException on the Android. It was happening on PC as well until I copied the dll into the root folder of the project (outside of Assets). This solution does not seem to help on Android (yes I copied the .so file for Android as well (to multiple places))
     
  37. wilco64256

    wilco64256

    Joined:
    Jul 3, 2012
    Posts:
    20
    The demo version was working great for me on all platforms, so last night I bought the full version, only to find that the version on the asset store does not include the fix in this thread for movies crashing when not set to loop. I now am also finding that the full version crashes my Mac right when the video tries to start playing, even though the demo version was working fine. And I have added the lines to the script that are referenced earlier in this thread for getting it to work on Mac Standalone.

    Anybody else encountered this issue and found a way to fix it?
     
  38. wilco64256

    wilco64256

    Joined:
    Jul 3, 2012
    Posts:
    20
    Oddly enough this only happens inside the Unity editor on my Mac, if I make a Mac standalone build out of the project the videos play just fine.
     
  39. MatthewLeeFarmer

    MatthewLeeFarmer

    Joined:
    Jul 31, 2012
    Posts:
    14
    I have 2 questions:

    Is there a way to change the width height of the texture? We are attempting to change the resolution of our textures on run-time using Unity3d's Quality Settings and Mipmaps. However, MobileMovieTextures do not have mipmaps, so they display at full resolution. What we would like to do is control the resolution of the video on load-time.

    Also, we seem to be experiencing some bleeding. I've attached an image of this happening. Is there any known cause to this?

    I appreciate your time!

     
    Last edited: Jul 31, 2012
  40. rorro

    rorro

    Joined:
    Aug 11, 2012
    Posts:
    1
    Hi.

    I bought "Mobile Movie Texture" with Asset Store of Unity and work ok in windows, the problem is in Mac OS, I have Unity 3.5.0 and your plugin doesnt downoad . I dont want update my Unity, but really want use your plugin, do you have any solution?
     
  41. ronald-meijers

    ronald-meijers

    Joined:
    Dec 20, 2010
    Posts:
    2
    Hi,

    is it possible for me to try that shader with the free version for evaluation?
    I am looking for a solution that can handle transparent videos as a texture on mobile devices, and yours looks like a winner, but I have to justify my findings to my 'boss' with a working sample.

    Thanks in advance!
     
    Last edited: Aug 21, 2012
  42. Muckel

    Muckel

    Joined:
    Mar 26, 2009
    Posts:
    471
    Hello,
    well i'm using the new Unity4... it's now official download....
    So if i do Split Binary under PlayerSettings than i get a apk and a obb file.
    All Stuff from Unity Side working fine.... my Videos are working and Audio too...
    But my Mobile Movie Texture doesn't work because it is stored now in the obb file.
    So i tryed everything to get the correct path to the Video... i'm on Unite2012 here in A'dam but also the Unity Ninjas could help me
    because it has something to do with the Mobile Movie Texture Plugin...
    So my Idea was to fix the Problem:
    Open the apk file and store the Video that was moved in the obb file into the apk.
    Than i thought it should work.... but it doesn't....!!!
    If i don't split my Binary it works still fine in Unity4.
    For me it's a Showstopper because my APP's are on hold because of the issue....

    If someone have a Idea what i can do plz help !
    Dan is not reachable via Mail.... so i'm alone in the dark with the Problem....:(
     
  43. dev_peter

    dev_peter

    Joined:
    Aug 9, 2012
    Posts:
    38
    is there a way you can provide the download to 1.1.5. Its not available in the store
     
  44. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    For sure, drop me a PM with a order number and your email address.
     
  45. Adiel

    Adiel

    Joined:
    Feb 20, 2012
    Posts:
    8
    Hi DanTreble,
    I would like to know if there is any effort to fix the Adreno crash.
    It seems that every Android device with the Adreno GPU gives out a purple picture instead of the movie.
     
  46. Muckel

    Muckel

    Joined:
    Mar 26, 2009
    Posts:
    471
    Thank you so much Dan !!!!
    all is working fantastic now !!!!
    i can really recommend this Plugin...
    It works now with Unity 4 and all Platforms without any trouble !
    respect kudos to the Dev
     
  47. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    Does it support (Unitys missing) basic functions like:

    Play ?
    Stop ?
    Rewind ?
    Seek ?
     
  48. DanielTortosa

    DanielTortosa

    Joined:
    Jul 25, 2012
    Posts:
    5
    Nice work on 1.1.5, i hope we can access soon to Seek, CurrentFrame and TotalFrames. Thanks
     
  49. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Hey Adiel, this is the first I have heard about this effecting anything other than the N1. What devices exhibit purple pictures?

    To be honest, I do nothing more sinister than upload textures using GlSubImage, if that is broken in the GL drivers on the device, there is little I can do different :-(
     
  50. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Yes

    No :-(