ffmpeg 无法更改 B 帧的数量

标签 ffmpeg streaming h.264

当从源流式传输时,我不断接收遵循相同模式的帧:I-frame P-frame I-frame P-frame I-frame P-frame ... .
我尝试了很多选项并在这里阅读了尽可能多的问题,但我找不到增加 P 帧数量或至少启用 B 帧的方法。
主要是我似乎应该使用:

 ffprobe rtsp://localhost/video -g 30 -bf 3 -show_frames -of csv
我究竟做错了什么?

最佳答案

-bf选项您设置 B 帧的数量。
但是你必须使用 ffmpeg重新编码输入以更改 GOP 结构。
举个例子:ffmpeg -i input.mp4 -c:v libx264 -g 12 -bf 2 -flags +cgop output.mp4生成的输出应具有以下 GOP 结构:


位置

1
2
3
1
2
3
1
2
3
1
2
3


框架















在 shell 上,您可以使用 ffprobe 轻松输出 GOP 结构。 .
分析2秒的文件:ffmpeg -i input.mp4 -map 0 -c copy -t 2 -f nut pipe: | ffprobe pipe: -show_frames | grep pict_type

关于ffmpeg 无法更改 B 帧的数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67725542/

相关文章:

ffmpeg - ffmpeg 中的音频

.net - 如何将网页下载到 .NET 中的流中

android - 如何在android平台上进行硬件h.264视频编码

c++ - 如何编写 Live555 FramedSource 以允许我直播 H.264

python - 将opencv帧写入HLS段文件时出错

linux - FFMPEG在处理之前是否下载文件?

ffmpeg - 任何人都知道如何更改 FFMPEG 命令以输出一半大小?

audio - TideKit 能否将实时视频和音频从 Android 和 IOS 摄像头和麦克风流式传输到服务器?

ruby-on-rails - 从 Rails 3.2 应用程序流式下载 CSV

encoding - FFmpeg:在 Windows 上使用 AMD GPU 编码 x264?