RTMP Stream Twitch Problem

Just downloaded app 4/20.

Trying to stream to Twitch using RTMP. Not really working.

I’m getting a connection, Twitch says LIVE, but no picture. Just a spinner or black screen. Testing with WIFI, plenty of bandwidth. Video on the controller looks fine. Anyone gotten this to work?

Does the app let me stream just 720P? Can I change the bandwidth?

Thanks for the help.

We just tested Twitch and it seems to not work well, most likely because Twitch requires keyframes every 2 seconds or so, and with litchi we only send one at the beginning of the stream in general. You can get it to work if you change the camera mode during the stream (that will force resend a keyframe), but then the stream still seems to die shortly after.
We recommend using other streaming software like Youtube, Facebook, or custom RTMP server, these options work well in our testing

Litchi streams the drone feed, in general it is 720p, but can be 1080p if you enabled Full HD Stream. Bitrate is the one from the drone, it can not be changed

Looking over this forum, I was hoping it would be you who’d respond!

I’ve been testing Litchi because streaming from the Fly DJI app to Twitch seems to suddenly have become unreliable. In early February it seemed to work OK and I streamed to it for 3-4 hours, but something has changed. Might be on my end, but I think its more likely an update to the DJI Fly app or the Mini 2 drone firmware.

One issue is that the DJI Fly app can have way too high a bitrate – like 20000kbps at my house over wifi. Twitch doesn’t want to see anything over 6000. At 20000 I can record the video on to Twitch, but it won’t stream it to viewers.

Litchi seems to cap its bitrate at 5500. But it doesn’t work either, although I get a buffering spinner instead of just a black screen – I think you may be correct on this being a keyframe issue.

Not sure Youtube all that happy about the lack of keyframes either. When was the last time you tried the app with Youtube?

I’d think that for people streaming off of an LTE connection you’d want to be pretty aggressive with keyframes – but have no idea on the inner working on how these things are setup.

Litchi does not limit or set a specific bitrate. It just forwards the drone’s video stream to the RTMP server. So the bitrate you get out of the drone is the bitrate you get for the RTMP stream. It will vary by drone model and also some settings will affect the bitrate obviously like if you enable Full HD stream.

DJI Fly decodes the drone’s stream on device, re-encodes it, and then sends it to RTMP server, at least I suspect that’s what they do.

I just tested Youtube Live with Mini 2 v01.04.0000 and Litchi iOS 2.13.2 and I can confirm there seems to be an issue where the stream dies after about 1 minute most likely due to lack of iframes.
We will try to see if we can send more iframes in the next update to fix youtube/twitch.

Ah. Since both the Litchi app and the DJI Fly app seemed to suddenly have problems on both Youtube and Twitch, I’m wondering if DJI has messed this up with a recent firmware update to the drone or RC?

Any chance you can test this with a previous firmware version?

I’m running
Aircraft Firmware 01.04.0000
RC Firmware .4.11.0032

Any chance there might be a beta for me to test, say next week!?

ps: you sure about the bitrate being passed directly from the drone? Looking at Youtube analytics, I get a wide range of bitrates from DJI Fly, but look to get a consistent bitrate from Litchi of 5,500kbps.

Thanks for all your help.

We just pushed a new beta for android where the problem should be fixed (build 30004241). On Android, the max bitrate is approx 3500kbps (restricted by DJI SDK, so can not go higher). We will fix it for iOS too in upcoming beta soon.

It is possible we always had this problem with youtube/twitch (I am not sure how we would not have noticed before though as we did a lot of Youtube testing in past months). That said, I do not think it is related to issues you may have with DJI Fly.

1 Like

I can positively say using DJI Fly in late February streaming to Twitch seemed to work fine under a variety of networks and bandwidths.

Hardly did any rigorous testing, but didn’t really need to – it just worked without issue.

I’m using iPhone. When that’s updated I’ll give it an immediate try.

Make sure you don’t bust your RTMP facebook connection – that seems to work great. Even without the lack of keyframes.

