webrtc beginners setting up fake devices ---- use-file-for-fake-video-capture

6,493 views
Skip to first unread message

webrt...@gmail.com

unread,
Feb 17, 2015, 5:03:55 PM2/17/15
to discuss...@googlegroups.com, davidwi...@gmail.com
Hey guys 

             Thanks for taking the time to help me and I apologize in advance for the long message.


My future plan is  with the two   way chat application I have created  , I have the client and I have the other which is the server laptop I want to set up a Fake-camera or device so when the client answers the call it sees a recorded video file instead of the real camera for testing purposes .  Then I plan to maybe use google chrome internals for stats.or some chrome developer tools and compare different scenarios. 

I  have one laptop which will be the client laptop (windows 8)  and the other  laptop which will be the server/Fake camera (windows 8.1) . Most places I have looked online for this type of tutorial  they seemed to be using linux for this hence my installation of virtual-box. 

Since I am new to webrtc , Im finding it hard   figuring out how to set up the fake camera and where everything goes,  im just  confused  how to do this. I have looked around but haven't found anything in beginners terms..

So far I gatherd that  to achieve this would be these following steps  correct me if Im wrong and missing anything

I need to set up a   v4l2loopback deivce  and v4l2_file_player

Q the best way to achieve this ie for beginners ? 

Then set up the chrome flags on my browser so when I start the browser it looks for the fake device then points to the video file I want to play,. I was reading that these flag command will achieve this

--use-fake-device-for-media-stream Use fake device for Media Stream to replace actual camera and microphone. 
--use-fake-ui-for-media-stream Bypass the media stream infobar by selecting the default device for media streams (e.g. WebRTC). 

---use-file-for-fake-video-capture Use an .y4m file to play as the webcam.  
 

Q Which  flags do I need to use to achive this do I use all 3  ?   and how to tell the browser to use them in linux  ? do these flags work best  in chrome or chromium?


Q Will this test scenario  work with my simple application?


Below is my application and set up


My Application 
I created a 2 person chat-room using the peer js framework. so in my application I am using what can be described a "Sneeker-net" for signaling , ie  I am manually sharing a peer id with the person I want a chat with via giving them my id i a email lets say. its use the stun and turn servers to make our connections  its a simple peer to peer chat with Html5 and JavaScript which uses the peerjs API.  This two way application works fine when locally ran off my wamp server or hosted live online.


My set up 

I have two laptops both windows machines  8 and 8.1. I have virtualbox set up the windows 8.1 
Before virtual box set up I was using wamp server  host locally. Now on my virtual box I will set up a Lamp server to view localhost on the other machine.


Many thanks to anybody who takes time out to help me as I said im very grateful and only a beginner at WebRTC. and apologize is this posted twice.

Cheers webrtc newbie

Benjamin Schwartz

unread,
Feb 18, 2015, 1:18:01 PM2/18/15
to discuss...@googlegroups.com, davidwi...@gmail.com
I don't think Chrome currently supports v4l2loopback, because its virtual device looks like a TV capture card, not like a webcam.  Maybe you should patch v4l2loopack to look more like a webcam.

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dedode winweb

unread,
Feb 19, 2015, 3:39:03 PM2/19/15
to discuss...@googlegroups.com, davidwi...@gmail.com


Hi Benjamin thanks for the reply,
                                               So does that mean the v4l2loopback only works with  the Chromium browser or with what browser  so ? cause I want to use the v4l2loopback device and v4l2loopback file player  and in conjunction with  flags such as 
        --use-fake-device-for-media-stream Use fake device for Media Stream to replace actual camera and microphone. 
              --use-fake-ui-for-media-stream Bypass the media stream infobar by selecting the default device for media streams (e.g. WebRTC). 

---use-file-for-fake-video-capture Use an .y4m file to play as the webcam.  

 I have been researching  and I see there is a hack for this it seems a bit complicated fo https://code.google.com/p/chromium/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Pri%20Mr the moment 20Iteration%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified&groupby=&sort=&id=142568.  

Basically what I want to do is     have a two way webrtc call and instead of seeing my camera a file plays instead  using this 
-use-file-for-fake-video-capture Use an .y4m file to play as the webcam. and then test it   
if there is  any better or  easier way to achieve this Im open to suggestions 


My story  so far , I have installed 

The  v4l2loopback device which I installed in the root 

The gstreamer and bad plugins and gstreamer tools which is needed for the v4l2loopback player  

My next step is to setup/install the v4l2 file player 


Thanks for the information and  anybody who takes the time too look at my problem

Much appreciated 

Benjamin Schwartz

unread,
Feb 19, 2015, 4:07:28 PM2/19/15
to discuss...@googlegroups.com, davidwi...@gmail.com
Chrome and Chromium do not work with the standard v4l2loopback.   As you found (in https://crbug.com/142568), you have to use a modified v4l2loopback.

Patrik Höglund

unread,
Feb 20, 2015, 7:08:22 AM2/20/15
to discuss...@googlegroups.com, davidwi...@gmail.com
Hi!

That's great to see you want to build new and exciting services on top of WebRTC :)

Why don't you just make your server laptop use --use-fake-device-for-media-stream --use-file-for-fake-video-capture=/path/to/video.y4m? That will make Chrome pretend video.y4m is the video flow from the webcam and it will ignore any other webcams on the system. You can also hack v4l2loopback like I did, but that's way harder and requires knowledge of developing kernel modules. We used to use the hacked v4l2loopback but found that using the flag was much, much simpler.

/ P

Dedode winweb

unread,
Feb 20, 2015, 10:44:42 AM2/20/15
to discuss...@googlegroups.com, davidwi...@gmail.com
Thanks Patrick and Benjamin  for the reply and the time you took to help me out.

Patrik your suggestion is brilliant and that's exactly what I need :) . I have seen the hack  and it looks a bit complicated for a beginner like me especially when time is against me.  Im going lookinto how to use the  --use-fake-device-for-media-stream --use-file-for-fake-video-capture=/path/to/video.y4m today with chrome and my application.


Thanks a million 
go raibh maith agat a milliún

prachi....@gslab.com

unread,
Jun 19, 2018, 6:48:55 AM6/19/18
to discuss-webrtc
Hi ,

I am also trying to use fake video instead of using actual webcam in our webrtc solution. 

I tried setting chrome options like  --use-fake-device-for-media-stream --use-file-for-fake-video-capture=/path/to/video.y4m  and then use this while initializing chrome driver. 

But I am getting below error :
NotReadableError: Could not start video source  

Not sure what might be causing this. I am using latest chrome version. Can someone pls help me here ?
Reply all
Reply to author
Forward
0 new messages