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

Graphics, sound and multimedia • Re: rtsp camera stream

$
0
0
nice -n -11 rpicam-vid --low-latency 1 -b 1500000 --autofocus-mode manual --autofocus-range normal --autofocus-window 0.25,0.25,0.5,0.5 --denoise cdn_off \
--libav-video-codec-opts bf=0 --intra 0 --codec libav --libav-format flv --brightness 0.1 --contrast 1.0 --sharpness 1.0 \
--profile=high --hdr=off --libav-video-codec h264_v4l2m2m --level 4.2 --framerate 24 --width 1536 --height 864 \
--audio-device=alsa_input.usb-Creative_Technology_Ltd_Sound_Blaster_Play__3_00229929-00.analog-stereo --av-sync=0 \
--audio-codec aac --audio-channels 2 --libav-audio 1 --audio-source pulse --audio-samplerate=48000 --audio-bitrate=128kbps \
-t 0 --flush 0 -n --inline -o - | ffmpeg -hide_banner -fflags nobuffer+discardcorrupt+genpts -flags low_delay \
-hwaccel drm -hwaccel_output_format drm_prime -i - -metadata title='Lucy' \
-c:v h264_v4l2m2m -b:v 1M -maxrate 1M -minrate 1M -bufsize 500k -bf 0 -filter:v fps=fps=source_fps:round=near \
-c:a libfdk_aac -profile:a aac_he -vbr 0 -threads $(nproc) -fps_mode:v cfr -max_muxing_queue_size 9999 -flush_packets 0 -af aresample=async=1:first_pts=0 \
-f rtsp -rtsp_transport udp rtsp://localhost:8554"/mystream
The part
-hwaccel drm -hwaccel_output_format drm_prime
is related to HEVC, not for H264
And RPI4 has HEVC in hardware, but your input is H264. And then you again set the output for h264_v4l2m2m
It all makes no sense and it just works likely because on RPI3 there is no HEVC so that part silently fails I guess.

In general, if you want the stream to have H264, it shall be the output of rpicam-vid already and ffmpeg would then maybe needed to implement something that rpicam-vid + its libav does not support. You should just pass on the H264 stream with -c:v copy as output specifier.

"The sync issue on the Raspberry Pi 4 is actually often rooted in the Broadcom BCM2711 architecture, where audio and video clocks are no longer as tightly coupled as in previous models. By using the FFmpeg flags -use_wallclock_as_timestamp 1 and -isync, you force the system to use the actual real-time wall clock as a reference instead of relying on the often-drifting timestamps of the input streams."



here ist the script that works on all rpi for days
no av desync !

nice -n -11 stdbuf -oL -eL rpicam-vid \
--denoise cdn_off -t 0 --width 1280 --height 720 --framerate 25 \
--autofocus-mode manual --autofocus-range normal \
--autofocus-window 0.25,0.25,0.5,0.5 \
--libav-video-codec h264_v4l2m2m --libav-format h264 --codec libav --inline \
--awb indoor --profile baseline --intra 25 -b 1500000 -n -o - | \
nice -n -11 ffmpeg -y \
-fflags +genpts+igndts+nobuffer+flush_packets \
-use_wallclock_as_timestamps 1 \
-thread_queue_size 128 -f h264 -r 25 -i - \
-thread_queue_size 256 -f pulse -fragment_size 512 -isync 0 -i default \
-c:v copy -metadata title='kali' \
-c:a libopus -application lowdelay -ac 1 -vbr off -b:a 64k -frame_duration 5 -compression_level 0 \
-map 0:v:0 -map 1:a:0 \
-f rtsp -rtsp_transport tcp -tcp_nodelay 1 -muxdelay 0 -flags +low_delay -avioflags direct -pkt_size 1316 \
rtsp://

Statistics: Posted by mediauser — Fri Feb 06, 2026 9:36 am



Viewing all articles
Browse latest Browse all 8082

Trending Articles