I've encounetered a couple of challenges:
The 'master' mode camera won't take configuration by 'media-ctl'. Discussion thread here: viewtopic.php?t=361712
For this post, I'm having trouble with the "--circular" option in rpicam-vid. It does not appear to work for h264/libav in rpicam-vid anymore. I used this extensively on my rpi4 with libcamera-vid and it worked well.
Using this config:I run and see this:And you can see the file size is much bigger than the 1meg requested (it just continuously grows):I did a little light digging in the source for output.cpp (https://github.com/raspberrypi/rpicam-a ... output.cpp in the create it seems like if the codec is libav or h264 on rpi5, you'll never get the circular buffer?
The 'master' mode camera won't take configuration by 'media-ctl'. Discussion thread here: viewtopic.php?t=361712
For this post, I'm having trouble with the "--circular" option in rpicam-vid. It does not appear to work for h264/libav in rpicam-vid anymore. I used this extensively on my rpi4 with libcamera-vid and it worked well.
Using this config:
Code:
camera=0circular=1level=4.2output=/dev/shm/cam0.mp4save-pts=/dev/shm/cam0.ptswidth=1440 height=320 timeout=0 nopreview=1shutter=100 gain=16.0 brightness=0.0 contrast=1.0 saturation=0.0 sharpness=1.0 framerate=193 denoise=cdn_offno-raw=1
Code:
rpicam-vid --config ./utilities/cam0_config.txt[0:42:40.852804473] [3025] INFO Camera camera_manager.cpp:284 libcamera v0.2.0+46-075b54d5[0:42:40.867933246] [3028] INFO RPI pisp.cpp:662 libpisp version v1.0.4 6e3a53d137f4 14-02-2024 (14:00:12)[0:42:40.887648987] [3028] INFO RPI pisp.cpp:1121 Registered camera /base/axi/pcie@120000/rp1/i2c@88000/imx296@1a to CFE device /dev/media0 and ISP device /dev/media2 using PiSP variant BCM2712_C0[0:42:40.887729098] [3028] INFO RPI pisp.cpp:662 libpisp version v1.0.4 6e3a53d137f4 14-02-2024 (14:00:12)[0:42:40.898357162] [3028] INFO RPI pisp.cpp:1121 Registered camera /base/axi/pcie@120000/rp1/i2c@80000/imx296@1a to CFE device /dev/media1 and ISP device /dev/media4 using PiSP variant BCM2712_C0WARNING: consider inline headers with 'pause'/split/segment/circularOverriding H.264 level 4.2[0:42:40.899392511] [3025] INFO Camera camera.cpp:1183 configuring streams: (0) 1440x320-YUV420[0:42:40.899459825] [3028] INFO RPI pisp.cpp:1405 Sensor: /base/axi/pcie@120000/rp1/i2c@88000/imx296@1a - Selected sensor format: 1456x1088-SBGGR10_1X10 - Selected CFE format: 1456x1088-PC1B[libx264 @ 0x5555a24c3e30] using cpu capabilities: ARMv8 NEON[libx264 @ 0x5555a24c3e30] profile High, level 4.2, 4:2:0, 8-bit[libx264 @ 0x5555a24c3e30] 264 - core 164 r3095 baee400 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x3 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=0 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 slices=1 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=1 b_pyramid=0 b_adapt=1 b_bias=0 direct=1 weightb=0 open_gop=0 weightp=0 keyint=193 keyint_min=19 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 pb_ratio=1.30 aq=1:1.00Output #0, mp4, to '/dev/shm/cam0.mp4': Stream #0:0: Video: h264, yuv420p(tv, bt709), 1440x320, q=2-31, 193 fps, 193 tbr, 1000k tbn^CReceived signal 2[libx264 @ 0x5555a24c3e30] frame I:11 Avg QP:22.21 size: 42093[libx264 @ 0x5555a24c3e30] frame P:1027 Avg QP:24.33 size: 4829[libx264 @ 0x5555a24c3e30] frame B:1025 Avg QP:26.02 size: 580[libx264 @ 0x5555a24c3e30] consecutive B-frames: 0.6% 99.4%[libx264 @ 0x5555a24c3e30] mb I I16..4: 6.7% 23.9% 69.4%[libx264 @ 0x5555a24c3e30] mb P I16..4: 1.6% 2.9% 0.1% P16..4: 50.4% 0.0% 0.0% 0.0% 0.0% skip:45.0%[libx264 @ 0x5555a24c3e30] mb B I16..4: 0.2% 0.2% 0.0% B16..8: 4.8% 0.0% 0.0% direct: 5.4% skip:89.4% L0:22.4% L1:73.9% BI: 3.7%[libx264 @ 0x5555a24c3e30] 8x8 transform intra:55.5% inter:39.4%[libx264 @ 0x5555a24c3e30] coded y,uvDC,uvAC intra: 80.5% 0.2% 0.0% inter: 12.4% 0.0% 0.0%[libx264 @ 0x5555a24c3e30] i16 v,h,dc,p: 22% 17% 30% 31%[libx264 @ 0x5555a24c3e30] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 18% 36% 4% 5% 4% 5% 5% 9%[libx264 @ 0x5555a24c3e30] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 21% 14% 4% 13% 8% 8% 5% 8%[libx264 @ 0x5555a24c3e30] i8c dc,h,v,p: 99% 0% 1% 0%[libx264 @ 0x5555a24c3e30] kb/s:1408.86
Code:
/dev/shm $ ls -altotal 5168drwxrwxrwt 2 root root 140 Feb 24 15:29 .drwxr-xr-x 16 root root 4780 Feb 24 14:46 ..-rw-r--r-- 1 ddbaron ddbaron 5242928 Feb 24 15:29 cam0.mp4-rw-r--r-- 1 ddbaron ddbaron 0 Feb 24 15:29 cam0.pts
Code:
Output *Output::Create(VideoOptions const *options){if (options->codec == "libav" || (options->codec == "h264" && !bcm2835_encoder_available()))return new Output(options);if (strncmp(options->output.c_str(), "udp://", 6) == 0 || strncmp(options->output.c_str(), "tcp://", 6) == 0)return new NetOutput(options);else if (options->circular)return new CircularOutput(options);else if (!options->output.empty())return new FileOutput(options);elsereturn new Output(options);}
Statistics: Posted by ddbaron — Sat Feb 24, 2024 9:34 pm