msaiducar
Posts: 4
Joined: Fri Apr 01, 2016 6:49 am

raspivid doesn't include b-frames

Wed Jan 16, 2019 12:15 pm

Hi all,

I'm streaming raw h264 using raspivid on Raspberry Pi 3 and PiCam v1 . However, even I set the h264 profile to main or high, stream only contains I and P frames. Here is the command that I use for starting stream over TCP;

Code: Select all

raspivid --verbose --framerate 10 -b 1000000 --stats --intra 50 --inline --nopreview  -t 0 -l --output tcp://0.0.0.0:5001
When I parse the byte stream, I only see SPS,PPS,I-frames and P-frames. How can I make raspivid to add B-frames also?

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

Re: raspivid doesn't include b-frames

Wed Jan 16, 2019 12:31 pm

msaiducar wrote:
Wed Jan 16, 2019 12:15 pm
When I parse the byte stream, I only see SPS,PPS,I-frames and P-frames. How can I make raspivid to add B-frames also?
You can't. The hardware encoder doesn't support them.
The profile specifies the feature set that the encoder can use to compress the stream, it doesn't obligate the use of any or all of them.

B-frames significantly increase the complexity of the encoder, partly as it needs to search multiple frames for best motion match, but also that you then have increased and variable latency through the codec as you need all the I or P frames to search before you can start encoding the B frame.
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.

msaiducar
Posts: 4
Joined: Fri Apr 01, 2016 6:49 am

Re: raspivid doesn't include b-frames

Wed Jan 16, 2019 1:09 pm

That perfectly makes sense. So can I create h264 stream with software encoder and how? Latency and quality of video is not important, I just need to create an application to read h264 stream and parse the I-P-B frames. I only have Raspberry Pi and Pi Camera to create stream.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 22747
Joined: Sat Jul 30, 2011 7:41 pm

Re: raspivid doesn't include b-frames

Wed Jan 16, 2019 1:47 pm

msaiducar wrote:
Wed Jan 16, 2019 1:09 pm
That perfectly makes sense. So can I create h264 stream with software encoder and how? Latency and quality of video is not important, I just need to create an application to read h264 stream and parse the I-P-B frames. I only have Raspberry Pi and Pi Camera to create stream.
You would need to use the software h264 encoder and turn on everything. ffmeg would do that, or GUI apps like Handbrake. Not sure if that runs on the Pi though, some people have compiled it. Not familiar with other alternatives.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

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

Re: raspivid doesn't include b-frames

Wed Jan 16, 2019 1:49 pm

msaiducar wrote:
Wed Jan 16, 2019 1:09 pm
That perfectly makes sense. So can I create h264 stream with software encoder and how? Latency and quality of video is not important, I just need to create an application to read h264 stream and parse the I-P-B frames. I only have Raspberry Pi and Pi Camera to create stream.
Realtime you'll struggle with at 1080P30 - it's the reason that it is offloaded to hardware.
Lower res or offline compression then ffmpeg or GStreamer can both handle that.
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.

Return to “Camera board”