I am using raspberry pi-4 8GB to take input from a video device /dev/video0
and output it over a network rtp://192.168.10.10:6001
I am using following ffmpeg command ffmpeg -f v4l2 -i /dev/video0 -c:v h264 -f rtp "rtp://192.168.10.10:6001"
but the issue is it uses 252% of the cpu and raspberry pi get is getting on fire. How can I solve it
1 Answer
Try using a hardware video encoder to lessen the load on the CPU. You can get a list of h264 encoders like this:
ffmpeg -v warning -encoders | grep 264
V....D libx264 libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec h264)
V....D libx264rgb libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB (codec h264)
V....D h264_nvenc NVIDIA NVENC H.264 encoder (codec h264)
V..... h264_omx OpenMAX IL H.264 video encoder (codec h264)
V..... h264_v4l2m2m V4L2 mem2mem H.264 encoder wrapper (codec h264)
V....D h264_vaapi H.264/AVC (VAAPI) (codec h264)
I believe the h264_omx
is the one implemented in hardware, so your command would look like:
ffmpeg ... -i /dev/video0 -c:v h264_omx ...
vcgencmd measure_temp
. Throttling of the CPU to prevent overheat starts at 85° C, it will not destroy itself.