How to implement RTSP stream to RTSP server with ffmpeg?

Viewed 145

重现步骤

I use this cmd to push /dev/video1 to my rtsp server:
ffmpeg -f v4l2 -input_format nv12 -r 30 -s 1920x1080 -i /dev/video1 -c:v h264_v4l2m2m -b:v 4M -fflags +genpts -use_wallclock_as_timestamps 1 -vsync passthrough -copyts -muxdelay 0.1 -muxpreload 0.1 -avoid_negative_ts make_zero -vf "setpts=PTS-STARTPTS" -f rtsp rtsp://1770448569:0511e7f0130ef0654958de56e0f7b9c1@xx.xx.xx.xx:5554/c85ccc9684b0

期待结果和实际结果

I use VLC get stream with (port 6554): rtsp://1770448569:0511e7f0130ef0654958de56e0f7b9c1@xx.xx.xx.xx:6554/c85ccc9684b0
Before, t use ffmpeg push file.mp4 and VLC stream ok.

软硬件版本信息

HW: 01Studio CanMV
FW: k230_linux sdk

错误日志

尝试解决过程

K230 log:
[rtsp @ 0x2ac84e8bd0] Non-monotonous DTS in output stream 0:0; previous: 0, current: 0; changing to 1. This may result in incorrect timestamps in the output file.
VLC log:
h264 warning: waiting for SPS/PPS ....

补充材料

1 Answers

You can use the following command to improve:

ffmpeg -f v4l2 -input_format nv12 -r 30 -s 1920x1080 -i /dev/video1 -c:v h264_v4l2m2m -b:v 2M -vsync passthrough -f rtsp -rtsp_transport tcp rtsp://<your-rtsp-server-address>/*