Virtual capture device /dev/video0

  • Been a very happy Hyperion ambilight user for several years now but my AV setup recently changed thus my light config also needs to.


    For experimental, but necessary reasons, I am manipulating my capture feed finally exporting it as a video output device /dev/video0 using v4l2loopback and ffmpeg. The manipulated feed works great and I can capture proper screengrabs from it using streamer on the command line. It is properly encoded as UYVY which is a compatible format for Hyperion.


    My problem is that if I try to grab a screenshot from Hypercon I get


    [INDENT]ssh in: hyperion-v4l2:
    ssh in: version : V1.03.3 (brindosch-2fbbcff/2f01dfa-1495880388
    ssh in: build time: Jun 3 2017 02:06:37
    ssh out: VIDIOC_S_STD ERROR 25, Inappropriate ioctl for device
    [/INDENT]


    From my searches, the usual answer is that "chipset is not supported" however this is a virtual device and has no "chipset". Is there any way for me to just "plug in" this virtual capture feed in to Hyperion?


    I know that some of my v42l-ctl --all output (below) is different from a regular USBTV007 device output. Are there essential pieces I need to match up for it to work maybe?


    Thanks.



    Device stream
    [INDENT]$ python vid.py | ffmpeg -f rawvideo -s 640x480 -pix_fmt bgr24 -i - -an -f v4l2 -pix_fmt uyvy422 /dev/video0
    [INDENT][/INDENT]
    ffmpeg version 3.2.8-1~deb9u1 Copyright (c) 2000-2017 the FFmpeg developers
    built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1) 20170516
    configuration: --prefix=/usr --extra-version='1~deb9u1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
    libavutil 55. 34.101 / 55. 34.101
    libavcodec 57. 64.101 / 57. 64.101
    libavformat 57. 56.101 / 57. 56.101
    libavdevice 57. 1.100 / 57. 1.100
    libavfilter 6. 65.100 / 6. 65.100
    libavresample 3. 1. 0 / 3. 1. 0
    libswscale 4. 2.100 / 4. 2.100
    libswresample 2. 3.100 / 2. 3.100
    libpostproc 54. 1.100 / 54. 1.100
    Input #0, rawvideo, from 'pipe:':
    Duration: N/A, start: 0.000000, bitrate: 184320 kb/s
    Stream #0:0: Video: rawvideo (BGR[24] / 0x18524742), bgr24, 640x480, 184320 kb/s, 25 tbr, 25 tbn, 25 tbc
    Output #0, v4l2, to '/dev/video0':
    Metadata:
    encoder : Lavf57.56.101
    Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 640x480, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
    encoder : Lavc57.64.101 rawvideo
    Stream mapping:
    Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))


    frame= 69 fps= 10 q=-0.0 size=N/A time=00:00:02.76 bitrate=N/A speed=0.41x[/INDENT]
    Screen capture
    [INDENT]streamer -f jpeg -s 640x480 -o out.jpeg[/INDENT]


    v4l2-ctl --all output
    [INDENT]Driver Info (not using libv4l2):
    Driver name : v4l2 loopback
    Card type : Dummy video device (0x0000)
    Bus info : platform:v4l2loopback-000
    Driver version: 4.9.59
    Capabilities : 0x85208003
    Video Capture
    Video Output
    Video Memory-to-Memory
    Read/Write
    Streaming
    Extended Pix Format
    Device Capabilities
    Device Caps : 0x85208003
    Video Capture
    Video Output
    Video Memory-to-Memory
    Read/Write
    Streaming
    Extended Pix Format
    Device Capabilities
    Priority: 0
    Video input : 0 (loopback: ok)
    Video output: 0 (loopback in)
    Format Video Capture:
    Width/Height : 640/480
    Pixel Format : 'UYVY'
    Field : None
    Bytes per Line : 1280
    Size Image : 614400
    Colorspace : sRGB
    Transfer Function : Default
    YCbCr/HSV Encoding: Default
    Quantization : Default
    Flags :
    Format Video Output:
    Width/Height : 640/480
    Pixel Format : 'UYVY'
    Field : None
    Bytes per Line : 1280
    Size Image : 614400
    Colorspace : sRGB
    Transfer Function : Default
    YCbCr/HSV Encoding: Default
    Quantization : Default
    Flags :
    Streaming Parameters Video Capture:
    Frames per second: 30.000 (30/1)
    Read buffers : 8
    Streaming Parameters Video Output:
    Frames per second: 30.000 (30/1)
    Write buffers : 8


    User Controls


    keep_format (bool) : default=0 value=0
    sustain_framerate (bool) : default=0 value=0
    timeout (int) : min=0 max=100000 step=1 default=0 value=0
    timeout_image_io (bool) : default=0 value=0

    [/INDENT]

  • Nobody has any experience using a virtual or different video0 source in Hyperion? Starting to trawl the Hyperion source code to see if there's something I can tinker with to get it working.

    • Offizieller Beitrag

    i had it a few years ago...a user in another forum used v4l2-loopback for multiple instances in hyperion...he used gstreamer and that was his command i think

    Code
    /usr/bin/gst-launch-1.0 v4l2src device=/dev/video0 io-mode=2 ! video/x-raw,format=UYVY, framerate=30000/1001,width=240,height=192 ! deinterlace ! v4l2sink device=/dev/video1


    edit: its only german,but it was .bismarck
    https://forum-raspberrypi.de/f…ouse-31-10-15-2/?pageNo=1

  • @Hwulex
    I have come as far as you with streaming to the raspberry pi. Also, I encountered the same errors.
    sh in: Dec 07 06:48:54 hyperion hyperiond[834]: BLACKBORDER INFO: threshold set to 0.45 (115)
    ssh in: Dec 07 06:48:54 hyperion hyperiond[834]: BLACKBORDER INFO: mode:default
    ssh in: Dec 07 06:48:54 hyperion hyperiond[834]: started
    ssh in: Dec 07 06:48:54 hyperion hyperiond[834]: INFO: Json server created and started on port 19444
    ssh in: Dec 07 06:48:54 hyperion hyperiond[834]: INFO: Proto server created and started on port 19445
    ssh in: Dec 07 06:48:54 hyperion hyperiond[834]: terminate called after throwing an instance of 'std::runtime_error'
    ssh in: Dec 07 06:48:54 hyperion hyperiond[834]: what(): VIDIOC_S_STD ERROR 25, Inappropriate ioctl for device
    ssh in: Dec 07 06:48:54 hyperion systemd[1]: hyperion.service: Main process exited, code=killed, status=6/ABRT
    ssh in: Dec 07 06:48:54 hyperion systemd[1]: hyperion.service: Unit entered failed state.
    ssh in: Dec 07 06:48:54 hyperion systemd[1]: hyperion.service: Failed with result 'signal'.


    Did you find a solution?

  • I found a better solution for streaming and it is fast :)


    I use ffmpeg to stream my desktop via UDP:
    ffmpeg -f avfoundation -i "1" -s 320x240 -r 25 -c:v mpeg2video -preset superfast -pix_fmt yuv420p -tune zerolatency -f mpegts udp://xxx.xxx.xxx.xxx:1234


    and on the raspberry pi side, I use omxplayer to play to hdmi. Note, that you do not need X11 or any windows based system. It works like charm for headless raspberries :)
    Here the omxplayer command:
    omxplayer -o hdmi --live udp://192.168.178.20:1234


    Note that the parameter --live is important for quick processing.


    Btw, you need to buy a mpeg2 license for the raspberry pi, which will cost you around 2,8€.

  • I know I'm terribly late on this, but still i'm posting here because using ffmpeg in place of hypergrab-x11 was my first intent, but stumbling across this thread i tought it was just not possible, and i've had to search for alternatives (which, for instance, i found, but are far more complicated)


    Anyway, it works for me the following way (tried with hypersim)

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!