Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Mobile Movie Texture

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

  1. neoRiley

    neoRiley

    Joined:
    Dec 12, 2008
    Posts:
    158
    In the editor, with the material selected in the project panel, go to Window > Chroma Key Editor - there you can play with the color/settings
     
  2. atmob

    atmob

    Joined:
    Jan 20, 2012
    Posts:
    22
    ;)
    Just figured that out, and was going to update that on the forum .... and there ....
    was you with the solution, tks a lot for the help.

    This is just a great tool! TKS
    atmob
     
  3. neoRiley

    neoRiley

    Joined:
    Dec 12, 2008
    Posts:
    158
    Tried and did not work - just showed as a semi-transparent green plane ;)
     
  4. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Gah. Sounds like it hasn't uploaded any frames to the gpu. Do you have at least one DecodeAndUpload where you pass positive texture handles?
     
  5. neoRiley

    neoRiley

    Joined:
    Dec 12, 2008
    Posts:
    158
    No, I never sent a regular call with positive arguments - just replaced the one line with all -1's
     
  6. Lyaksej

    Lyaksej

    Joined:
    May 20, 2011
    Posts:
    4
    Hi!
    I have pretty low fps on the device (around 9 fps). Video component tries to show every frame and it plays maybe 3 times slower that it should be. Is there a way to skip the frames and play it in the normal timeframe?
     
  7. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Sorry, maybe I explained it badly.

    Theory is this, you need to decode every frame in sequence, you cannot get around this. You only need to upload the frames you wish to display. The last DecodeAndUpload in a sequence, should have the actual texture handles in to trigger the upload and give you something you can draw.

    The trick is skipping frames with DecodeAndUpload(-1... till you work out the time of the next frame is the one you will want to display, then finishing with a DecodeAndUpload( with the actual texture handles.

    I'll just man up and write the code tonight :)
     
  8. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Hey Lyaksej, I'll get round to the frame skipping code asap. However, skipping frames doesn't save a whole lot of processing power. 9 fps is really slow, maybe consider using a slightly lower resolution video?
     
  9. neoRiley

    neoRiley

    Joined:
    Dec 12, 2008
    Posts:
    158
    ahhhh so I could have added a "desiredFrameRate" property and just "dropped" frames with -1-1-1 values and when it was a frame that fell within the timeslice, then sent the normal frame as usual? Is that what you had in mind?
     
  10. mattirwin

    mattirwin

    Joined:
    Jan 3, 2011
    Posts:
    14
    The demo looks great and we will probably buy the plugin soon.

    I'm hoping to have scrubbing functionality... any way to explicitly set the frame? I realize this is tricky with the delta decoding, but thought I would ask.

    A quick look through the API seems to show that this feature doesn't exist yet. Any plans to add this?

    Thanks
     
  11. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    neoriley and Lyakse, I've sent you an early version of the frame skipping, let me know how you go.

    Thanks

    Dan
     
  12. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Scrubbing forward should be doable with a variation frame skipping. The thought of scrubbing backwards makes my ears bleed!

    I'd probably have to do something a little more clever to support that. Like scanning for keyframes, so I could at least start at the last keyframe, then I have a max of 255 delta frames to apply.

    Out of interest, what is your use case for scrubbing? Scratch VJ?! If that doesn't exist it should!
     
  13. mattirwin

    mattirwin

    Joined:
    Jan 3, 2011
    Posts:
    14
    Thanks for getting back to me. I'm trying to use your plugin to make a Youtube-style video player that takes up about 30% of the screen. It will have a play/pause button, timeline bar and fullscreen button. We also want to draw other things on the screen so we can't use the iPhoneUtils.PlayMovie approach.

    We don't actually need scrubbing exactly, but I basically need to 1) Read the current frame so I can update the timeline bar and 2) Set the current frame in response to user clicks along the timeline bar. So this would require a SeekToFrame function of some kind in the API.

    I would be fine with it working like Hulu, where clicking the timeline makes the video seek to the keyframe just before the selected frame. Or a trickier approach of course would be to decode the video forward from that keyframe point without rendering to select the exact frame.

    Does that clear up the request?

    By the way, a video player built on top of your plugin might be a good addition to the asset store...

    Matt
     
  14. gary_bbgames

    gary_bbgames

    Joined:
    Jan 20, 2012
    Posts:
    22
    Hey,

    I have 2 movies, 1 is a scene with the lights off the other is a scene with the lights on. I want to have it so you can toggle the lights on and off by touching the video. I have this in place by having both movies running and toggling the active state of the plane that the lights on video is playing on.

    This is quite slow and seems a bit of a back handed way to go about it. Is it possible to swap the video at run time whilst keeping the videos at the same frame. Failing that is it possible to get the current frame and then start the new video and stop the old one?

    Thanks.
     
  15. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    I'll put a naive SeekToTime function in the next release and you can give it a go :)
     
  16. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Hey Gary, I'm struggling to think of the best way of solving this problem.

    I would be tempted to encode the two videos as one larger one, either side by side or on top of each other. Then override the uv offsets/scale in the movie texture to just show one. That way the videos stay in sync and swapping is as easy as changing some uv offsets
     
  17. android_dev

    android_dev

    Joined:
    Jul 9, 2011
    Posts:
    19
    you mentioned before that Unity Pro is required because of the "Native Code Plugins Support" but do I need to use the Android Pro version or can I use the normal Android version?
     
  18. gonzorob

    gonzorob

    Joined:
    Dec 1, 2011
    Posts:
    96
    When I build any project I get the error

    "ld: warning: ignoring file <path>/<buildname>/Libraries/libtheorawrapper.a, file was built for archive which is not the architecture being linked (armv6)"

    compiling for iPad 2, Unity3D 3.5 latest and Xcode 4.3

    On a deadline, so any help would be greatly appreciated !

    Cheers

    (<path>/<buildname> were stripped out by me..)
     
  19. mattirwin

    mattirwin

    Joined:
    Jan 3, 2011
    Posts:
    14
    Gonzorob,

    You can try changing the Target Platform setting to armv7 only in the Unity player settings. If you are targeting iPad2 you shouldn't need to support armv6. The author may have more insight into this problem.

    Check out this link for more info: http://wanderingcoder.net/2011/09/25/compiling-armv7/
     
  20. Amitloaf

    Amitloaf

    Joined:
    Jan 30, 2012
    Posts:
    97
    I had the same problem with the linker failing on xcode. What was the solution?
     
  21. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Exactly what mattirwin said. Unless you need 3G, which my plugin does not support, use armv7. Plus you'll save ~10Mb in your final ipa in the process :)
     
  22. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    I believe you can use the normal Android version. Please double check with the demo version before you pay money :)
     
  23. Amitloaf

    Amitloaf

    Joined:
    Jan 30, 2012
    Posts:
    97
    Apparently just updating to the last version of MobileMovieTexture fixed it. Thanks :)
     
  24. android_dev

    android_dev

    Joined:
    Jul 9, 2011
    Posts:
    19
    its working, money paid :) Thanks for the plug-in!
     
  25. cloudfun

    cloudfun

    Joined:
    Oct 2, 2011
    Posts:
    35
    hi im interested using your mobile movie texture on ios and android,
    my question is supported videos with sound?
    local videos and http streaming videos?

    i need to play videos inside planes on the ios and android screens but i need sound :)

    thanks in advance for your response
     
  26. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    No :-(

    Yes :)

    No :-(

    Sorry, maybe you need a different solution

    Thanks for the interest
     
  27. cloudfun

    cloudfun

    Joined:
    Oct 2, 2011
    Posts:
    35
    thanks a lot for your quick response

    yes i need videos with sound

    sorry
     
  28. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    @DTreble,

    Hey! The plugins looking great but i had a quick question. is there anyway to have support alpha within the animation? Or are we stuck w/diffuse?

    And is there access to swapping textures at runtime? Or are they all loaded at start?
     
    Last edited: Mar 15, 2012
  29. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    The plugin supports chroma keying to generate an alpha channel. http://en.wikipedia.org/wiki/Chroma_key

    You can swap movies at runtime, although obviously they have to be in the ipa/apk
     
  30. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    Great, thanks for the info DTreble. One q about the keying process.. is it simply based on the background color being one of the green/blue chroma or is it based on multiple movies? I couldn't find anything in the instructions text that supports this.

    Cheers!
    Bryan
     
  31. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    Hey again! So i picked up the plugin... great stuff. i see there's a chroma key example in the file which is awesome but maybe i'm misunderstanding the whole thing here. Basically i want/need to use the movies as an overlay to a background image... I can get it to key to a color but its not transparent and showing whats behind it. Is there something special i need to do w/the background to have it show through? Or am i missing something?
     
  32. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Ah, I understand! That's much easier :)

    We need to make three small modifications to the shader to allow that. We need it to be in the transparent queue, we need to enable blending and we need a way of giving it a constant alpha.

    The attached shader View attachment $YCrCbtoRGBTrans.shader should do the business.

    Thanks

    Dan
     
  33. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    @DTreble,

    Thanks for that! I'll take a look at that. I'm having a strange issue, or error, as follows...

    Code (csharp):
    1.  
    2. ld: warning: ignoring file /Users/trunk/iOS/Libraries/libtheorawrapper.a, file was built for unsupported file format which is not the architecture being linked (armv7)
    3. Undefined symbols for architecture armv7:
    4.  "_GetNextFrameTime", referenced from:
    5.      __Z19RegisterMonoModulesv in RegisterMonoModules.o
    6.  "_GetYHeight", referenced from:
    7.      __Z19RegisterMonoModulesv in RegisterMonoModules.o
    8.  "_GetUVStride", referenced from:
    9.      __Z19RegisterMonoModulesv in RegisterMonoModules.o
    10.  "_DecodeFrame", referenced from:
    11.      __Z19RegisterMonoModulesv in RegisterMonoModules.o
    12.  "_CloseStream", referenced from:
    13.      __Z19RegisterMonoModulesv in RegisterMonoModules.o
    14.  "_ReAllocTexture", referenced from:
    15.      __Z19RegisterMonoModulesv in RegisterMonoModules.o
    16.  "_OpenStream", referenced from:
    17.      __Z19RegisterMonoModulesv in RegisterMonoModules.o
    18.  "_DecodeAndUpload", referenced from:
    19.      __Z19RegisterMonoModulesv in RegisterMonoModules.o
    20.  "_GetPicWidth", referenced from:
    21.      __Z19RegisterMonoModulesv in RegisterMonoModules.o
    22.  "_GetYStride", referenced from:
    23.      __Z19RegisterMonoModulesv in RegisterMonoModules.o
    24.  "_GetUVHeight", referenced from:
    25.      __Z19RegisterMonoModulesv in RegisterMonoModules.o
    26.  "_GetPicHeight", referenced from:
    27.      __Z19RegisterMonoModulesv in RegisterMonoModules.o
    28.  "_GetPlane", referenced from:
    29.      __Z19RegisterMonoModulesv in RegisterMonoModules.o
    30.  "_GetAspectRatio", referenced from:
    31.      __Z19RegisterMonoModulesv in RegisterMonoModules.o
    32. ld: symbol(s) not found for architecture armv7
    33. clang: error: linker command failed with exit code 1 (use -v to see invocation)
    34.  
    The odd thing is on my machine it builds fine. But its not building right on one of the others machines in the office. Basically we are all running 4.3.1 with iOS 5.1 on Lion. We only build to Arm 7 devices (no pre 3GS) and i've verified in the build settings that it is indeed arm 7. Any clue at all what might cause this?

    Cheers
     
  34. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Sorry to hear one of your machines is giving you trouble

    That doesn't look good. Can you confirm that is my XCode 4 lib and it hasn't become corrupt along the way please?
     
  35. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    I confirmed it was referencing the proper .a file... what was strange though was copying the file manually to the build machine causes it to work. its like svn was somehow monkeying with the file.. have you ever heard of anything like that?
     
  36. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    svn comes with a builtin ignore of *.so and *.a which always catches me out. Although that doesn't sound like your problem. Glad you have it working at least...
     
  37. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    @Amitloaf

    We ran into the same issue.. basically SVN is mucking w/the .a file thats included in the source folder in your project. The only way we were able to get it to work was to physically COPY the .a file over to the machines doing the build and go from there. I'm not sure whats happening exactly (we're still trying to figure out what svn is doing to the file) but that will fix it. Not perfect.. but gets you going..
     
  38. Amitloaf

    Amitloaf

    Joined:
    Jan 30, 2012
    Posts:
    97
    Yes, I just found that out myself. Thank you. I just re-imported the package where I needed it and only imported that .a file.
     
  39. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Weird, what are the SVN properties on the .a file? It hasn't been imported as text instead of binary has it.

    Eg, this file is binary

    $BinaryProps.png

    And this is text

    $TestProps.png
     
  40. blue2fox

    blue2fox

    Joined:
    Jun 8, 2008
    Posts:
    91
    I'm testing the demo of the plugin on Unity Basic iPhone 3.5, and I get a few errors:

    License Error. Plugins are only supported in Unity Pro
    DLLNotFoundException: theorawrapper

    This is all from the Demo Scene. Does the plugin only work on Unity Pro? Has it been tested to work with xCode 4.3? I hope I can get this plugin working, it looks really promising.
     
  41. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    As far as I could work out Unity Basic doesn't support plugins in editor, hence the DLL Exception. However it does support plugins on device. So while you wont be able to run in editor, it should work on device.

    Let me know how you go and if you confirm this to be the case. I should probably have some code in a #if UNITY_BASIC UNITY_EDITOR or something, to stop it even trying to call the DLL in editor
     
  42. blue2fox

    blue2fox

    Joined:
    Jun 8, 2008
    Posts:
    91
    Hey DTreble,
    it does work on the device. It's awesome. I guess I'll be purchasing my order of the plugin, but it would be great to be able to run it on Unity Basic, or at least get the game running on Unity Basic without having the video load in the editor... Thanks for the awesome plugin.
     
  43. mohydineName

    mohydineName

    Joined:
    Aug 30, 2009
    Posts:
    301
    Hi,

    Is there any way to use alpha transparency in some way? That would be awesome for an explosion effect for instance.

    Stephane
     
  44. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
  45. mohydineName

    mohydineName

    Joined:
    Aug 30, 2009
    Posts:
    301
    But is it included in the demo version? I can t find the new material for this
     
  46. crazyhorse666

    crazyhorse666

    Joined:
    Feb 25, 2012
    Posts:
    37
    hi Stephane, !
    i have downloaded demo version the demo rocketbunny video plays but when i swap for another ogg video it gives an "on opening file error" this file has an audio track is that the problem ?
    how can i strip the audio out if so ?

    Thanks
     
  47. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    Sorry, it is only in the full version. Thanks
     
  48. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    I haven't seen a case where audio causes a file open problem. More likely your path under the StreamingAssets directory is wrong. Can you double check your path please?
     
  49. Super_apple

    Super_apple

    Joined:
    Mar 14, 2011
    Posts:
    31
    Hi ,the Plugins is great!,
    I just want to know that

    Does added the "SeekToTime" function ?
     
    Last edited: Mar 29, 2012
  50. DanTreble

    DanTreble

    Joined:
    Aug 31, 2010
    Posts:
    590
    No, sorry :-(
     
    Last edited: Apr 23, 2012