Search Unity

[Released] AVPro Movie Capture

Discussion in 'Assets and Asset Store' started by AndrewRH, Jan 24, 2012.

  1. OneclickUnity

    OneclickUnity

    Joined:
    Dec 15, 2015
    Posts:
    4
    I need to record both sources, 'Unity' and 'stereo mix' at the same time. Any solutions?
     
  2. OneclickUnity

    OneclickUnity

    Joined:
    Dec 15, 2015
    Posts:
    4
    I need to record both sources, Unity and 'Stereo Mix' at the same time. Any solutions? Thanks :)
     
  3. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Sorry for the late reply!
    Yes I think you can do this with option2. If you create a second camera that renders your scene AND the webcam then set AVPro Movie Capture to capture just this invisible camera, it should work. This of course means rendering your scene twice which may not be ideal if you scene is very heavy. In which case you may be able to render your scene to a RenderTexture then simply have a 2nd camera that just displays that RenderTexture+the webcam overlay which MovieCapture is set to capture by being in camera capture mode. Your main camera then would render the RenderTexture to the screen. This should be very optimal.
    Thanks,
     
  4. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    That's very strange. Using the UI it basicaly just calls StartCapture as well..Are you capturing audio as well? It may be related to audio capture, if ti has to spawn the audio capture component dynmically then this could cause some sync delay...
     
  5. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    That's very odd. we've had some reports of it not capture sometimes outside of the editor. We'll definitely investigate this. My hunch is that it's related to multi-threaded rendering, so you could try to disable this (it's in the Player Settings, you need to enable Debug view in the Inspector and then toggle MTRendering).
     
  6. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Most Unity shader don't write a useful value into the alpha channel, they just use their alpha channel to blend into the backbuffer so in general to get an alpha buffer out that is useful for compositing you would need to modify the shaders to write their alpha values out correctly. We'll try to provide a demo of this in the next update.
     
  7. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes, if you modify the scripts you could do this indeed. I think one of the samples shows you how to manually control a recording so this should be all that you need to start with.
     
  8. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Thanks for reporting this error, we'll fix this in the next update. If you're forcing an audio device index though, you shouldn't need to have the AVProUnityAudioCapture in your scene as this is what captures audio from Unity and not from an audio device. We'll fix this issue though. Thanks,
     
  9. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Not out of the box. It could be modified to do so though. We'll try to provide an example / component for this in the next update. Thanks,
     
  10. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    You should be able to capture alpha from the editor window. In the "Visual" tab there is an option "Support Alpha". Which codec were you capturing with? Were you doing real-time or off-line capture? Were you capturing audio at all? Thanks,
     
  11. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    1) WebCamTexture isn't that great....that's why we build our plugin AVPro Live Camera - it better supports higher resolution cameras.. you would have to ask Unity why WebCamTexture doesn't perform well at 1080p...

    2) Which component were you using to capture? I would recommend either AVProMovieCaptureFromScene or AVProMovieCaptureFromCamera. The other option AVProMovieCaptureFromTexture is actually very slow... this is something we're going to be fixing in the upcomign release.

    Thanks,
     
  12. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    So AVProMovieCaptureFromTexture is actually VERY slow and I wouldn't recommend it for real-time captures. Instead you should use one of the other two components as they actually capture directly from the GPU and are very very fast and don't generate Mono garbage as AVProMovieCaptureFromTexture does. We are going to fix AVProMovieCaptureFromTexture in the next update of the plugin so that this is no longer an issue.

    Thanks,
     
  13. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Thanks very much for reporting the crash and for these great reproduction steps!! We're currently looking at AVPro Movie Capture so we'll be addressing this issue soon.
    Thanks again
     
  14. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    I think what he means is Stereo Mix should contain both the Unity audio and the microphone audio if you've set things up correctly. We actually outline these steps in the PDF documentation for the plugin. In Windows control panel you can set it to "listen" to the microphone so that the recording audio will play through the speakers. If you have a Stereo Mix recording source (it may be hidden) then you can enable it and recording from it will have both audio sources.
     
  15. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    135
    What is the limiter on the captured size and framerate of the final movie output. Is it tied to CPU speed/Memory or GPU or both?
    Basically to do something at say 1920x1080 and 30-60fps to get it silky smooth what would should be the rigs focus? Right now getting stutters and its just not smooth. 2D game runs fine, 200 + fps very smooth until start recording then i see it degrade both in editor and recorded video. Anything else I should look at. Thanks.
     
  16. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi,
    When the capture is running it can slow down the game to get a smoother capture result. You can disable these options if you want on the component (they're both under the Performance heading). It very much depends on the codec you're using to encode the video. If you're using uncompressed, then probably your disk writing speed will be the bottleneck. If you're using a codec then it will likely be the bottleneck. Picking the right codec and tuning it's settings correctly is key. We've had great results with x264 and Lagarith codecs and there is more information about these in the PDF manual. Of course we're always striving to improve performance. If you have a specific case that isn't performing well, you can email us unitysupport@renderheads.com with your scene so we can try to improve things.
    Thanks
     
  17. egoquat

    egoquat

    Joined:
    Jul 4, 2012
    Posts:
    93
    Hi.
    AV Pro capture "Movie capture demo.scene" seems to be captures full area of monitor, my question "Possible to capture only specific Area like '0, 0, 200, 120' on AV Pro? "
     
  18. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    No this isn't possible currently. You could though render that region with another camera and then use the FromCamera component to just grab what that camera can see. We plan to add the area support in the future. Thanks,
     
    egoquat likes this.
  19. ywj7931

    ywj7931

    Joined:
    Jun 24, 2015
    Posts:
    41
    I tried to reduce the recording bitrate in x264vfw - h.264/mpeg-4 avc codec

    It works if I configure in window editor and record in editor.
    but doesn't work in game (Movie Capture From Caemra script).
    How to solve the problem?
    I tried to install virtualtub and in video->compression, I changed the setting, but the setting doesn't apply to my recording in game, do I need to somehow apply the change?
     
  20. ywj7931

    ywj7931

    Joined:
    Jun 24, 2015
    Posts:
    41
    mp4 cannot get audio anyhow, use uncompressed audio (-1) will crash.
     
  21. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi,
    Are you writing to MP4 or AVI file?
    The reason the recorder is working different in the game/build is because of 32/64-bit differences. Your Unity is probably 64-bit, but perhpas you're making a 32-bit build. The codec has separate configuration for 32-bit and 64-bit, so if you're using both then you need to configure both.
    I hope that helps solve you issues.
    Thanks,
     
  22. pchuri

    pchuri

    Joined:
    Aug 18, 2014
    Posts:
    12
    Hello,
    I purchased your product. It is very useful!!

    I tried to capture 360 degree video.
    Most of the functions work well, but the orientation of the camera object looks different from the capturing direction. It seems that the movie is always taken with (0,0,0) rotation.
    Is there any way to turn around when capturing a 360 degree video?

    I look forward to hearing your response.

    Thank you.
     
    Last edited: Mar 6, 2017
  23. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes, we are about to release a new update that includes support for camera rotation while in 360 degree mode.
    Thanks,
     
  24. AndrewRH

    AndrewRH

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

    AVPro Movie Capture version 2.96 has just been released!

    You can find the updated version on the Asset Store and the free trial version / demos on our website.

    Changes include:

    Improvements
    • 360 surround capture can now render uGUI elements when canvas is set to camera or world modes.
    • 360 surround capture now supports camera rotation
    • Fixed 360 surround capture orientation, as it was flipped horizontally
    • Improved motion blur support in 360 camera capture
    • Added Media Foundation capture option to Editor window
    UI / Workflow
    • Editor window UI improvements, including context hiding and usage warnings
    Bug fixes
    • Fixed FromCamera capture bug where build captures would render black to the screen
    • Fixed bug where editor window would unnecessarily spawn AudioCapture component
    • Fixed bug where audio capture component would be accessed when it shouldn’t
    • Fixed crash bug in webcam demo
    Thanks,
     
    Last edited: Mar 7, 2017
  25. pchuri

    pchuri

    Joined:
    Aug 18, 2014
    Posts:
    12
    Thank you.
     
  26. InteractiveMediaDev

    InteractiveMediaDev

    Joined:
    Aug 9, 2016
    Posts:
    12
    Hi,

    I recently bought this plugin for an application I am working on. It needs to record a webcam (video and audio) feed and save the recording to a file (MP4 would be preferred, but I'm ok with AVI). I'm using the Capture from Camera component, while displaying the web cam feed using a WebCamTexture (added to a RawImage component on a canvas). I then use the video codec "x264vfw" and audio codec "uncompressed" and set the audio source to be the camera's microphone, and I save out to an AVI file. However, the audio and the video are not synced. I have also tried numerous other video codecs, including the Largarith Lossless Codec, and some others that were listed (DV Video Encoder, MJEP Compressor, etc), and different audio codecs that were listed (IMA ADPCM, PCM, Microsoft ADPCM, MPEG Layer-3) and they all have the sync issue. I also tried saving to an MP4 file using the same codecs (x264vfw and "uncompressed" for audio), but I get a "Failed to create recorder" error. I then tried the same settings and saving to an MP4 file with "Use Media Foundation H264" option checked, but the recording lags so I can't tell if the audio is synced or not (turning off audio recording fixes the lag issue, but doesn't solve my problem since I need audio).

    Any help would be greatly appreciated, thank you.
     
  27. jbdDiota

    jbdDiota

    Joined:
    Oct 20, 2016
    Posts:
    2
    I tried it, but to no avail. I didn't have much time to test these past few months, and I also forgot to say that I am using another C++ DLL that has access to the GPU buffer. I am a bit familiar with the concurrent stuff happening inside the GPU, but I don't see why it would work in the Editor and not outside. I will try using the plugin without the other C++ DLL and report my results here.

    EDIT : Removed my other C++ DLL, same result. In a blank project, the plugin works, so the issue reasonably comes from my code, but eh, does not mean I know where or why ^^

    EDIT EDIT : Well... After a full clean of my computer, it's working now, so I assume it was an issue on my part, but I won't be able to tell you what it was. Still, I still have a few issues, but now it's definitely working, so the rest can wait. Thank you for your time though :)
     
    Last edited: Mar 22, 2017
  28. Ice_Time

    Ice_Time

    Joined:
    Jun 29, 2016
    Posts:
    5
    Hello,
    Could the plugin capture the mouse's motion?
    Thank you!
     
  29. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Glad you found the solution at least :)
     
  30. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes, you would need to use the "FromScene" capture method, and then use the script attached to render the mouse cursor. We will include this feature in the next update to the plugin.

    Thanks,
     

    Attached Files:

  31. tampa

    tampa

    Joined:
    Nov 10, 2014
    Posts:
    3
    HI,AndrewRH
    I want to use the DLL x264 development and DLL Lav development,What should I do?
    Do you have this aspect?
     
  32. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    I'm not 100% sure what you're asking, but if you install any codec (even a development version) then it should get picked up by the plugin. You'll have to register the DLL / AX file in the standard DirectShow way using regsvr32.exe if there isn't an installed. I don't think the Lav DLL will work well with AVPro Movie Capture because it contains multiple codecs and doesn't let you set which one to use via the GUI...
     
  33. tampa

    tampa

    Joined:
    Nov 10, 2014
    Posts:
    3
    Is there some developer version of DLL x264 that i can use some of functions in it to implement the functions which i do with x264.exe?
     
  34. prisonerjohn

    prisonerjohn

    Joined:
    Jul 31, 2013
    Posts:
    28
    Hello,

    I've got a couple of questions on this package:
    • My Unity project includes many AVPro Video players, the videos are h264 and I'm using the Windows Media Foundation player. If I use AVPro Movie Capture to record my scenes, will the videos automatically play frame by frame or is there an additional step required to get them to do so?
    • I'm looking into exporting 360 equirectangular video (for Gear VR playback), but I can't tell if this plugin can record stereo video or if it's only one eye.
    Thank you!
     
  35. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    yup, there is x264vfw which you can download and install. We cover this in the PDF documentation including how to set it up. It has a section where you can enter parameters, so you should be able to match the x264.exe options. -Thanks,
     
  36. AndrewRH

    AndrewRH

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

    1) It depends which codec you use to record the videos with. If it is something like Lagarith - then no it will not, because Media Foudnation has no support for Lagarith codec, so you would have to switch the API to DirectShow. If you recording using the x264 encoder or the Media Foundation MP4 option then it will play. If you can let me know which codec you're using I can tell you whether it'll be supported (or you can just test it :). I'm not sure what you mean frame-by-frame - it sounds like you want to encode the videos in a way so that you can nicely scrub through them. This should be possible as long as your videos are encoded as only key-frames and don't contain a lot of P or B frames. This can usually be set in the encoder settings. For example you can set this in the x264 encoder settings. Again let me know more about your case so I can give a better answer because it depends very much on the codec used.

    2) AVPro Movie Capture does support 360 equirectangular rendering, but it doesn't support stereo. This is a feature we're looking to add soon though.

    Thanks,
     
  37. govi627

    govi627

    Joined:
    Jan 30, 2013
    Posts:
    20
    Hello!

    I've had some success with your awesome plugin so far. I am having a problem recording an mp4 video in real time.I am using the camera capture script you provided.

    When I stop capturing the game hangs/stalls for about 15 seconds before continuing. The video looks great, but what can be causing the long hang? When I have uncompressed audio enabled the app hangs. When I have no audio the capture becomes very choppy. Any tips? Thank you @AndrewRH

    Joe
     
  38. prisonerjohn

    prisonerjohn

    Joined:
    Jul 31, 2013
    Posts:
    28
    Thanks for the quick response, Andrew! Some follow up questions:

    1. My assumption is that AVPro Movie Capture will slow down the playback rate of my Unity scene, meaning that updates need to happen on a frame-based time delta (vs time-based). The scenes I want to record include videos playing back on quads, and my question was specifically about forcing these videos to keep time sync with the rest of the scene. Do I need to do something extra to make sure that, for example, my video is on frame 67 when the rest of the Unity animation is on frame 67? Does the choice of encoder for these playing back videos really affect the capture, isn't it all just pixels once it's rendered through the camera? To answer your question, all my videos are encoded in H.264, and I'm just using the default value in Adobe Media Encoder for "Key Frame Distance". Should I change that to 1?

    2. Do you have an ETA for when stereo rendering will be available?

    Cheers,
    Elie
     
  39. AndrewRH

    AndrewRH

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

    I think this pause is because the video capture is queueing up frames to compress and when you stop the capture it needs to process all of the remaining frames. We also have an option to skip these pending frames (a boolean parameter in the StopCapture() method) but this may cut off the end of your video capture session. I guess if you have a faster PC or capturing lower resolution it should be able to keep up with the capture better and therefore have a smaller queue to process at the end of the capture.

    15 seconds though does sound like a very long time.

    I have a few questions for you:
    1) Are you capturing to mp4 using the x264vfw codec, or the new experimental Media Foundation mp4 option?
    2) What resolution and frame-rate are you capturing at?
    3) What is your CPU spec and HDD/SSD type?

    I'll do some tests with these different audio settings. Thanks,
     
  40. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    1) Ahh, sorry I misunderstood your question. If you are capturing in real-time then the video playback will be in real-time too, so as long as the video playback is fast, it should capture all of the frames just fine. Having a video that is optimised for fast playback will definitely help though, so like in H.264 encoding there are many optimisations you can do (such as disabling CABAC, disabling B-frames, having a smaller GOP - key frame distance etc). Certainly if you're using the offline capture option then Unity will not run in real-time and your videos then really might need to have a small key-frame distance to make seeking fast. IF you're using AVPro Video there is a special option in the Global Settings section which allows the video player to slow down or speed up based on the non-real-time capture time that is used during offline video capture. In order for this to happen quickly (so your captures don't take ages) having the video optimised for playback will definitely help.

    2) We hope to have a version with this feature in about a week.

    Thanks,
     
  41. prisonerjohn

    prisonerjohn

    Joined:
    Jul 31, 2013
    Posts:
    28
    1) Ok thanks, I'm assuming the special option you're talking about is "TimeScale Support"? I can re-export the videos if necessary, what is the ideal format and options you would suggest for my playback videos?

    2) That's great news, I'll keep an eye out for this.
     
  42. govi627

    govi627

    Joined:
    Jan 30, 2013
    Posts:
    20
    hey thanks for quick reply,

    I tried the StopCapture(true) with no noticeable change. There actually was quite a drop in freeze time when reducing resolution from 1440p, to 710x411 in editor from 15 seconds to 5 seconds. So there is still freezing just shorter.

    Your questions:
    1. Yes I am using mp4 + x264vfw with recommended settings from docs.
    2. Recording at 2560 x 1440, I set the downscale to half(does this matter much?)
    3. CPU Intel core i7-3820, 24gb ram, NVIDIA Geforce GTX 980.

    Thanks for taking the time.

    EDIT: Oh forgot HD type. It is HDD
     
    Last edited: Mar 31, 2017
  43. InteractiveMediaDev

    InteractiveMediaDev

    Joined:
    Aug 9, 2016
    Posts:
    12
    Hi AndrewRH,

    Are you able to assist me with the issue I posted about in #426 of this thread?
     
  44. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi, I've literally had the reply in "draft" for ages and didn't hit send. I'll post it now :)
     
  45. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    To save to an MP4 file when using the x264vfw encoder you need to install a 3rd party MP4 handler. In the documentatoin we describe how to install GDCL-MP4 filter. This is probably your best bet as H.264 works better in an MP4 container as AVI files don't support all of the features.

    The Media Foundation H.264 option currently doesn't support recording from a microphone. We aim to address this in the next update.

    I hope that using the GDCL-MPEG4 filter helps to solve your issue.

    Our of interest - which webcam are you using? I'm testing here with codecs like Lagarith and not having any issues with audio sync...

    Thanks,
     
  46. InteractiveMediaDev

    InteractiveMediaDev

    Joined:
    Aug 9, 2016
    Posts:
    12
    Hmmm I already installed the GDCL-MP4 filter. I did it again just to make sure, and now Unity crashes when I try to record a video using the following settings - Realtime, Video codec: x264vfw - H.264/MPEG-4 AVC codec, Audio: Using Audio Source Desktop Microphone (Studio-Microsoft LifeCam) and using Audio Codec MPEG Layer - 3. File name is set to MovieCapture.mp4. If I use Audio Codec Uncompressed it records but the audio is still not synced. I'm using a Microsoft LifeCam webcam.
     
  47. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Also make sure that you're configuring both the 32-bit and 64-bit versions of x264vfw and installing 32-bit and 64-bit GDCL MPEG4 filters. Thanks,
     
  48. InteractiveMediaDev

    InteractiveMediaDev

    Joined:
    Aug 9, 2016
    Posts:
    12
    I've done the configuration for the 64 bit version of x264vfw, I'm not sure how to change it so that I'm setting the 32 bit version. I'm running this in the Unity editor so it should be using the 64 bit regardless.

    This is what I ran to install the GDCL MPEG4 filters:
    "regsvr32.exe "C:\Downloads\x86\mp4mux.dll"
    regsvr32.exe "C:\Downloads\x86\mp4demux.dll"
    regsvr32.exe "C:\Downloads\x64\mp4mux.dll"
    regsvr32.exe "C:\Downloads\x64\mp4demux.dll"
    pause"

    and I got a "DLLRegisterServer in <path> succeeded" for each. If I switch to using Unity scene as the audio source, it seems to run for a bit but then Unity freezes and crashes.

    Edit: If it helps, I am using Win 10 and Unity 5.5.2.
     
  49. IndyJones

    IndyJones

    Joined:
    Aug 12, 2015
    Posts:
    1
    If I capture offline, will it add the audio also? Example, recording I might get 10 fps, will it still add the audio in sync with the video?
     
  50. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    No, offline capture doesn't support any audio.