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

Mike Soultanian mike at soultanian.com
Tue Feb 16 01:29:17 EET 2021


Well.. that was extremely frustrating. I've seriously been going at this 
for probably 16 hours, scouring the net for documentation and trying 
other people's tutorials, wondering why my setup wasn't working as well 
as all the examples that described all the cool stuff you could do with 
ffmpeg.  It was only after I purchased another capture card (Elgato Cam 
Link 4k) that I found I found this article when searching for *ffmpeg 
elgato cam link* and found this page:

https://blog.eigenvalue.net/ffmpeg-elgato-camlink-4k/

What was so crucial was one little tidbit towards the end of the page 
where the author writes (referring to running the ffmpeg command):

> Unfortunately, most of the time it will get stuck after two frames. 
> After some random experimentation, I noticed that unplugging the 
> device allowed me to record once, most of the time. I think that it is 
> due to syncing the audio / video stream. The video source seems to 
> request key frames doesn't get the expected data afterwards. Or 
> something else.
>

This was *exactly* the behavior I was running into, but I had no idea 
that I was actually running into that particular issue!  This whole time 
I had a gut feeling that there was somewhat inconsistent behavior 
(sometimes it would seem to work and then on the next run with the same 
settings it would have very low FPS), but I'm a total newbie to this so 
I didn't know if this was just normal behavior or something was wrong.  
I really wonder how many people run into this kind of issue because not 
only did this slow me down big time, but I also feel bad for wasting 
other people's time on something for which there's a super-simple fix. 
I'm not sure if it isn't already in the documentation, but it would 
probably be smart to make mention of this somewhere.  Also, if there's 
any way for ffmeg to detect that it's in this kind of state, I think 
that would be great if it were to throw a warning that something is up.  
I'm not sure if it's possible, but I felt it worth mentioning.

Soooooo, after running this nifty command before running ffmpeg:

sudo sh -c "echo 0 > /sys/bus/usb/devices/2-1/authorized";sudo sh -c 
"echo 1 > /sys/bus/usb/devices/2-1/authorized";

voila!  It captures at 30fps, and with my cheap-o capture card!  I'll be 
returning the Elgato Cam Link 4k because it seems like it only outputs 
at 4k, and if I'm understanding things correctly, that means I'm 
expending extra CPU cycles to down-convert it to 720p instead of it 
already being at 720p.  Plus, why spend $99 if I don't need to!?

So Carl, to answer your questions:

To answer your questions:
> I was thinking about yuv420p but I don't know how you want to encode
> (and what you plan to do with the resulting file).

My ultimate goal is to stream my GoPro into my Raspberry Pi, then send 
that over a mobile link up to Twitch for my IRL live stream. I just 
tried streaming to Twitch from my GoPro through the Raspberry Pi (with a 
direct Internet connection) this morning and it works!  Oddly, the 
timestamps are different, but the audio does seem to be synced so I 
guess I'll run with it?!  Now that I got things working I will start 
with the wiki guide for streaming on the ffmpeg site.

>> It would seem like both my capture card and my logitech support
>> the same formats, but the logitech 920 also lists h264 (listed below)
>> - is that why it's allowing it to work?
> That's completely unrelated but has the advantage that you don't have
> to encode.

Got it!


>> What I don't understand is why I'm able to record either video or audio
>> from the capture card, but when they're both together it's not happy.
> How should FFmpeg mux audio and video if one has timestamps
> starting with 0 and the other with 10000000?
> You can - easily - let the audio stream start with 0 but the problem
> is that the result will not play in-sync, see the setps documentation.

Fortunately it seems like this isn't an issue now that I got things 
resolved by unplugging the unit before running it...

Thanks for your patience on this!  I appreciate the help so far - lots 
of learning going on here!



More information about the ffmpeg-user mailing list