Download

Any ideas on how to get a webcam stream into Unreal Engine?

Hey all,

I’m (very) new to UE and game engines in general. Not a programming noob per se but my experience in the past is many years of single threaded scientific calculations (academia) in mostly Fortran, Matlab and AS3 for fun. Learning C++ doesn’t worry me though because a language is just a language.

I’ve just signed up to UE as I have some fun ideas I’d like to try out and the blueprinting thing looks super easy to use for me to throw stuff together. I’ve got a Rift DK2 ordered and am looking to shift to being able to develop stuff that can use it.

One of my project ideas would need a webcam feed in game. I know this isn’t supported out of the box right now and so ‘something’ would need to be implemented in C++. Can anyone point me in the right direction, give me any suggestions on how I would go about doing this? Googling brings up some vague UDK results about ‘dllbind’ - is this still how things like this are done?

Edit: I’m reposting this from before the forum’s data loss courtesy of Google’s cache of the post.

One way from the top of my head is to host a webcam service via HTTP. Then simply stream the site directly onto a surface in UE4. Here is an example, compliments of Rama actually since it is his video. :slight_smile: (That guy sure is talented isn’t he? Ha.)

https://www.youtube.com/watch?v=eo7rFaUlC9w

Thanks for the suggestion. I’m guessing that would likely add too much lag to the webcam stream (HD) so might have to wait until someone clever adds integrated webcam support. The idea of streaming in HTTP is interesting though and has given me some other ideas I’d like to try out. Did Rama do a tutorial on how to do that? I’ve been looking through the wiki and I can’t find any hints on how to do that.

Have you read Mike Fricker’s thread here? He’s working on integrating twitch into the engine. He might be able to point you in the right direction.

It’s not a direct way, but works okay. It has some performance lag because of double memory copying, but it’s the fastest solution.

To make it direct way, you have to write stream reader from code. It’s not a trivial task. Check what Epic’s doing with Twitch.

Amazing, thank you ufna. I haven’t been able to work out how to get it installed yet or set up - very new to UE4 and engines in general and am still going through the UE4 tutorials. Will probably need to wait until you’ve got a Blueprint version of your plugin working (or I’ve learnt how to do the C++ stuff and learnt how to use your plugin).

Hi, Have you found any tutorial regarding this? I’m surfing and struggling for the same scenario, If you give some guidance by your past one year work that would be grateful.

I have been using Streaming Video Provider to stream with my webcam. Their platform is just awesome:

http://www.streamingvideoprovider.com/live-video-streaming-live-broadcasting.html#webcam

Just to follow up on this thread, an [FONT=Courier New]ILiveStreamingService (twitch) provides the [FONT=Courier New]UTexture2D from the webcam. That texture isn’t provided by UE4, but provided by Twitch or whomever implements [FONT=Courier New]ILiveStreamingService. Still looking for a way to easily get webcam frames.

Hello!

I made a plugin today to access the webcam via DirectShow, if anyone stumbles in here, feel free to have a look :slight_smile:

Best regards,
Temaran

I found a solution to this in 4.15 using Unreal4AR, I downloaded their demo version and the plugin they use is relatively straight forward but might take some tinkering to get it to work how you would like. http://www.unreal4ar.com/ Click download plugin and select the demo.

Hi,

I’ve created a video tutorial showing how to get webcam into Unreal Engine using Lightact media server (see the link below). All the necessary links are in the video’s description.

I would be happy if you guys can give it a go and let me know how you find it.

Cheers,
Mitja