0

I have a surveillance system with many IP cameras. I need to make a 5 sec. video clip with ffmpeg in Ubuntu 16.04. I used this command:

ffmpeg -i rtsp://user:pass@ip_adress/h264 -r 9 -s 720x400 -t 0:00:5 -f mp4 -y /home/user/myvideo.mp4

It's fine, it made the video clip, but the whole video clip has visual artifacts.

1 sec error to video clip

 built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609

 configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --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-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --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-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv

  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100

Input #0, rtsp, from 'rtsp://log:pass@ip_adress/h264':

  Metadata:
    title           : LIVE VIEW
  Duration: N/A, start: 0.033311, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn, 180k tbc
[libx264 @ 0x1dbb2c0] using SAR=80/81
[libx264 @ 0x1dbb2c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x1dbb2c0] profile High, level 2.2
[libx264 @ 0x1dbb2c0] 264 - core 148 r2643 5c65704 - 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=12 lookahead_threads=2 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=9 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/user/user.mp4':
  Metadata:
    title           : LIVE VIEW
    encoder         : Lavf56.40.101
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 720x400 [SAR 80:81 DAR 16:9], q=-1--1, 9 fps, 18432 tbn, 9 tbc
    Metadata:
      encoder         : Lavc56.60.100 libx264
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[NULL @ 0x1c7c360] <b>RTP: missed 136 packets</b>
[h264 @ 0x523e680] <b>error while decoding MB 98 24, bytestream -5</b>
[h264 @ 0x523e680] concealing 5231 DC, 5231 AC, 5231 MV errors in I frame
frame=   13 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 
bitrate=N/A dup=0 droframe=   18 fps= 18 q=0.0 size=       0kB time=00:00:00.00 
bitrate=N/A dup=0 droframe=   23 fps= 14 q=0.0 size=       0kB time=00:00:00.00 
bitrate=N/A dup=0 droframe=   29 fps= 14 q=0.0 size=       0kB time=00:00:00.00 
bitrate=N/A dup=0 droframe=   32 fps= 12 q=0.0 size=       0kB time=00:00:00.00 
bitrate=N/A dup=0 droframe=   38 fps= 12 q=0.0 size=       0kB time=00:00:00.00 
bitrate=N/A dup=0 droframe=   44 fps= 12 q=0.0 size=       0kB time=00:00:00.00 
bitrate=N/A dup=0 droframe=   45 fps= 10 q=-1.0 Lsize=     110kB time=00:00:04.77 
bitrate= 188.5kbits/s dup=0 drop=99  

video:109kB audio:0kB 
subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.285777%
[libx264 @ 0x1dbb2c0] frame I:1     Avg QP:17.74  size: 40280
[libx264 @ 0x1dbb2c0] frame P:11    Avg QP:18.86  size:  4478
[libx264 @ 0x1dbb2c0] frame B:33    Avg QP:21.73  size:   634
[libx264 @ 0x1dbb2c0] consecutive B-frames:  2.2%  0.0%  0.0% 97.8%
[libx264 @ 0x1dbb2c0] mb I  I16..4: 10.0% 47.3% 42.8%
[libx264 @ 0x1dbb2c0] mb P  I16..4:  0.2%  0.1%  0.1%  P16..4: 43.9% 13.7% 13.4%  0.0%  0.0%    skip:28.7%
[libx264 @ 0x1dbb2c0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 33.1%  1.2%  0.2%  direct: 0.3%  skip:65.2%  L0:51.1% L1:46.9% BI: 2.0%
[libx264 @ 0x1dbb2c0] 8x8 transform intra:46.3% inter:75.5%
[libx264 @ 0x1dbb2c0] coded y,uvDC,uvAC intra: 84.6% 86.9% 72.6% inter: 8.8% 12.8% 1.0%
[libx264 @ 0x1dbb2c0] i16 v,h,dc,p:  6% 26%  4% 64%
[libx264 @ 0x1dbb2c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  5% 47% 12%  4%  4%  1% 10%  3% 14%
[libx264 @ 0x1dbb2c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  9% 42%  8%  4%  5%  3% 15%  3% 12%
[libx264 @ 0x1dbb2c0] i8c dc,h,v,p: 37% 51%  5%  7%
[libx264 @ 0x1dbb2c0] Weighted P-Frames: Y:18.2% UV:0.0%
[libx264 @ 0x1dbb2c0] ref P L0: 50.0%  4.3% 31.6% 11.9%  2.3%
[libx264 @ 0x1dbb2c0] ref B L0: 51.2% 33.1% 15.7%
[libx264 @ 0x1dbb2c0] ref B L1: 76.7% 23.3%
[libx264 @ 0x1dbb2c0] kb/s:176.72

That error 1 sec. to 5 sec. video clip. How to fix problems with this video?

0

I have solved the problem. The point is that if a stream of huge 10000 kbit/s that ffmpeg doesn't maintain the entering rtsp. I have given to rstp a stream of poor quality of 3000 kbit/s and artifacts have disappeared

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.