Use FFmpeg as a RTSP receiver : images smearing and packets missed

Steam recording with RTMPDump or FFmpeg.
Post Reply
willis007
Posts: 1
Joined: Tue Aug 28, 2018 11:09 am

Use FFmpeg as a RTSP receiver : images smearing and packets missed

Post by willis007 » Tue Aug 28, 2018 12:16 pm

Hi everyone,

I allow myself to relaunch the subject because I am facing to a similar problem.

I have 5 GeoVision cameras connected to my switch (the switch is also from the manufacturer GeoVision). My goal is to record the flow of cameras in 4 mp4 files for 11 minutes as soon as I give them the order through a program that we are developing.

The switch is well configured, it has a 1Gb / s output just like the local network card pc. Ethernet cables are less than 10 meters and are all Class 6 S / FTP.

So, we start this script :

$scriptpath = $MyInvocation.MyCommand.Path
$dir = Split-Path $scriptpath
Write-host "My directory is $dir"

Push-Location $dir

$IP4s = @("10", "11", "12", "13", "14")

foreach ($IP4 in $IP4s) {
$IP="192.168.2."+$IP4
Echo $IP
$env:FFREPORT = "file="+$IP+".capture.log:level=32"
$argList="-t 660 -report -i rtsp://"+$IP+":8554//CH001.sdp -c:a copy -c:v copy test_ffmpeg_dump_multi_"+$IP+".mp4"
Start-Process "D:\Fidergo_LeoCAM\ffmpeg-4.0.1-win64-static\bin\ffmpeg.exe" -ArgumentList $argList
}


Then open 5 ffmpeg consoles that record the streams :
fmpeg started on 2018-08-28 at 14:06:56
Report written to "192.168.2.14.capture.log"
Command line:
"D:\\Fidergo_LeoCAM\\ffmpeg-4.0.1-win64-static\\bin\\ffmpeg.exe" -t 660 -report -i rtsp://192.168.2.14:8554//CH001.sdp -c:a copy -c:v copy test_ffmpeg_dump_multi_192.168.2.14.mp4
ffmpeg version 4.0.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7.3.1 (GCC) 20180710
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
[udp @ 000001d08936e580] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 000001d089384640] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 000001d089395380] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 000001d0893a5640] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 000001d0893b5e80] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 000001d0893c6140] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
Input #0, rtsp, from 'rtsp://192.168.2.14:8554//CH001.sdp':
Metadata:
title : streamed by the GeoVision Rtsp Server
comment : CH001.sdp
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (High), yuvj420p(pc, bt709, progressive), 1920x1080, 15 fps, 15 tbr, 90k tbn, 30 tbc
Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
Stream #0:2: Data: none
Output #0, mp4, to 'test_ffmpeg_dump_multi_192.168.2.14.mp4':
Metadata:
title : streamed by the GeoVision Rtsp Server
comment : CH001.sdp
encoder : Lavf58.12.100
Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 1920x1080, q=2-31, 15 fps, 15 tbr, 90k tbn, 90k tbc
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mp4 @ 000001d089d67040] Non-monotonous DTS in output stream 0:0; previous: 12828, current: 2686; changing to 12829. This may result in incorrect timestamps in the output file.
[mp4 @ 000001d089d67040] Non-monotonous DTS in output stream 0:0; previous: 12829, current: 4568; changing to 12830. This may result in incorrect timestamps in the output file.
[mp4 @ 000001d089d67040] Non-monotonous DTS in output stream 0:0; previous: 12830, current: 7151; changing to 12831. This may result in incorrect timestamps in the output file.
[mp4 @ 000001d089d67040] Non-monotonous DTS in output stream 0:0; previous: 12831, current: 9857; changing to 12832. This may result in incorrect timestamps in the output file.
frame= 45 fps=0.0 q=-1.0 size= 1280kB time=00:00:01.45 bitrate=7228.9kbits/s speed= 2.8x

And so on for 11 minutes...

But for reasons that I do not know, I regularly have this kind of mistake :
[rtsp @ 000001f2fca2b480] max delay reached. need to consume packet
[rtsp @ 000001f2fca2b480] RTP: missed 183 packets


This results in defects in the image. This error may very well never happen, then suddenly arrive in a completely random way, as much on the frequency as for the number of the camera.

I specify that during the recording, no other action is performed on the PC. Not even opening a web page. The PC is an I5 with 16GB of memory and an SSD hard drive.

I have been looking for more days but can not find a solution. I also searched throughout the forum but was not found a subject with a similar problem that would have been solved.

I would really like to solve this problem because it would annoy me that we develop our own program to finial get videos with flaws of images: /.

Thank you veyr much in advance for your preicous help.
Kind regards,
François

Post Reply