I've got an nginx rtmp setup on the cloud, which I use as a "distributor" that takes a single rtmp input and splits it out to multiple rtmps such as Facebook and Youtube. There are ffmpeg processes that take the input rtmp and then encode it according to various requirements such as scaling down to 720p for Facebook, and outputing to the Facebook server.

I push to this server from Wirecast/OBS on a PC. I'm trying to setup some kind of redundancy for the input, so there are effectively two PCs. If one PC goes down, I start pushing to the server from the other PC.

Initially, I had setup NGINX so that in case the stream from one PC goes down, the rtmp server closes the rtmp connection from the PC. This causes the ffmpeg process taking the input to shut down too. Sometimes this leads to Facebook (which was being fed by that ffmpeg process), thinking the stream has ended and closing the stream. To prevent this, I configured NGINX so that the rtmp connection stays open for a while, in which I time I get the second PC to push a stream. The ffmpeg process does not break in this case. But I've noticed that in case the two PCs are streaming on different x264 profiles, let's say one is on High and the other on Baseline or Main, the ffmpeg process starts to throw a lot of errors/warnings when it starts using the second PC stream. Below is a sample of the errors:

[NULL @ 0x56330347c380] illegal reordering_of_pic_nums_idc 22 (and other numbers)
[NULL @ 0x56330347c380] reference count 1 overflow
[NULL @ 0x56330347c380] illegal memory management control operation 32 (and sometimes 16)

So long as I'm on OBS/Wirecast, I have control over the profile, so I'm able to avoid these errors. But the problem arises when one of the PCs is replaced with a hardware encoder such as the LiveU Solo or even if I use Wirecast with MainConcept as encoder instead of x264.

Any ideas how I can solve this problem. Currently, I'm encoding one of the inputs with libx264 to ensure that the profile and level match that of the other input. But that's pretty CPU intensive for a 1080p stream and I sometimes have multiple 1080p streams happening. Anyway to avoid this encode?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.