BlackMagic Integration #126
-
Is there a best practice or suggestion for integrating BlackMagic input into MediaPipe4U? We currently have other parts of the system utilizing Render Targets. Is it possible to also send these Render Target Texture frames to MediaPipe4U or should we use a different Image Source? Thank you! Great plugin. |
Beta Was this translation helpful? Give feedback.
Replies: 19 comments 14 replies
-
The UE BlackMagic plugin produces a MediaBundle with a MediaPlayer & RenderTarget. I can use Blueprints to downscale the RenderTarget, flip it, crop it, etc. Can I feed that RenderTarget into MediaPipe4U? https://docs.unrealengine.com/4.26/en-US/WorkingWithMedia/ProVideoIO/BlackmagicQuickStart/ |
Beta Was this translation helpful? Give feedback.
-
Theoretically this is possible, you need to implement an Image Resource yourself(Inherit from interface), you must use C++, because some API blueprints are not accessible, refer to the .h file of GstreamerImageSource, but I haven't done much help code for this requirement, maybe it will be hard , the key thing is that you can't copy images in memory, which will introduce latency. |
Beta Was this translation helpful? Give feedback.
-
MediaPlayer can be used as an image source, I don't know if that will help you. Refer: |
Beta Was this translation helpful? Give feedback.
-
Yes I did see that. I just had concerns because I need the HD footage to display on screen, but the MediaPlayer Image Source does not support horizontal inversion & resolution limits. GStreamer seems to support BlackMagic decklink. Think that would be difficult to implement? https://gstreamer.freedesktop.org/documentation/decklink/decklinkvideosrc.html?gi-language=c |
Beta Was this translation helpful? Give feedback.
-
If gstreamer supports it, then this would be easy to implement, but it need gstramer custom command feature, I can support gstreamer pipeline command yourself in the next version. The only thing you need to know is how to write the gs pipiline command, like this:
|
Beta Was this translation helpful? Give feedback.
-
The M4U static image source is very special, it is half-synchronous processing (poll mix observer) internally, and the other sources are observer for all, which will bring a lot of latency, and close some "stream" feature of mediapipe. So dont use static image source as stream. The latest M4U can work at 25 fps (AMD 3600, 720p video), 12 fps is too slow. |
Beta Was this translation helpful? Give feedback.
-
Understood. As I've been working I came across two use cases for 'gstreamer pipeline command'. One for the BlackMagic and one for Image Sequence (I tried using Media Player but it results in a consistent crash). https://gstreamer.freedesktop.org/documentation/multifile/imagesequencesrc.html?gi-language=c I believe my colleague has been talking to you about licensing for our projects. Is it possible this feature could be added some time this week so we can make our deadline? Thank you! |
Beta Was this translation helpful? Give feedback.
-
It's not clear to me that MediaPlayer "crash" you mean the M4U causing it to crash? If so, is it possible for you to give me a simple reproduction step? Media issues get tricky in UnrealEngine because Epic doesn't support access D3D textures, which are in the GPU and the only way in UE is copy them to the CPU, it is will bring a lot of performance cost, which is why I don't recommend using mediaplayer, GStreamer is the most convenient solution for working with media at this time, it has a good pipeline design that supports accessing textures directly from the GPU or CPU instead of copying them. BTW, are you using C++? Blueprint may not be able to complete this job. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Sorry, I can‘t promise the release time of the next version, because there are still many bugs to be fixed, there is a lot of code in plugin, it usually takes several hours to fully compile. So, frequent release versions become very difficult. Fortunately, I just found out the latest version already supports custom GStreamer pipeline command, using the example of opening a file:
You can found the full command string in log. And your can call Two things:
|
Beta Was this translation helpful? Give feedback.
-
This may require you to be familiar with GStreamer usage, but I don't think it's that difficult, good luck ! 😄 😃 |
Beta Was this translation helpful? Give feedback.
-
Forgot, the final frame conversion in RGBA format is also required.
|
Beta Was this translation helpful? Give feedback.
-
That's great, thank you! I will try out GStreamerImageSourceComponent::StartGStreamerLaunch tomorrow and see how it goes 🚀 Is it possible to run that Async as well so the game does not freeze while it is trying to start? Sorry for so many requests 😅 |
Beta Was this translation helpful? Give feedback.
-
use |
Beta Was this translation helpful? Give feedback.
-
Lastly, when you use the |
Beta Was this translation helpful? Give feedback.
-
Ah OK so I call I'll try my best to learn some of the GStreamer commands. Do you happen to have one handy for what happens when you run Afterwards I'm happy to post the commands I come up with for Image Sequences & BlackMagic so you can incorporate them as features if you like. |
Beta Was this translation helpful? Give feedback.
-
@endink One issue I am noticing however is when I use Unreal vs GStreamer->AutoVideoSink I am taking the texture from MediaPipe and drawing it to a Render Target (my application displays the users camera feed as part of the game). |
Beta Was this translation helpful? Give feedback.
-
I fixed this Color Space issue as well. You need to run the texture returned from MediaPipe through |
Beta Was this translation helpful? Give feedback.
-
It's a RHI issue? https://forums.unrealengine.com/t/utexture2d-createtransient-and-srgb/580979 |
Beta Was this translation helpful? Give feedback.
Sorry, I can‘t promise the release time of the next version, because there are still many bugs to be fixed, there is a lot of code in plugin, it usually takes several hours to fully compile. So, frequent release versions become very difficult.
Fortunately, I just found out the latest version already supports custom GStreamer pipeline command, using the example of opening a file:
You can found the full command string in log.
And your can call
GStreamerImageSourceComponent::StartGStreamerLaunch
in blueprint, It accepts a pipline command string as a parameter.Two things:
appsink name=mediapipe…