Question / Help Could Raspberry Pi 4 do live streaming?

OOOF

New Member
Although its not really a gigantic upgrade from the Raspberry Pi 3 to the Raspberry Pi 4 its still an upgrade, which raises the question "Is it possible to stream using obs now?".

If its not strong enough, is there a minimum/recommended specs required to look at?

General use case would be for the ever so common twitch streaming using NDI to send the footage from my main computer to the Raspberry Pi for encoding and sending to twich or any kind of streaming service
 

Tuna

Member
Pretty sure that no. The software is not ported for ARM. And if it was - there is no support for OMX hardware encoder afaik.
 

allegfede

New Member
indeed the PI platform could give OBS a great boost.

A strict collaboration with the raspberry foundation to bring OMX optimization in the code, could help raspberry foundation to spread PIs to the gamers nation, and OBS to make a "streaming brick" at a really low price :D
 

andrewbyday

New Member
I attempted to do this tonight, and while I do think I made a lot of progress, I eventually hit an error I couldn’t troubleshoot further. I came here hoping for some suggestions, but I’m guessing I won’t get any.

I got CMake to build all of the necessary configurations. There were a lot of dependencies I needed to get installed. I went through the missing items one by one in the output from CMake, and eventually got it to recognize all of the requirements. When I attempt to run sudo make -j4 it errors out. I’ve spent some time troubleshooting the error I’m seeing, but I can’t find the culprit. The errors appear to be related to ffmpeg-mux, although it seems like all of the ffmpeg dependencies are in place. It’s generating errors in a library that I do have installed, so I’m sort of at a loss.

I am assuming this isn’t an issue I’ll be able to fix since it wasn’t designed to run on ARM. I checked a bunch of the specs before I started this, and I thought the RPi4 met the necessary requirements, but I guess not.

Does anyone have a recommendation for a similar low end computer that OBS will actually run on? I’m doing a couple things that require software like OBS, but this is the only thing I need this computer to do, so I don’t want to spend too much.
 

Filip S

Member
I my dream it would be nice to use the rp4 with usb3 capture like camlink/elgato and let ffmpeg do a NDI or just rtmps stream - I have a Terradek Vidiu mini but it can only rtmp and using NDI to other computer running OBS would be cool - anyway maybe another solution than rpi would be a way to go.
 
This would be a dream also with ndi :)

NDI is not longer shipped with FFMPEG. The FFMPEG community rejected Newtek's approach to the license. You may be able to build with from scratch with an older NDI library.

NDI 4.0 was just released this week at IBC2019.

I tried encoding a webcam using NDI Scan Converter on a SFF Windows system. The N3450 CPU could not reliably deliver 1080p30. This makes me think RPi 4 would be pretty useless.
 
you could do something weird:

get a Server for ~10 or 20 bucks.

game on your local PC.

grab the video with elgato over USB to the Pi.

Use the Pi as a VPN host (openvpn over Docker could be the best and fast option) and connect the pc and the server to that network.

start a network stream with the Pi over VLC.

let the Server encode and pump it to twitch.



that sounds weird but if the ARM tech is NOT supported you NEED to go to x86 based processors. the h264 or the x264 could be strong enough to push it to the server
 

Filip S

Member
well I have a problem with the rp4 computer i cant even capture output via the usb3 from a Elgato camlink
it would work on another ubunto linux computer but not my rp4

v4l2-ctl -n or
Cannot open device /dev/video0, exiting.

v4l2-ctl --list-formats
Cannot open device /dev/video0, exiting.

The rpi3 was to slow to read via usb2 but it tried to read - it looks like rp4 dont even care to try ;)

Just for fun I also tried the elgato connected to the usb2 on rpi and it reads more showing


v4l2-ctl -D
Driver Info:
Driver name : uvcvideo
Card type : Cam Link: Cam Link
Bus info : usb-0000:01:00.0-1.4
Driver version : 4.19.66
Capabilities : 0x84a00001
Video Capture
Metadata Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Media Driver Info:
Driver name : uvcvideo
Model : Cam Link: Cam Link
Serial :
Bus info : 1.4
Media version : 4.19.66
Hardware revision: 0x00000000 (0)
Driver version : 4.19.66
Interface Info:
ID : 0x03000002
Type : V4L Video
Entity Info:
ID : 0x00000001 (1)
Name : Cam Link: Cam Link
Function : V4L2 I/O
Flags : default
Pad 0x01000007 : 0: Sink
Link 0x0200000d: from remote pad 0x100000a of entity 'Processing 2': Data, Enabled, Immutable

