[FFmpeg-user] Trying to stream to rtmp from my rsp4 and a GoPro

Mike Soultanian mike at soultanian.com
Sat Feb 13 02:23:52 EET 2021


Hey Everyone,

I'm trying to stream from my GoPro into a USB capture device through my 
Raspberry Pi 4 and send the feed up to Twitch or my rtmp server.  After 
a lot of head banging I realized that there were two things that were 
messing me up: 1) specifying an audio input seems to break things and 2) 
trying to use the h264_v4l2m2m hardware encoder also seems to mess 
things up.   After finding the ffmpeg streaming wiki here:

https://trac.ffmpeg.org/wiki/EncodingForStreamingSites

I was finally able to cobble this command-line together and get it 
working... kinda:

*ffmpeg -f v4l2 -video_size 1280x720 -framerate 30 -i /dev/video0 -c:v 
libx264 -preset veryfast -b:v 1984k -maxrate 1984k -bufsize 3968k -vf 
"format=yuv420p" -g 60 -c:a aac -b:a 128k -ar 44100 -f flv 
rtmp://sfo.contribute.live-video.net/app/[my key]*

I say kinda because I can't seem to get audio working.  Now, I just want 
to say that using the QT v4l2 test utility I'm able to get audio and 
video simultaneously, so I know that the capture feed from my GoPro is 
healthy, and using ffmpeg I'm able to record either video from 
*/dev/video0* or audio from *plughw:2,0*, but it seems like whenever I 
add *-f alsa -i plughw:2,0* in addition to *-i /dev/video0*, it won't 
stream anything (or record anything during my recording attempts).

Am I missing something obvious here?  I was hoping that I'm just doing 
something stupid, but even looking on that wiki listed above it looks 
like all I need to do is add *-f alsa -ac 2 -i plughw:2,0* and it should 
work, but it just seems to kill the stream or record nothing.

Also, I'd love to be able to use the hardware encoder, so any thoughts 
on that would be appreciated, but getting both audio and video is the 
main priority.

Btw, if you're curious about what I'm doing, I'm trying to build a DIY 
mobile streaming rig that I can take hangliding/paragliding with me so 
people can watch.  I thought it would be a fun project but this portion 
has turned out to be quite challenging!!

Thanks!

Mike



More information about the ffmpeg-user mailing list