jetski559
Posts: 4
Joined: Wed Oct 13, 2021 9:48 pm

FFMPEG Max Incoming Bitrate

Wed Oct 13, 2021 9:53 pm

I am transcoding a RTSP stream from a IP cam to youtube RTMP through FFMPEG on the Raspberry Pi.

I just fixed a problem with a ton of streaking / smudging / artifacts on the video.

The problem was, the camera output bitrate was something super high, like 8,000 Kbps.
I think my ffmpeg on the raspberry pi was dropping a ton of packets or something, so then when it showed up on the RTMP stream, it looked terrible.

I set the camera bitrate to 1,536Kbps, and now everything looks great, no streaking, smudging, smearing, etc.

So... any thoughts on what you think the Pi can handle? It seems to be struggling with the 8,000 Kbps, but doing fine with 1,536Kbps.

Does this surprise you? I know the pi is an awesome little machine, but obviously it will have it's limitations. Any thoughts on what you think it should/could handle?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11856
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: FFMPEG Max Incoming Bitrate

Thu Oct 14, 2021 5:30 pm

What codec are you decoding and re-encoding to?
Are you using software or hardware for the decode and encode?
Are you rescaling?

Sorry, you've given very little information to go on, so it's very hard to give any advice.
Please provide the FFmpeg command line you're using, and any output it produces.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

RedMarsBlueMoon
Posts: 300
Joined: Mon Apr 06, 2020 3:49 am

Re: FFMPEG Max Incoming Bitrate

Thu Oct 14, 2021 5:52 pm

If you have a way of sending the stream yourself you could test with these files I find them super useful,

https://jell.yfish.us/

jetski559
Posts: 4
Joined: Wed Oct 13, 2021 9:48 pm

Re: FFMPEG Max Incoming Bitrate

Fri Oct 15, 2021 7:37 pm

6by9 wrote:
Thu Oct 14, 2021 5:30 pm
What codec are you decoding and re-encoding to?
Are you using software or hardware for the decode and encode?
Are you rescaling?

Sorry, you've given very little information to go on, so it's very hard to give any advice.
Please provide the FFmpeg command line you're using, and any output it produces.
Sorry, hopefully this helps.

Standard H.264. No scaling.

Code: Select all

ffmpeg -fflags +genpts -i "rtsp://user:password@192.168.1.101:554/cam/realmonitor?channel=1&subtype=0" -vcodec copy -codec:a aac -f flv "rtmp://a.rtmp.youtube.com/live2/xyz" 

jetski559
Posts: 4
Joined: Wed Oct 13, 2021 9:48 pm

Re: FFMPEG Max Incoming Bitrate

Fri Oct 22, 2021 2:35 am

Ironically, looking at the code, I don't know that any encoding is happening at all, mostly just switching from RTSP to RTMP. I'm not an expert, but really we are just pushing the same H.264 stream from the camera out through RTMP up to youtube.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11856
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: FFMPEG Max Incoming Bitrate

Fri Oct 22, 2021 12:39 pm

In which case run top or htop whilst FFmpeg is running and see if it is maxing out a CPU.
It's possible that the task is single threaded and it's struggling, but I wouldn't expect that sort of bitrate to really bother a Pi2 or above. Which version of Pi are you using?
Is your internet connection up to sustaining that sort of upload speed? Most internet links are highly asymmetrical, with far more download bandwidth than upload.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

jetski559
Posts: 4
Joined: Wed Oct 13, 2021 9:48 pm

Re: FFMPEG Max Incoming Bitrate

Sat Oct 23, 2021 3:39 am

Hardware : BCM2835
Revision : a020d3

Did a top, using about 25%

It also could very well be the IP camera, maybe it doesn't perform well at higher bitrates. It's sad they allow the higher bit rate to be selected knowing the camera can't handle it.

In the end, I'm just going to upgrade the camera to something newer and more powerful.

Return to “Graphics, sound and multimedia”