jason_a69
Posts: 7
Joined: Sat Sep 23, 2017 11:01 am

Stream Pi 4 desktop with ffmpeg

Sun Oct 27, 2019 10:06 am

Hello,

I am trying to stream my desktop to a web browser. I have managed to get the video working but I am not having any luck with audio which I think is something to do with there not being any capture devices available. I checked that with

Code: Select all

arecord -l
Returns
**** List of CAPTURE Hardware Devices ****

My ffmpeg command looks like this

Code: Select all

ffmpeg -f x11grab -i :0.0 -video_size 640x480 -f alsa -i hw:0,1 -c:v h264_omx -f flv rtmp://localhost:1935/live/dt
Returns
cannot open audio device hw:0,1 (No such file or directory)

This works fine but there is no sound

Code: Select all

ffmpeg -f x11grab -i :0.0 -video_size 640x480 -f alsa  -c:v h264_omx -f flv rtmp://localhost:1935/live/dt
Any ideas / suggestions are most welcome.

Thanks

Jason

jason_a69
Posts: 7
Joined: Sat Sep 23, 2017 11:01 am

Re: Stream Pi 4 desktop with ffmpeg

Mon Oct 28, 2019 8:15 am

Just had a look on a Raspberry Pi 3. If I run

Code: Select all

arecord -L
I get
null
Discard all samples (playback) or generate zero samples (capture)
sysdefault:CARD=Loopback
Loopback, Loopback PCM
Default Audio Device
front:CARD=Loopback,DEV=0
Loopback, Loopback PCM
Front speakers
surround21:CARD=Loopback,DEV=0
Loopback, Loopback PCM
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Loopback,DEV=0
Loopback, Loopback PCM
4.0 Surround output to Front and Rear speakers
surround41:CARD=Loopback,DEV=0
Loopback, Loopback PCM
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Loopback,DEV=0
Loopback, Loopback PCM
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Loopback,DEV=0
Loopback, Loopback PCM
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Loopback,DEV=0
Loopback, Loopback PCM
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
dmix:CARD=Loopback,DEV=0
Loopback, Loopback PCM
Direct sample mixing device
dmix:CARD=Loopback,DEV=1
Loopback, Loopback PCM
Direct sample mixing device
dsnoop:CARD=Loopback,DEV=0
Loopback, Loopback PCM
Direct sample snooping device
dsnoop:CARD=Loopback,DEV=1
Loopback, Loopback PCM
Direct sample snooping device
hw:CARD=Loopback,DEV=0
Loopback, Loopback PCM
Direct hardware device without any conversions
hw:CARD=Loopback,DEV=1
Loopback, Loopback PCM
Direct hardware device without any conversions
plughw:CARD=Loopback,DEV=0
Loopback, Loopback PCM
Hardware device with all software conversions
plughw:CARD=Loopback,DEV=1
Loopback, Loopback PCM
Hardware device with all software conversions

I think I have found the core of the problem.

Return to “Graphics, sound and multimedia”