[FFmpeg-user] FFMPEG RTSP stream problem

Balogh László laci at blacc.hu
Thu Apr 7 13:14:26 EEST 2022

Hi to All,

I'm new in this mailing list, so first thanks to letting me in. :)

I have an RTSP stream which framerate is 1/16, which means every 16 sec 
a frame is transported through RTSP. This framerate is because of a 
special purpose, cannot and want not to change it.

What i want is to save every frame of this video as single JPEG image on 
my server (Linux). Here the full command, which is working in bash script:

ffmpeg -rtsp_transport tcp -i 
'rtsp://<USERNAME>:(PASSWORD>@<IPADDRESS>:556/h264/ch1/maiv_stream' -f 
image2 -vframes 1 -pix_fmt yuvj420p /<PATH>/$datetoday/$today.jpeg

The $datetoday ad $today variables are declared in the script, and the 
ffmpeg command is started again right after it is closing.

So, the script is working, i get the images, which are fine. BUT! Every 
ffmoeg process takes about 2 minutes! So i get images about every 2 
minutes. How can is speed up the ffmpeg command?  What i see while the 
script is running that after the following screenshot, its waiting about 
2 minutes. But don't know why?

ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg 
   built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
   configuration: --prefix=/usr --extra-version=0ubuntu0.2 
--toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu 
--incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping 
--enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa 
--enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca 
--enable-libcdio --enable-libflite --enable-libfontconfig 
--enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm 
--enable-libmp3lame --enable-libmysofa --enable-libopenjpeg 
--enable-libopenmpt --enable-libopus --enable-libpulse 
--enable-librubberband --enable-librsvg --enable-libshine 
--enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh 
--enable-libtheora --enable-libtwolame --enable-libvorbis 
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 
--enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi 
--enable-omx --enable-openal --enable-opengl --enable-sdl2 
--enable-libdc1394 --enable-libdrm --enable-libiec61883 
--enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 
   libavutil      55. 78.100 / 55. 78.100
   libavcodec     57.107.100 / 57.107.100
   libavformat    57. 83.100 / 57. 83.100
   libavdevice    57. 10.100 / 57. 10.100
   libavfilter     6.107.100 /  6.107.100
   libavresample   3.  7.  0 /  3.  7.  0
   libswscale      4.  8.100 /  4.  8.100
   libswresample   2.  9.100 /  2.  9.100
   libpostproc    54.  7.100 / 54.  7.100

And after that its finishing with the following lines:

Input #0, rtsp, from 
     title           : Media Presentation
   Duration: N/A, start: 94.881000, bitrate: N/A
     Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 
2688x1520, 1 fps, 1 tbr, 90k tbn, 2 tbc
Stream mapping:
   Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
Output #0, image2, to '/home/mcll/RTSP/2022-04-07/2022-04-07_12_09_30.jpeg':
     title           : Media Presentation
     encoder         : Lavf57.83.100
     Stream #0:0: Video: mjpeg, yuvj420p(pc), 2688x1520, q=2-31, 200 
kb/s, 1 fps, 1 tbn, 1 tbc
       encoder         : Lavc57.107.100 mjpeg
     Side data:
       cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
frame=    1 fps=0.0 q=5.8 Lsize=N/A time=00:00:01.00 bitrate=N/A speed=11.5x
video:125kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB 
muxing overhead: unknown

So no error, nothing.

Can anyone help me?

Thank you!

Regards, Laszlo

More information about the ffmpeg-user mailing list