[FFmpeg-user] FFMPEG RTSP stream problem

Steven Kan steven at kan.org
Thu Apr 7 20:53:25 EEST 2022

> 2022. 04. 07. 16:25 keltezéssel, Asbóth Bence írta:
>> Hi!
>> Maybe authentication takes so long? Try to keep the stream open, eg with
>> VLC.
> On Apr 7, 2022, at 9:03 AM, Balogh László <laci at blacc.hu> wrote:
> Hi!
> I tried, did not help. :(
> On VLC authenticating takes only a few sec. I need to wait just until to the next image is created. I don't know why ffmpeg is waiting 2 minutes.
> I attached a full screenlog of the script while running: log01.txt. You can see that about every 2 minutes needed to take one picture, however its about 16 secs that the stream contains a new frame (checked).
> I also attached a log file which was created by ffmeg (option -report added to command): ffmpeg-20220407-174123.log. I see no problems or errors.

I don’t know what the problem is with your setup, but I use a very similar command with a Wyze Cam v3/RTSP firmware and an M1 Mac Mini, and it works in about ~4 seconds per loop. I don’t know why it takes that long; I would have expected something closer to 1 second, but it’s not taking a minute like yours is. What camera and computer are you using?

cat ./WyzeSnapshotMultiFrameTest.sh                                                                               


cd /usr/local/bin
for ((i=0; i<=$NumFrames; i++)); do
	echo $outfile
	./ffmpeg -rtsp_transport tcp -i rtsp://anonymous:password@$IPAddress/live -frames:v 1 $outfile

which results in:

ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with Apple clang version 12.0.0 (clang-1200.0.32.27)
  configuration: --prefix=/Volumes/tempdisk/sw --extra-cflags=-fno-stack-check --arch=arm64 --cc=/usr/bin/clang --enable-gpl --enable-videotoolbox --enable-libopenjpeg --enable-libopus --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libvpx --enable-libwebp --enable-libass --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libsnappy --enable-libaom --enable-libvidstab --enable-libzimg --enable-libsvtav1 --enable-version3 --pkg-config-flags=--static --disable-ffplay --enable-postproc --enable-nonfree --enable-neon --enable-runtime-cpudetect --disable-indev=qtkit --disable-indev=x11grab_xcb
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://anonymous:password@':
    title           : Session streamed by the WYZE Media Server
    comment         : live
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: h264 (Main), yuv420p(tv, bt709, progressive), 1920x1080, 20 fps, 20 tbr, 90k tbn, 40 tbc
  Stream #0:1: Audio: pcm_alaw, 16000 Hz, mono, s16, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[swscaler @ 0x1100a8000] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to '/Users/steven/FinchLapse/test/10.jpg':
    title           : Session streamed by the WYZE Media Server
    comment         : live
    encoder         : Lavf58.76.100
  Stream #0:0: Video: mjpeg, yuvj420p(pc, bt709, progressive), 1920x1080, q=2-31, 200 kb/s, 20 fps, 20 tbn
      encoder         : Lavc58.134.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
frame=    1 fps=0.0 q=7.7 Lsize=N/A time=00:00:00.05 bitrate=N/A dup=1 drop=1 speed=0.621x    
video:107kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

More information about the ffmpeg-user mailing list