Previous Thread  Next Thread

chat icon Videotexture Video4Linux2

darkshine

Posted: Wed Sep 28, 2011 11:11 am
Joined: 28 Sep 2011
Posts: 2
Hi People,

im working right now the first time with VideoTextures in Blender.
I have right now a little problem, I know that my webcam is a Video4Linux2 Device - is it possible that it can work with the actual Blender Version?

I saw this post -> http://www.blender.org/forum/viewtopic.php?t=13746&highlight=v4l and I thought - maybe there is already a solution for this? (Because the post is from 2008).


This is the Code that i use - is there something wrong?

Code:

import GameLogic as G
import VideoTexture as VT

def init_world():
   cont = G.getCurrentController()
   obj = cont.owner

   matID = VT.materialID(obj, 'MAvideo')
   G.video = VT.Texture(obj, matID)

   S1 = G.expandPath("/dev/video0")
   video_source = VT.VideoFFmpeg(S1, 1, 25.0, 320, 240)
   video_source.repeat = -1
   video_source.scale = True
   #video_source.flip = False
   #video_source.deinterlace = True

   G.video.source = video_source
   G.video.source.play()
   
   #sound = cont.actuators["a_sound"]
   #cont.activate(sound)

   #G.sound = sound

def update():
   G.video.refresh(True)


Thank you for your help Smile
Reply with quote


darkshine

Posted: Wed Sep 28, 2011 4:07 pm
Joined: 28 Sep 2011
Posts: 2
darkshine wrote:
Hi People,

im working right now the first time with VideoTextures in Blender.
I have right now a little problem, I know that my webcam is a Video4Linux2 Device - is it possible that it can work with the actual Blender Version?

I saw this post -> http://www.blender.org/forum/viewtopic.php?t=13746&highlight=v4l and I thought - maybe there is already a solution for this? (Because the post is from 2008).


This is the Code that i use - is there something wrong?

Code:

import GameLogic as G
import VideoTexture as VT

def init_world():
   cont = G.getCurrentController()
   obj = cont.owner

   matID = VT.materialID(obj, 'MAvideo')
   G.video = VT.Texture(obj, matID)

   S1 = G.expandPath("/dev/video0")
   video_source = VT.VideoFFmpeg(S1, 1, 25.0, 320, 240)
   video_source.repeat = -1
   video_source.scale = True
   #video_source.flip = False
   #video_source.deinterlace = True

   G.video.source = video_source
   G.video.source.play()
   
   #sound = cont.actuators["a_sound"]
   #cont.activate(sound)

   #G.sound = sound

def update():
   G.video.refresh(True)


Thank you for your help Smile


Ok I found a solution Very Happy
I changed in /source/gameengine/VideoTexture.cpp Line: 623

Code:

inputFormat = av_find_input_format("video4linux");


to

Code:

inputFormat = av_find_input_format("video4linux2");


I hope it helps someone Smile
Reply with quote


Thillbucci

Posted: Mon Jan 02, 2012 1:18 am
Joined: 24 Nov 2011
Posts: 6
Thanks for this hint Darkshine!

In Blender Version 2.6 this change has to be made in file /source/gameengine/VideoTexture/VideoFFmpeg.cpp Line: 625

Unfortunately it's not working for me on a Mac to access the stream of the iSight camera, but this may have other reasons...
Reply with quote


stiv

Posted: Mon Jan 02, 2012 2:47 am
Joined: 05 Aug 2003
Posts: 3485
Quote:
S1 = G.expandPath("/dev/video0")


Pardon my ignorance on the subject, but is that the name of the video device under OSX?
Reply with quote


Thillbucci

Posted: Mon Jan 02, 2012 1:23 pm
Joined: 24 Nov 2011
Posts: 6
stiv wrote:

Pardon my ignorance on the subject, but is that the name of the video device under OSX?


Unfortunately not and it seems none too easy to grab a camera stream on OSX this way (http://stackoverflow.com/questions/6557655/mac-webcam-get-the-device)

I'm trying to use OpenCV now... Or is there anybody who knows another solution?

Maybe I should open a new thread for further questions regarding to video-streams on OSX Confused
Reply with quote


sphaero

Posted: Tue Feb 28, 2012 3:22 pm
Joined: 28 Feb 2012
Posts: 10
[quote="Thillbucci"]
stiv wrote:

I'm trying to use OpenCV now... Or is there anybody who knows another solution?

Maybe I should open a new thread for further questions regarding to video-streams on OSX Confused


Just to confirm: FFmpeg does not support video capturing on OSX currently.

Rg,

Arnaud
Reply with quote


sphaero

Posted: Mon Apr 02, 2012 1:06 pm
Joined: 28 Feb 2012
Posts: 10
Just to note I've suggested a patch for BGE to incorporate an extra parameter to set the format. This fixes the hardcoded video4linux problem.

http://projects.blender.org/tracker/index.php?func=detail&aid=30750&group_id=9&atid=127

My suggestion to get OSX capture support is to add a VideoGstreamer module like the VideoFFMpeg. Just not my cup of tea yet as I'm just staryting to get into the source :S

Rg,

Arnaud
Reply with quote


ldo

Posted: Mon Apr 02, 2012 11:26 pm
Joined: 07 Nov 2010
Posts: 543
Things like this used to be done on the Mac through QuickTime APIs—you had the low-level video-capture “components” that knew about specific hardware, and the higher-level sequence-grabber on top of that, that kind of thing.

Does that not work any more?
Reply with quote


offtools

Posted: Thu May 10, 2012 4:22 am
Joined: 03 May 2012
Posts: 3
sphaero wrote:
Just to note I've suggested a patch for BGE to incorporate an extra parameter to set the format. This fixes the hardcoded video4linux problem.

http://projects.blender.org/tracker/index.php?func=detail&aid=30750&group_id=9&atid=127

My suggestion to get OSX capture support is to add a VideoGstreamer module like the VideoFFMpeg. Just not my cup of tea yet as I'm just staryting to get into the source :S

Rg,

Arnaud


The patch opens some new possibilities. x11grab works with it, which is a cool thing. Unfortunately my easycap dc60 usb capture device still doesnt work in the bge. av_open_input_file fails. The problem is the deprecated api code, which is still used. Who maintains the VideoFFmpeg Code. I've started to add some changes too, but I can test only on Linux.
Reply with quote


offtools

Posted: Thu May 10, 2012 4:24 am
Joined: 03 May 2012
Posts: 3
Yes and Gstreamer would be awesome Smile
Reply with quote


 
Jump to:  
Powered by phpBB © 2001, 2005 phpBB Group