Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

[RELEASED] MPMP - cross platform video solution

Discussion in 'Assets and Asset Store' started by _monoflow, Jan 25, 2016.

  1. mml

    mml

    Joined:
    Mar 29, 2015
    Posts:
    11
    Hi _monoflow,
    I would like my mobile project to use Auto Graphics API if possible, but MPMP always forces it to OpenGLES. Are you working on or planning to support Metal on iOS in the future?

    All the best,
    Felix
     
  2. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Metal is on my toDo list. But can't give you any timeframe.
     
  3. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Some customers reported issues on OSX. It could be a problem with the OpenGL version . On my machine (OpenGL 3.3) i have no problems but it seems that with OpenGL 4.1 there is an error. I try to fix this ASAP.
     
  4. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    There is some bug that is OSX related. When you have whitespace characters in your project path the loading of local videos doesn't work. Here is a quick fix for the ones that have problems on macOS:
    Please add this to the script MPMP_API.cs at line 117:
    Code (CSharp):
    1. #if !((UNITY_IOS || UNITY_WEBGL || UNITY_ANDROID) && !UNITY_EDITOR)
    2. //new OSX fix:
    3.             #if (UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX)
    4.             //Debug.Log("No UnescapeDataString on OSX");
    5.             #else
    6.             //For Media Foundation we need to reverse the url encoding to support fancy unicode characters(umlaute,chinese..)
    7.             filePath = Uri.UnescapeDataString(filePath);
    8.             #endif
    9.          
    10. #endif
     
    Muckel likes this.
  5. Muckel

    Muckel

    Joined:
    Mar 26, 2009
    Posts:
    438
    perfect!
    I can admit it works now on Mac OS X Sierra!
    will change my review too ...
    thx
    M.
     
  6. rajju

    rajju

    Joined:
    May 29, 2011
    Posts:
    23
    Hi all,
    We purchased MPMP. But its not working in Linux platform, What can we do? Please resolve our problem.

    Thank you
     
  7. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Linux is not supported!
     
  8. denis-chiriac

    denis-chiriac

    Joined:
    Jan 18, 2013
    Posts:
    1
    Hi monoflow. So I'm having an issue with iOS10 devices.
    It seems that there is a chance the video won't start playing on iOS 10 but it will always play on <= iOS9 devices.

    My project is very heavy in small video clips played one after another and sometimes a video clip would get skipped for some unknown reason.
    Any ideas how can i solve it?

    -From time to time I got the opengl error with some invalid argument. however I doubt that is the problem.
    -I use a custom material for the videos, however the shader uses _MainTex texture property
     
  9. mymurat

    mymurat

    Joined:
    Jun 6, 2016
    Posts:
    1
    I have tested demo version of mpmp, which works quiet nice on most quad core android devices.
    But currently I'm doing some stuff for the fire tv stick version (dual core). And there you see a massive performance issue resulting in countless frame drops and stutters on 2mbit hd videos.Playing these videos with other videoplayer apps on that device runs very smooth. I have tried this with a minimal basic scene. No overlays, only one fullscreen video. Maybe there is some headroom for optimizations ??? Shouldn't it be smooth because of hw acceleration? Would be great if it could work smooth on fire stick.
     
  10. gtg287y

    gtg287y

    Joined:
    Apr 29, 2015
    Posts:
    2
    Hello,

    My objective is to play m3u8 files on the HoloLens. Using the free MPMP demo, I am able to play a m3u8 file successfully. But when I try to build to Windows Store, I get an error on multiple lines, all saying:


    "The name 'DLL_PATH' does not exist in the current context"

    Looking at the code, it appears to define this variable based on how I'm running the code, but there is no option for Windows Store. I see Windows Standalone, Unity Editor, Android, IOS, WEBGL, etc, but no Windows Store.

    Is your code compatible with the HoloLens?

    I do see that I have to download DLLs for windows. I don't know if it's the direct cause for my error (which seems to be about the variable not even being defined in the first place). In any case, I am unsure where to put the DLLs. "(located beside your exe):" is unclear to me. I have no .exe before compile time, and don't think I"ll get one after compile time. In any case, I am unable to download the DLLs because the link goes to a page that lists dlls, but clicking the "Download" button causes javascript errors and no download.
     
  11. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Hi,
    MPMP is not Windows Store compatible ! The dll you are talking about should come with the VCRedist package that comes with MPMP (vcredist folder)
     
  12. rajju

    rajju

    Joined:
    May 29, 2011
    Posts:
    23
    Hi guys,

    MPMP is not working for webgl. What can i do? Please solve my problem.......

    Thanks in advance
     
  13. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Hi rajju. Started a private conversation with you.
     
  14. tcosta29

    tcosta29

    Joined:
    Apr 27, 2016
    Posts:
    6
    Hi guys!
    I'm not able to run MPMP with webgl, the video loads and plays the sound, but the image is grey or something.

    I'm even using your example project.



    I'm using Unity 5.5.0 and 5.5.1 (tried on both)

    Any Ideas?
    Thanks

    Edit:
    I've tested this on the firefox and chrome and getting this error "texture is immutable". On the other hand, with MS Edge the video works as it should.
     
    Last edited: Feb 10, 2017
  15. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    I've sent you a PM.
     
  16. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    For WebGL support you have to set in your publish settings the Graphics API to 'WebGL1.0'. (WebGL 2.0 is the default in newer Unity versions) I will look into this issue.
     
  17. HAInc

    HAInc

    Joined:
    Sep 29, 2016
    Posts:
    7
    Hi monoflow, I may have found a memory leak in MPMP. We first noticed this when a different part of our app reloaded the scene several times in a row, but the memory in Windows task manager kept rising. The memory in Unity's profiler stayed the same and showed no signs of a leak. Over time with enough scene reloads the app would consume all the computer's memory and crash. It looks like it stems from line 387 of MPMP.cs: _id = MPMP_New(isLinear); Looks like it links to code in a DLL.

    I have attached a small demo project to highlight the issue. It's got an MPMP instance with a video, and a script to reload the scene every second. Here's the link:

    https://hyperactiveinc.box.com/s/bg83zu2lw1pg1tmbj590dzjwwlkggt5c

    Running Windows 10 64 bit, Unity 5.5.0f3, Media Foundation Backend

    Thanks.
     
  18. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Hi,
    there are two ways to handle this problem :
    1.you destroy your MPMP instance before you change the scene
    2.you work with DontDestroyOnLoad and make sure that there is no additional instance created when entering the scene a second time.
     
  19. HAInc

    HAInc

    Joined:
    Sep 29, 2016
    Posts:
    7
    Hi, thanks for the quick response! The second option will work as a last-resort option, but because of the way our project is already setup the first option would be preferable. I have modified the scene reloader to also destroy all MPMP instances in the scene before reload (Destroy(), DestroyImmediate(), set to null, GC.Collect(), Resources.UnloadUnusedAssets(), and various combinations of each), but the memory still increases in task manager. From what I've read all objects in the scene should be destroyed on scene load anyway, but if you have a working version or if there is something I'm missing would you mind posting? Thanks again.
     
  20. halleywang

    halleywang

    Joined:
    Mar 2, 2017
    Posts:
    14
    Hi, I want to use VLC to open sdp file in Universal Windows Platform (Windows Store), which can allow me to receive RTP/H.264 on my UWP app.

    Does this package work?

    Thanks :)
     
  21. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    If your MPMP has some callbacks registered you have to destroy the callbacks references before destroying the MPMP instance.
    Like mpmp.OnLoaded = null. Otherwise there could be some references in the background that are not properly cleaned up.
     
  22. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Best is to test it with the demo version: http://workspace.monoflow.org/mpmp/MPMP.demo.unitypackage
    (I never tested it for Windows Store so officialy MPMP doesn't support this platform )
     
  23. BramVDW

    BramVDW

    Joined:
    Aug 4, 2016
    Posts:
    6
    On android, it crashes when loading local files, streaming works. I tried with the included sample video, so it can't be related to the video format.
     
  24. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Please check your Android publish settings : Is Install Location and Write permission set to Internal ?
     
  25. BramVDW

    BramVDW

    Joined:
    Aug 4, 2016
    Posts:
    6
    Setting the Install location to force internal fixed it. Thanks
     
  26. heavior

    heavior

    Joined:
    Mar 10, 2017
    Posts:
    4
    I'm using demo version (VLC) now - testing to decide if it works for me (playing rtsp streams)

    And I have red frame every several seconds. Is it a known issue?


    Second question:
    There is known issue "When using the VLC backend Unity stalls a short amount of time while loading" - is there any workaround?

    I'm working on VR application and stalling for each loading is not an option.
     
    Last edited: Mar 10, 2017
  27. BramVDW

    BramVDW

    Joined:
    Aug 4, 2016
    Posts:
    6
    Red frame is watermark.
    I think it uses a different method on mobile, have you tested if it also stalls there?
     
  28. heavior

    heavior

    Joined:
    Mar 10, 2017
    Posts:
    4
    I don't work with mobile platforms.

    What about "When using the VLC backend Unity stalls a short amount of time while loading" issue - is there any workaround?
     
  29. heavior

    heavior

    Joined:
    Mar 10, 2017
    Posts:
    4
    I tried calling Load function in a separate thread - no effect.


    In Unity profiler I see that the problem is somewhere inside MPMP_UpdateCallbacks function - it takes most of the processing time.

    And it has a comment:
    //On Windows our callbacks must be called on the main thread otherwise the Editor will hang on quit!

    Can't go any deeper - implementation is inside DLL.

    Is there any way to workaround this issue? Maybe with VLC Editor won't hang on quit?
     
  30. BramVDW

    BramVDW

    Joined:
    Aug 4, 2016
    Posts:
    6
    I use this because mobile has no video texture, why don't you just use that if you work with pc?
     
  31. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Hi, unfortunately there is no workaround at the moment for this problem. I try to find a solution.
     
  32. heavior

    heavior

    Joined:
    Mar 10, 2017
    Posts:
    4
    Kinda workaround:

    1. I use a pool of MPMP players and I'm trying to keep streams alive. So in most cases, I don't have to load video again.
    2. I load to that pool as many streams as I can during application load - so user don't have to wait for it during playing
    2. When I have to load a new video - I disable MPMP component for 3 seconds and then run Load function.
    This way MPMP don't call MPMP_UpdateCallbacks (which causes troubles during loading) inside Update() .
    Player glitches only for a couple of frames. When MPMP is enabled again - the video is already good for playing.

    This is not ideal and can't go to a production (there is a glitch still and 3 seconds delay), but good enough for development and testing.

    Please, let us know when you fix the issue.
     
  33. Knusper

    Knusper

    Joined:
    Jun 5, 2014
    Posts:
    35
    Hi dear MPMP developer.

    First of all I'd like to say that this plugin just works fine and nearly seamlessly around all platforms.

    I know that the WebGL version is experimental.
    However I'm facing some problems that you can maybe solve with your deeper knowledge of this topic.

    In WebGL I'm using the MPMP plugin with NGUI for displaying my subtitles.
    And I'm facing a weird rendering error after / while watching videos.

    Some specific letters won't get rendered properly. They are the same in the exactly same playthrough but they can change in another playthrough.
    Fact is that it only appears when videos have been watched. When no video has been watched, then no rendering problems appear.

    It's hard to test because this issue only appears in browsers, not in the editor.


    I also sometimes get the following error.

    Code (JavaScript):
    1. [.Offscreen-For-WebGL-000002078437F8A0]GL ERROR :GL_INVALID_OPERATION : glTexSubImage2D: invalid internalformat/format/type combination GL_RGBA/GL_ALPHA/GL_UNSIGNED_BYTE
    But because it only appears in browser I can't say for sure if this error comes from the videos. But they appear very near those videos.


    My Concept:
    I have a global GUI-Holder which also holds the video player and a handler to control it.
    This player gets activated and deactivated if needed. I never run new instances dynamically.

    But maybe there is an internal logic behind MPMP that's problematic using this plugin that way.

    Please let me know!


    Best,

    Mischaal

    *EDIT*
    This Error was found in Chrome.
    In FireFox I'm getting the following Error while loading the video:

    Error: WebGL: texImage2D: Failed to hit GPU-copy fast-path. Falling back to CPU upload.
    Error: WebGL: texImage2D: Conversion requires pixel reformatting.
     
    Last edited: Mar 23, 2017
  34. Nodrap

    Nodrap

    Joined:
    Nov 4, 2011
    Posts:
    56
    I have been using the demo build to test streaming an mp4 to a mobile and it works fine on Android devices. When I started the iOS builds in the cloud it would fail with unclear errors that didn't seem to relate to MPMP. I assumed it was the ongoing flakiness of the cloud build system at the moment.
    To try and solve this I got access to a Mac and tried to build locally but it complained with lots of errors about MPMP (don't have access to the machine to copy this I'm afraid). Is there something obvious I am missing as I hoped it would be as simple as the Android build. Once this test works we will definitely buy it and use it in a commercial product.

    Thanks
     
  35. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Hi,
    do you have Xcode compiling errros or runtime playing issues in the editor? I wrote in the documentation about issues on OSX. The best is to test for iOS on a mobile device. Non local videos on OSX causes trouble with El Capitan+
    If you have compilation issues with the XCode project please contact me directly .
     
  36. Sybris

    Sybris

    Joined:
    Apr 29, 2017
    Posts:
    3
    Hey, I'm currently having a problem for the android. The apk runs fairly well, but my current problem is that I call Load in Update to load in a video texture once. And sometimes that causes the screen to freeze, but the audio keeps playing.

    Is it possible that the size might be the issues? I'd really appreciate some help on this.
     
  37. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    If you hear the audio but don't see the texture i assume that there is some problem with texture memory. It could be that your video in combination with your unity scene is too much for your hardware. Best is to test it on different hardware. If you are facing the same problem also on other hardware please contact me directly.
     
  38. kyle_h

    kyle_h

    Joined:
    Mar 19, 2015
    Posts:
    5
    Hi, I'm having an issue where I'm getting audio but no video on Android. I'm using .mp4 and have tried other formats. It works fine on PC/Mac/iOS. Any suggestions?

    Edit: I see the person above has a similar issue. For me the screen doesn't freeze, there is just a white texture where there should be video (this was a green texture with the demo version). I checked and I still have ~400MB of RAM left when the app is running.
     
    Last edited: May 4, 2017
  39. Sybris

    Sybris

    Joined:
    Apr 29, 2017
    Posts:
    3
    I still don't have it fixed, but I can tell you that your video file might be too large. The video I was trying to read in was 16 minutes and I've been cutting it down since then to see how small the video file has to be before it stops that problem. So it just might be the hardware limitations and having to work around that.
     
  40. Sybris

    Sybris

    Joined:
    Apr 29, 2017
    Posts:
    3
    Right now I'm having an issue loading in a new file without having the scene freeze. i have two very light files playing on the Android and all I have in the scene is a camera and the inverted sphere from the MPMP folder. Once I hit Load() the scene freezes, the new file loads, but only the audio plays the screen stays frozen on the last shot.
     
  41. kyle_h

    kyle_h

    Joined:
    Mar 19, 2015
    Posts:
    5
    I have 42 very short videos in the scene, with only one player (longest one is ~20", rest are 1-2"). With all of the videos I still have ~400MB of RAM free on the device, so it doesn't seem like it's a memory problem. I don't have any freeze when loading, I just get the audio and a white texture where the video should be. The videos play fine on the device outside of the app.
     
    Last edited: May 7, 2017
  42. kyle_h

    kyle_h

    Joined:
    Mar 19, 2015
    Posts:
    5
    I just wanted to update that monoflow contacted me and helped me realize what I was doing wrong. I tested out my video with the demo scene and it worked fine there, so I compared it with my scene and realized I had set the Y value in the UV Rect of my Raw Image to 1 instead of 0. I must have done this months ago when I was trying to get the Raw Image to work with iOS, and forgot to change it back. These values are changed in the MPMP_ugui_Element script depending on the platform, and Android is the only one where the Y value should be kept at 0.
     
  43. magicseth

    magicseth

    Joined:
    Mar 13, 2017
    Posts:
    1
    Hi, Thanks for the plugin! I'm having some trouble with the basic demo scene on Mac OS X Yosemite. It runs fine in the editor, but when I build and run it never loads.

    "videoPlayer.rate is 0!"
    "force videoplayer to play again"

    Over and over

    Is this a known issue?
     
  44. tripish

    tripish

    Joined:
    Aug 18, 2017
    Posts:
    2
    I'm trying to find a hardware decoding solution for five H264 RTSP streams into Unity 5.6.0b3 on Windows 10 64-bit Professional. I initially tried the VLC backend, but I quickly hit a bottleneck on the resolution I can use on my streams. When I attempt to use the Media Foundation backend, I'm unable to view the RTSP streams whatsoever. All I get is a white screen. It's unclear to where the issue is originating. To isolate the issue, I tried opening the RTSP streams in Windows Media Player and cannot do so successfully, but can in the standalone VLC player.

    Is it possible to create an option in the plug in to enable hardware decoding with the VLC backend? It seems to be accessible via libVLC now.

    https://stackoverflow.com/questions/34675182/how-to-enable-hardware-accelerated-decoding-in-libvlc
     
  45. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Hi,
    i already use the dxva2 option. The problem is that i didn't found a solution to transfer the current video frame from VLC to Unity without an additional transfer from the GPU to the CPU and back. This is the reason why the performance isn't the same like with Media Foundation.
    (But Media Foundation has not the same wide range of supported formats like VLC)
     
  46. tripish

    tripish

    Joined:
    Aug 18, 2017
    Posts:
    2
    I see! Do you have any insight into why I am unable to get an RTSP feed running with the Media Foundation backend? I'm using an IP Camera (Hikvision DS-2CD4185F-IZ) that encodes H.264 over RTSP and uses SDP to describe the stream. For example, the address for the stream is rtsp://IP_ADDRESS:554/live.sdp. I'm assuming everything necessary for Media Foundation comes already installed with Windows 10 Pro 64-bit, so I'm not sure what else could be going wrong. From what I can tell MF supports SDP descriptions.
     
  47. elenzil

    elenzil

    Joined:
    Jan 23, 2014
    Posts:
    65
    Hi -

    I just resolved my problem here, but am posting it anyhow for future seekers.

    I have a somewhat urgent need for advice.

    We're downloading MP4 files into the unity persistentDataPath, with the intent of playing them from there.
    The videos play fine when located in StreamingAssets.

    But even when i modify MPMP_File.cs so that GetFilePath() uses Application.persistentDataPath,
    and confirm that the resulting uri printed by Debug.Log("Load: "+filePath) exists (and plays fine from a browser),
    the playback behavior is consistent with the file not existing.

    I'm testing in Unity IDE on OSX, altho the target platforms are iOS and Android.

    The final path being passed into the DLL via MPMP_Load() is: "file:///Users/me/Library/Application Support/My Company/My App/MyVideo.mp4".

    AHA: The spaces in the path need to be URI-escaped as "%20".
     
  48. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Hi,
    sorry for the issues.
    here i address the issue with white space characters on OSX: https://forum.unity3d.com/threads/r...orm-video-solution.381894/page-9#post-2913645
     
  49. elenzil

    elenzil

    Joined:
    Jan 23, 2014
    Posts:
    65
    hi - thanks for the very speedy reply!

    interesting. I wasn't sure it was just an OSX issue, so i fixed it like this:
    Code (csharp):
    1.  
    2.             //For Media Foundation we need to reverse the url encoding to support fancy unicode characters(umlaute,chinese..)
    3.             filePath = Uri.UnescapeDataString(filePath);
    4.  
    5.             // oxe: .. except that breaks paths with spaces in them.
    6.             filePath = filePath.Replace(" ", "%20");
    7.  
    I've verified that with my modification it still works on iOS (edit:) and on Android.
    You have high confidence the issue is OSX-only ?

    thanks again,
    Orion
     
    Last edited: Sep 6, 2017
  50. NovaDynamics

    NovaDynamics

    Joined:
    Sep 6, 2017
    Posts:
    23
    Hey there! Is it possible to send command line parameters to VLC from unity? I would like to set the param:
    :network-caching=100

    Thanks!
     
unityunity