Not abel to generate stable video stream with ptyhon

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Not abel to generate stable video stream with ptyhon

This post has NOT been accepted by the mailing list yet.

I am working on stream generator for my video mapping set, but I am not able to get the image steady.
I open a v4l2loopback device with python-v4l2 and generate a video stream through it based on png etc, zo can generate live video's in my vj set and still video map them and apply effects.

Test case:
1) load v4l2loopback module
2) run python:
import fcntl, numpy
from v4l2 import *
from PIL import Image
height = 600
width = 634
device = open('/dev/video4', 'wb')
capability = v4l2_capability()
print(fcntl.ioctl(device, VIDIOC_QUERYCAP, capability))
print("v4l2 driver: " + capability.driver)
format = v4l2_format()
format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT
format.fmt.pix.pixelformat = V4L2_PIX_FMT_RGB32
format.fmt.pix.width = width
format.fmt.pix.height = height
format.fmt.pix.field = V4L2_FIELD_NONE
format.fmt.pix.bytesperline = format.fmt.pix.width * 4
format.fmt.pix.sizeimage = format.fmt.pix.width * format.fmt.pix.height * 4
format.fmt.pix.colorspace = V4L2_COLORSPACE_SRGB
print(fcntl.ioctl(device, VIDIOC_S_FMT, format))
img ='img/0.png')
img = img.convert('RGBA')
while True:
3) run Cheese or other v4l2 stream viewer.

The result is a proper colored and sized image, but it jumps very frame from left to right and always a little more to the left so you get a sliding and jumpy video result.
What am I doing wrong?

Best regards,


ps: if you woul like to see the results check: So far the LiVES, puredate, gem video mapping setup is working greath.