Привет всем!
Есть несколько камер, на них поднято вещание в RTSP
Изначально использовались Win сервера и Macroscope, но решение не гибкое, дорогое и не стабильное оказалось.
Поэтому решили перейти на Linux, используется Debian
Запись пытался делать с помощью ffmpeg командой:
/usr/bin/ffmpeg -i rtsp://172.16.30.11:554/user=admin_password=123456_channel=1_stream=0.sdp?real_stream -y -r 20 -s hd720 -b 4000k -vcodec libx264 -threads 8 -f segment -strftime 1 -segment_time 30 -segment_format mp4 /opt/video/cam1/%Y-%m-%d-%H-%M-%S.mp4
Но видео записываются кривые, кадры накладываются, плывут и рябь появляется.
Не могу понять в чем дело, на Macroscope качество было отличное.
ffmpeg log:
libavutil 54. 20.100 / 54. 20.100
libavcodec 56. 26.100 / 56. 26.100
libavformat 56. 25.101 / 56. 25.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.102 / 5. 11.102
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
[h264 @ 0x1e62de0] RTP: missed 9 packets
[h264 @ 0x1e62de0] RTP: missed 7 packets
[h264 @ 0x1e62de0] concealing 4087 DC, 4087 AC, 4087 MV errors in I frame
Input #0, rtsp, from 'rtsp://172.16.30.11:554/user=admin_password=123456_channel=1_stream=0.sdp?real_stream':
Metadata:
title : RTSP Session
Duration: N/A, start: 0.320000, bitrate: N/A
Stream #0:0: Video: h264 (Main), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 15 fps, 15 tbr, 90k tbn, 30 tbc
Please use -b:a or -b:v, -b is ambiguous
[libx264 @ 0x1fb0f00] using SAR=1/1
[libx264 @ 0x1fb0f00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
[libx264 @ 0x1fb0f00] profile High, level 3.1
[libx264 @ 0x1fb0f00] 264 - core 146 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=8 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=20 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=4000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, segment, to '/opt/video/cam1/%Y-%m-%d-%H-%M-%S.mp4':
Metadata:
title : RTSP Session
encoder : Lavf56.25.101
Stream #0:0: Video: h264 (libx264), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 4000 kb/s, 20 fps, 10240 tbn, 20 tbc
Metadata:
encoder : Lavc56.26.100 libx264
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[h264 @ 0x275c8c0] concealing 4087 DC, 4087 AC, 4087 MV errors in I frame
Past duration 0.666664 too large
[NULL @ 0x1e62de0] RTP: missed 35 packets
[NULL @ 0x1e62de0] RTP: missed 1 packets00:00:00.00 bitrate=N/A dup=8 drop=5
[NULL @ 0x1e62de0] RTP: missed 2 packets
[h264 @ 0x2598d60] concealing 1995 DC, 1995 AC, 1995 MV errors in I frame
frame= 77 fps= 20 q=27.0 size=N/A time=00:00:01.15 bitrate=N/A dup=47 drop=5 [NULL @ 0x1e62de0] RTP: missed 43 packets
[h264 @ 0x275c8c0] error while decoding MB 70 31, bytestream -9
[h264 @ 0x275c8c0] Cannot use next picture in error concealment
[h264 @ 0x275c8c0] concealing 4419 DC, 4419 AC, 4419 MV errors in P frame
frame= 110 fps= 23 q=22.0 size=N/A time=00:00:02.80 bitrate=N/A dup=69 drop=5 [NULL @ 0x1e62de0] RTP: missed 34 packets
[h264 @ 0x262f600] error while decoding MB 55 21, bytestream -14
[h264 @ 0x262f600] concealing 5634 DC, 5634 AC, 5634 MV errors in I frame
frame= 128 fps= 25 q=17.0 size=N/A time=00:00:03.70 bitrate=N/A dup=79 drop=5 frame= 133 fps= 23 q=22.0 size=N/A time=00:00:03.95 bitrate=N/A dup=80 drop=5 [NULL @ 0x1e62de0] RTP: missed 5 packets
[h264 @ 0x275c8c0] error while decoding MB 111 29, bytestream -7
[h264 @ 0x275c8c0] Cannot use next picture in error concealment
[h264 @ 0x275c8c0] concealing 4618 DC, 4618 AC, 4618 MV errors in P frame