在Raspberry Pi 4上进行了一些测试,因此我尝试使用最少的资源。
我有一个连接到Pi的USB端口的网络摄像头,它支持将视频流作为压缩的H264流发送:
ffmpeg -f v4l2 -list_formats all -i /dev/video1
[video4linux2,v4l2 @ 0x204e1c0] Compressed: mjpeg : Motion-JPEG : 640x360 1280x720 1920x1080
[video4linux2,v4l2 @ 0x204e1c0] Raw : yuyv422 : YUYV 4:2:2 : 640x360 1280x720 1920x1080
[video4linux2,v4l2 @ 0x204e1c0] Compressed: h264 : H.264 : 640x360 1280x720 1920x1080
As I'm trying to send the stream to a RTMP endpoint (nginx-rtmp
), I'm using the following options to send it:
ffmpeg -f video4linux2 -input_format h264 -i /dev/video0 -c:v libx264 -an -f flv rtmp://localhost:1935/desk/stream
但是,我看不到编码中CPU利用率的任何改善,使我相信它仍在重新编码。