将 raspivid 和 cvlc 与低帧率和全 FOV 一起使用
Using raspivid and cvlc together with low framerates and full FOV
我有一个 Raspberry Pi 带有 OV5647 摄像头模块,我用它来流式传输视频。
raspivid
采用名为 --mode, -md
的命令行参数,它提供了相机可以设置使用的几种模式。
Mode Size AR Frame rates FOV Binning
0 automatic
selection
1 1920x1080 16:9 1-30fps Partial None
2 2592x1944 4:3 1-15fps Full None
3 2592x1944 4:3 0.1666-1fps Full None
4 1296x972 4:3 1-42fps Full 2x2
5 1296x730 16:9 1-49fps Full 2x2
6 640x480 4:3 42.1-60fps Full 2x2 plus skip
7 640x480 4:3 60.1-90fps Full 2x2 plus skip
我宁愿拥有低帧率和良好的图像质量,而不是高 FPS。
对于高质量的视频,我想以全高清 1920x1080 流式传输,但相机的模式 1
只提供部分视野,这大大减少了拍摄区域,我真的需要完整的视野.
我想选择模式 2
,这样我就可以以 15 FPS 的速度流式传输全高清的缩小视频。
但我不得不使用模式 4
,因为它给了我 25 FPS 的帧率。
问题如下:
raspivid -o - \
-t 0 \
-n \
-hf -vf \
-g 25 \
-pf high \
-md 4 \
-fps 25 \
-b 10000000 \
| cvlc -vvv \
stream:///dev/stdin \
--no-audio \
--sout '#standard{access=http,mux=ts,dst=:8090}' \
:demux=h264
这个命令有效。它将相机设置为 4
模式,使用 25
的 fps 并将视频传输到 clvc
.
当我将模式设置为 2
并将 fps 降低到 15
时,这将不再起作用。
出于某种原因 cvlc
似乎期望帧率为 25,记录了很多与
类似的警告
[73b02cf8] main mux warning: late buffer for mux input (17958)
[73b02cf8] main mux warning: late buffer for mux input (2025)
[73b02cf8] main mux warning: late buffer for mux input (14107)
[73b02cf8] main mux warning: late buffer for mux input (2890)
[73b02cf8] main mux warning: late buffer for mux input (20115)
开头还有一条消息称
[73b12410] main decoder debug: using packetizer module "h264"
[73e00568] main input debug: switching to sync mode
[73b088b8] h26x demux debug: using 25.00 fps
所以我假设我收到了那些 late buffer
警告,因为 raspivid 发送的帧数很少,而且它没有足够的数据供编码器使用。视频大约每 10 秒冻结一次,这真的让它无法使用。当它移动时,它会加速。
如何告诉 h264 编码器它应该以 15 FPS 输入输出而不是 25 FPS 工作?
您可以将 --h264-fps=15
添加到 cvlc
。
raspivid -o - \
-t 0 \
-n \
-hf -vf \
-g 15 \
-pf high \
-md 2 \
-fps 15 \
-br 55 \
-ISO 800 \
-ae 32,0x00,0x8080FF \
-a 4 \
-a "%Y-%m-%d %X" \
-b 10000000 \
| cvlc -vvv \
stream:///dev/stdin \
--no-audio \
--demux=h264 \
--h264-fps=15 \
--sout '#standard{access=http,mux=ts,dst=:8090}'
在 Raspberry Pi Zero 上,您必须将 force_turbo=1
添加到 \boot\config.txt
,但不要设置 over_voltage
和 arm_freq
因为那样会使保修失效。如果没有 force_turbo=1
,设备将在流式传输几个小时后死机。
我有一个 Raspberry Pi 带有 OV5647 摄像头模块,我用它来流式传输视频。
raspivid
采用名为 --mode, -md
的命令行参数,它提供了相机可以设置使用的几种模式。
Mode Size AR Frame rates FOV Binning
0 automatic
selection
1 1920x1080 16:9 1-30fps Partial None
2 2592x1944 4:3 1-15fps Full None
3 2592x1944 4:3 0.1666-1fps Full None
4 1296x972 4:3 1-42fps Full 2x2
5 1296x730 16:9 1-49fps Full 2x2
6 640x480 4:3 42.1-60fps Full 2x2 plus skip
7 640x480 4:3 60.1-90fps Full 2x2 plus skip
我宁愿拥有低帧率和良好的图像质量,而不是高 FPS。
对于高质量的视频,我想以全高清 1920x1080 流式传输,但相机的模式 1
只提供部分视野,这大大减少了拍摄区域,我真的需要完整的视野.
我想选择模式 2
,这样我就可以以 15 FPS 的速度流式传输全高清的缩小视频。
但我不得不使用模式 4
,因为它给了我 25 FPS 的帧率。
问题如下:
raspivid -o - \
-t 0 \
-n \
-hf -vf \
-g 25 \
-pf high \
-md 4 \
-fps 25 \
-b 10000000 \
| cvlc -vvv \
stream:///dev/stdin \
--no-audio \
--sout '#standard{access=http,mux=ts,dst=:8090}' \
:demux=h264
这个命令有效。它将相机设置为 4
模式,使用 25
的 fps 并将视频传输到 clvc
.
当我将模式设置为 2
并将 fps 降低到 15
时,这将不再起作用。
出于某种原因 cvlc
似乎期望帧率为 25,记录了很多与
[73b02cf8] main mux warning: late buffer for mux input (17958)
[73b02cf8] main mux warning: late buffer for mux input (2025)
[73b02cf8] main mux warning: late buffer for mux input (14107)
[73b02cf8] main mux warning: late buffer for mux input (2890)
[73b02cf8] main mux warning: late buffer for mux input (20115)
开头还有一条消息称
[73b12410] main decoder debug: using packetizer module "h264"
[73e00568] main input debug: switching to sync mode
[73b088b8] h26x demux debug: using 25.00 fps
所以我假设我收到了那些 late buffer
警告,因为 raspivid 发送的帧数很少,而且它没有足够的数据供编码器使用。视频大约每 10 秒冻结一次,这真的让它无法使用。当它移动时,它会加速。
如何告诉 h264 编码器它应该以 15 FPS 输入输出而不是 25 FPS 工作?
您可以将 --h264-fps=15
添加到 cvlc
。
raspivid -o - \
-t 0 \
-n \
-hf -vf \
-g 15 \
-pf high \
-md 2 \
-fps 15 \
-br 55 \
-ISO 800 \
-ae 32,0x00,0x8080FF \
-a 4 \
-a "%Y-%m-%d %X" \
-b 10000000 \
| cvlc -vvv \
stream:///dev/stdin \
--no-audio \
--demux=h264 \
--h264-fps=15 \
--sout '#standard{access=http,mux=ts,dst=:8090}'
在 Raspberry Pi Zero 上,您必须将 force_turbo=1
添加到 \boot\config.txt
,但不要设置 over_voltage
和 arm_freq
因为那样会使保修失效。如果没有 force_turbo=1
,设备将在流式传输几个小时后死机。