Reputation: 3372
When streaming from a source I keep receiving frames following the same pattern:
I-frame P-frame I-frame P-frame I-frame P-frame ...
.
I tried many options and read as many questions here as I found, but I can't find a way to increse the number of P-frame or at least enable B-frames.
Mainly it seems that I should use:
ffprobe rtsp://localhost/video -g 30 -bf 3 -show_frames -of csv
What am I doing wrong?
Upvotes: 0
Views: 2115
Reputation: 1214
With the -bf
option you set the number of B-frames.
But you have to use ffmpeg
to reencode the input in order to change the GOP structure.
Take for example:
ffmpeg -i input.mp4 -c:v libx264 -g 12 -bf 2 -flags +cgop output.mp4
The resulting output should have the following GOP structure:
position | 1 | 2 | 3 | 1 | 2 | 3 | 1 | 2 | 3 | 1 | 2 | 3 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
frame | I | B | B | P | B | B | P | B | B | P | B | B | I |
On a shell you can easily output the GOP structure with ffprobe
.
Analyze 2 seconds of the file:
ffmpeg -i input.mp4 -map 0 -c copy -t 2 -f nut pipe: | ffprobe pipe: -show_frames | grep pict_type
Upvotes: 1