The beta build 3081 for iOS should fix the RTMP streaming issues (max bitrate for iOS is 5Mbps)

Quick office wifi test of iOS beta with the RTMP client max bitrate, looks to work great with Twitch! But that’s with solid, and fast, wifi upload connection (18mbps). Lower speed LTE (7mbps) also seemed good.

Twitch identifies the source as 720P60 - can this be changed? For poorer bandwidth connections, would love to be able to lower this to 720P25. Any way I can configure this from the app?

Have you also added additional key frames? Or just throttled the bitrate?

We’ve seen the 60fps tag from twitch too but it is most likely wrongly identified due to DJI’s encoder doubling fps count in the stream metadata for some reason. Actual stream should be 30 fps though as most DJI drones stream at 30 fps. We’ll check if it’s possible to fix the bad metadata so Twitch identifies it correctly.

There are keyframes sent every 1-2 seconds now. Max bitrate is set manually (3.5Mbps for android limited by DJI’s SDK and 5Mbps max for iOS). In a future update we hope to make it user configurable

Thank you for your feedback!

1 Like

When the RTMP client drops a connection (which obviously going to happen, especially if your internet connection is 4G LTE) does the software try and pickup from the time of the disconnect, or just stream from the point where the connection was re-established?

Ran an 4G LTE (about 9mbps connection, so pretty good) test streaming to Twitch, and every 90-seconds or so I’d have a disconnection, and the stream would then just jump to the current video. Nothing was buffered locally.

I know this is beta – is that the intended behavior? With a solid LTE connection, are you surprised at this frequency of disconnects?

Hope this helps. I’ll try Facebook and Youtube as well – although expect that won’t make a difference.

Same with streaming to Facebook. Every minute or so it looks like the connection is lost and the video skips ahead once the connection is re-established. Doesn’t continue stream from where the connection was lost.

Does that make sense?

Is that what you’re intending? With something like OBS, if the connection is lost, the video is locally saved and the streamed video picks up from the point it was lost.

For Facebook, we still use our older streaming code which just forwards the drone’s video feed without any encoding, we did not change it since it has always worked quite well in our experience. Bitrate is what you get out of the drone (varies). There is about 3 seconds of buffering for facebook. If you have a disconnect shorter than approx 5 seconds then it will continue from where it stopped, it does not jump to current video. Longer than 5 seconds disconnect causes end of the stream.

For RTMP (Twitch/YT/etc), the drone’s video feed is decoded, re-encoded and then sent to RTMP server. Bitrate is currently max 5Mbps (3.5Mbps on android) but we will add a setting to set your own bitrate. Following applies to iOS Only (details not known for android): there is a buffer of about 3 seconds which is cleared/reset when full. So if you loose connection for 3s+ then older frames will be dropped.

If you disconnect, it is most likely a result of the connection not being good enough.
We will add a bitrate setting which should help with slower connections

I’ll run some tests of the latest beta version. What about the possibility of having any option for a much longer buffer? Depending on the use case, a 30-second buffer might be nice. Could that be an option?

Just one test, but on Verizon LTE @ around 7mbps I got no breaks when streaming to Twitch with bitrate set at 2Mbps!

At 3.5Mbps I’d have a 1-2 second break about every 20-seconds.

I’ll retry Facebook again under same environment.

An option on the RTMP bitrate menu to include a 30-second buffer would be fantastic for some use cases. Like mine…

Latest iOS beta build has a RTMP buffer time setting (3/15/30sec)

Initial test worked fine – no smoke.

We’ll run some more tests, see how well the app picks up from a lost connection.

Thanks so much for adding this parameter. Should be helpful for lots of users.

Thanks to the Litchi beta we almost pulled this off. In the end the field complex had very limited LTE connection, and for this game we’d have to reset connectivity every 5-minutes or so. But we had a game later in the day, the regional final, where we lost connectivity just once!

But as a POC, we got some decent footage. Here’s a sample!

Thanks Vico for all your help. Bet I sell a bunch more copies for you!