but on back on usb it just says
pi@isp1:~ $ v4l2-ctl -D
Cannot open device /dev/video0, exiting.
 
Last edited:

Filip S

Member
Is UVC mode ?
Avermedia (GC311 and GC553) working.

- I am not really sure what you mean - today I was able to capture video from elgato camlink on usb3 using vlc and
using the render playout to the my cromecast dogle on the tv. The load was around 90% maybe but it was important
to turn on the camera after boot - somehow it would not detect my /dev/video0 device but doing broadcast to my
chromedogle was working so maybe its possible to make it work...
 

Tomasz Góral

Active Member
Because I do not know this device (elgato camlink), I asked in what mode it works, one of the possibilities is UVC. E.g. Avermedia Live Gamer Portable only works with Windows drivers, cannot run on Linux, recent generations use standard UVC drivers, so you can get the image.
And what the lsusb command shows and what is in dmesg after connecting elgato.
 

Filip S

Member
Because I do not know this device (elgato camlink), I asked in what mode it works, one of the possibilities is UVC. E.g. Avermedia Live Gamer Portable only works with Windows drivers, cannot run on Linux, recent generations use standard UVC drivers, so you can get the image.
And what the lsusb command shows and what is in dmesg after connecting elgato.
Because I do not know this device (elgato camlink), I asked in what mode it works, one of the possibilities is UVC. E.g. Avermedia Live Gamer Portable only works with Windows drivers, cannot run on Linux, recent generations use standard UVC drivers, so you can get the image.
And what the lsusb command shows and what is in dmesg after connecting elgato.


The Elgato Camlink works as a regular uvc webcam but it needs USB3 to work - the fswebcam says its 1280x720 but it does make 50 frames.
But what is important is to turn on the cam or conneched hdmi device is turned on after its connnected else it will not detect the Elgato.

The lsbusb will show
the Bus 002 Device 004: ID 0fd9:0061 Elgato Systems GmbH

But if the video camera is on you need to turn it off and then on again before you will be able to read anything using vlc player
on v4l2:///dev/video0 and when I do this the cpu load 66% but I may need something to cool the gpu even more but it does
read the input from the elgato usb3 - the rpi4 may need som ekstra cooling maybe.

I can test with fswebcam
fswebcam
--- Opening /dev/video0...
stat: No such file or directory

(HERE then turn off the camera and turn on again and it will show up as /dev/video0 and with hw 1,0 for audio)

pi@isp1:~ $ fswebcam
--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
Adjusting resolution from 384x288 to 1280x720.
Error starting stream.
VIDIOC_STREAMON: No such file or directory
Unable to use mmap. Using read instead.
Unable to use read.

I am not really sure how to make the vlc stream out - I did try to steam with ffmpeg using udp the flowing did work
with a h264 acc encoded file

ffmpeg -y -i /home/pi/Videos/20190918Jyllingevej73.h264.mp4 \
-r 25 -vcodec h264_omx -b:v 3M -maxrate:v 4M -c:a aac -b:a 128k \
-filter:v scale=1920:1080 -crf 0 -tune zerolatency -preset ultrafast \
-f mpegts 'udp://192.168.10.100:9250'

But

ffmpeg -y -i /dev/video0 \
-r 25 -vcodec h264_omx -b:v 3M -maxrate:v 4M -c:a aac -b:a 128k \
-filter:v scale=1920:1080 -crf 0 -tune zerolatency -preset ultrafast \
-f mpegts 'udp://192.168.10.100:9250'

By the way the elgato camlink does work fine on my more powerfull ubunto computer with the OBS but it would be more cool to use
a raspberry pi 4 to stream maybe using udp ndi or rtmp out and it looks like vlc on rpi does read fine

