Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4906

Camera board • Unable to Open Video Codec | rpicam-vid with libav | Bookworm

$
0
0
Hi everyone,

I am trying to run this command to live stream the raspberry pi v3 camera to my RTMP server (using /dev/null as an output to eliminate any network issues):

Code:

rpicam-vid -t 0 --level 4.2 --denoise cdn_off --framerate 50 --bitrate 8000000 --hflip --vflip --width 1920 --height 1080 --autofocus-mode default --codec libav --libav-format flv -o /dev/null
I am getting this error:

Code:

ERROR: *** libav: unable to open video codec: -22 ***
Full rpicam-vid output:

Code:

[0:01:13.706171577] [765]  INFO Camera camera_manager.cpp:284 libcamera v0.2.0+46-075b54d5[0:01:13.857733396] [768]  WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise[0:01:13.860427320] [768]  INFO RPI vc4.cpp:447 Registered camera /base/soc/i2c0mux/i2c@1/imx708@1a to Unicam device /dev/media4 and ISP device /dev/media0[0:01:13.860555739] [768]  INFO RPI pipeline_base.cpp:1144 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'Preview window unavailableMode selection for 1920:1080:12:P(50)    SRGGB10_CSI2P,1536x864/120.135 - Score: 2200    SRGGB10_CSI2P,2304x1296/56.0255 - Score: 1150    SRGGB10_CSI2P,4608x2592/14.3536 - Score: 73342.8Stream configuration adjusted[0:01:13.867210228] [765]  INFO Camera camera.cpp:1183 configuring streams: (0) 1920x1080-YUV420 (1) 2304x1296-SRGGB10_CSI2P[0:01:13.867591561] [768]  INFO RPI vc4.cpp:611 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 2304x1296-SRGGB10_1X10 - Selected unicam format: 2304x1296-pRAA[h264_v4l2m2m @ 0x559d61f0e0]  <<< v4l2_encode_init: fmt=179/0[h264_v4l2m2m @ 0x559d61f0e0] Using device /dev/video11[h264_v4l2m2m @ 0x559d61f0e0] driver 'bcm2835-codec' on card 'bcm2835-codec-encode' in mplane mode[h264_v4l2m2m @ 0x559d61f0e0] requesting formats: output=YU12 capture=H264[h264_v4l2m2m @ 0x559d61f0e0] Failed to get exported drm handles[h264_v4l2m2m @ 0x559d61f0e0] output buffer[0] initialization (Invalid argument)[h264_v4l2m2m @ 0x559d61f0e0] no v4l2 output context's buffers[h264_v4l2m2m @ 0x559d61f0e0] can't configure encoderERROR: *** libav: unable to open video codec: -22 ***
I previously had this working on the new Pi5 but I am unable to get this working on the CM4.

rpicam-hello --list-cameras outputs:

Code:

Available cameras-----------------0 : imx708_wide_noir [4608x2592 10-bit RGGB] (/base/soc/i2c0mux/i2c@1/imx708@1a)    Modes: 'SRGGB10_CSI2P' : 1536x864 [120.13 fps - (768, 432)/3072x1728 crop]                             2304x1296 [56.03 fps - (0, 0)/4608x2592 crop]                             4608x2592 [14.35 fps - (0, 0)/4608x2592 crop]
rpicam-hello runs fine:

Code:

[0:08:30.282171687] [791]  INFO Camera camera_manager.cpp:284 libcamera v0.2.0+46-075b54d5[0:08:30.433067583] [794]  WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise[0:08:30.435663414] [794]  INFO RPI vc4.cpp:447 Registered camera /base/soc/i2c0mux/i2c@1/imx708@1a to Unicam device /dev/media4 and ISP device /dev/media0[0:08:30.435743321] [794]  INFO RPI pipeline_base.cpp:1144 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'Preview window unavailableMode selection for 2304:1296:12:P    SRGGB10_CSI2P,1536x864/0 - Score: 3400    SRGGB10_CSI2P,2304x1296/0 - Score: 1000    SRGGB10_CSI2P,4608x2592/0 - Score: 1900Stream configuration adjusted[0:08:30.438121282] [791]  INFO Camera camera.cpp:1183 configuring streams: (0) 2304x1296-YUV420 (1) 2304x1296-SBGGR10_CSI2P[0:08:30.438585652] [794]  INFO RPI vc4.cpp:611 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 2304x1296-SBGGR10_1X10 - Selected unicam format: 2304x1296-pBAA#0 (0.00 fps) exp 32680.00 ag 5.99 dg 1.01#1 (30.00 fps) exp 32680.00 ag 5.99 dg 1.01#2 (30.02 fps) exp 32680.00 ag 5.04 dg 1.20#3 (30.01 fps) exp 32680.00 ag 5.07 dg 1.20#4 (30.01 fps) exp 32680.00 ag 5.04 dg 1.20
ffmpeg shows all the correct encoders (To the best of my understanding the default is h264_v4l2m2m)
ffmpeg -encoders | grep h264 output:

Code:

 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)
Here's what I have done to get to this stage:
  • Clean install of 64-bit version of Bookworm lite
  • sudo dtc -I dts -O dtb -o /boot/firmware/dt-blob.bin /home/pi/dt-blob.dts (to enable cam0 on cm4)
  • sudo apt-get update && sudo apt-get upgrade -y
  • sudo apt-get install ffmpeg rpicam-apps -y

Am I doing something wrong or missing something obvious here?

Thanks in advance,
Jamie

Statistics: Posted by jwainwright87 — Thu Feb 22, 2024 1:23 pm



Viewing all articles
Browse latest Browse all 4906

Trending Articles