Anyway
v4l2-compliance
v4l2-compliance SHA: not available, 32 bits

Compliance test for device /dev/video0:

Driver Info:
Driver name : uvcvideo
Card type : Cam Link: Cam Link
Bus info : usb-0000:01:00.0-2
Driver version : 4.19.66
Capabilities : 0x84a00001
Video Capture
Metadata Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Media Driver Info:
Driver name : uvcvideo
Model : Cam Link: Cam Link
Serial :
Bus info : 2
Media version : 4.19.66
Hardware revision: 0x00000000 (0)
Driver version : 4.19.66
Interface Info:
ID : 0x03000002
Type : V4L Video
Entity Info:
ID : 0x00000001 (1)
Name : Cam Link: Cam Link
Function : V4L2 I/O
Flags : default
Pad 0x01000007 : 0: Sink
Link 0x0200000d: from remote pad 0x100000a of entity 'Processing 2': Data, Enabled, Immutable

Required ioctls:
test MC information (see 'Media Driver Info' above): OK
test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
test second /dev/video0 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK

Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
test VIDIOC_LOG_STATUS: OK (Not Supported)

Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
test VIDIOC_ENUMAUDIO: OK (Not Supported)
fail: v4l2-test-input-output.cpp(377): invalid type
fail: v4l2-test-input-output.cpp(451): invalid attributes for input 0
test VIDIOC_G/S/ENUMINPUT: FAIL
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_ENUMAUDOUT: OK (Not Supported)
test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
test VIDIOC_G/S_EDID: OK (Not Supported)

Control ioctls:
fail: v4l2-test-controls.cpp(251): missing control class for class 00980000
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: FAIL
test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
warn: v4l2-test-controls.cpp(704): g_ext_ctrls(0) invalid error_idx 0
fail: v4l2-test-controls.cpp(794): doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)
test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 4 Private Controls: 0

Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
warn: v4l2-test-formats.cpp(1237): S_PARM is supported but doesn't report V4L2_CAP_TIMEPERFRAME
fail: v4l2-test-formats.cpp(1139): node->has_frmintervals && !cap->capability
test VIDIOC_G/S_PARM: FAIL
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)

Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
test VIDIOC_G_ENC_INDEX: OK (Not Supported)
test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls:
fail: v4l2-test-buffers.cpp(485): check_0(reqbufs.reserved, sizeof(reqbufs.reserved))
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
test VIDIOC_EXPBUF: OK

Total: 44, Succeeded: 39, Failed: 5, Warnings: 2

So I can get input from the usb3 now also with audio - so only need to restream it somehow ;) currently using standard Raspbian Buster with desktop

I have a colling sink on the rp4 but maybe it needs a cooling fan ;)
 

Filip S

Member
Cooling fan - you need.

What show :
ffmpeg -f video4linux2 -list_formats all -i /dev/video0

The respons is
[video4linux2,v4l2 @ 0x13fb1c0] Raw : yuyv422 : YUYV 4:2:2 : 1280x720
/dev/video0: Immediate exit requested

The VLC reads nicely from and shows and audio was on hw 1.0 it displays fine were the cpu load is 60-70% but I dont care
to show the data - I just whats to stream it out :) if I get it to work I will buy a cooling fan.

I compay called Terradek does make a device with wifi that can make rtmp from a connected video cam via clean hdmi
but using a rp4 with elgato would be nice for other ways to stream via a wifi using rtmps udp or openvpn to a computer
running obs.
 

Flyrain

New Member
I‘m trying almost the same. I want to use the pi4 and camlink with a GoPro for my mobile setup to stream directly to Twitch. Something like the expensive LiveU Solo. It works but only with 10 fps. The Pi is only at 50% percent usage of 1 core. Maybe someone knew some ffmpeg tweaks? No Desktop, only command line. I tried your ffmpeg command you posted earlier.
 

Tomasz Góral

Active Member
I don't use "-filter:v scale"
I think: ffmpeg -f video4linux2 -input_format yuyv422 -s 1280x720 -i /dev/video0 -vcodec h264_omx -b:v 3M -maxrate:v 4M -f mpegts 'udp://192.168.10.100:9250'
 
Top