[FFmpeg-user] Issue with encoding HLS from RTMP input stream

Gabor Alsecz alseczg at gmail.com
Thu Oct 27 23:46:06 EEST 2016


Dear All,

I am facing the following issue constantly when encode HLS stream from RTMP
(h264) stream:
The video picture quality changing between good and bad. Bad means part of
the image/frame going to be squared (looks like huge individual pixels).


Here is the command line:
$ ffmpeg -v verbose -i rtsp://192.168.1.103:554/rtsp_tunnel -c:v libx264
-c:a aac -ac 1 -strict -2 -crf 18 -profile:v baseline -maxrate 3000k
-bufsize 8000k -pix_fmt yuv420p -flags -global_header -hls_time 3
-hls_list_size 0 -hls_wrap 0 -start_number 0 out.m3u8          ffmpeg
version 3.1.4 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth
--enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme
--enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264
--enable-libopenjpeg --enable-libopus --enable-librtmp
--enable-libschroedinger --enable-libsnappy --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg
--enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Routing option strict to both codec and muxer layer
[rtsp @ 0000000000348bc0] SDP:
v=0
o=- 0 0 IN IP4 192.168.1.103
s=LIVE VIEW
c=IN IP4 0.0.0.0
t=0 0
a=control:*
m=video 0 RTP/AVP 35
a=rtpmap:35 H264/90000
a=control:video
a=recvonly
a=fmtp:35
packetization-mode=1;profile-level-id=4d4029;sprop-parameter-sets=Z01AKZpmA8ARPy4C1AQEFAg=,aO44gA==

[rtsp @ 0000000000348bc0] setting jitter buffer size to 500
[rtsp @ 0000000000348bc0] max delay reached. need to consume packet
[rtsp @ 0000000000348bc0] RTP: missed 81 packets
[h264 @ 000000000034cb00] error while decoding MB 22 38, bytestream -5
[h264 @ 000000000034cb00] concealing 3627 DC, 3627 AC, 3627 MV errors in P
frame
Input #0, rtsp, from 'rtsp://192.168.1.103:554/rtsp_tunnel':
  Metadata:
    title           : LIVE VIEW
  Duration: N/A, start: 0.033389, bitrate: N/A
    Stream #0:0: Video: h264 (Main), 1 reference frame, yuv420p(tv,
bt470bg/bt709/bt709), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 29.97 tbr,
90k tbn, 180k tbc
[graph 0 input from stream 0:0 @ 00000000030b0f00] w:1920 h:1080
pixfmt:yuv420p tb:1/90000 fr:30000/1001 sar:1/1 sws_param:flags=2
[libx264 @ 0000000001cf8b40] using SAR=1/1
[libx264 @ 0000000001cf8b40] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX XOP FMA4 FMA3 LZCNT BMI1
[libx264 @ 0000000001cf8b40] profile Constrained Baseline, level 4.0
[hls @ 00000000031b09a0] Using AVStream.codec to pass codec parameters to
muxers is deprecated, use AVStream.codecpar instead.
[mpegts @ 0000000001cc0440] muxrate VBR, pcr every 2 pkts, sdt every
2147483647, pat/pmt every 2147483647 pkts
Output #0, hls, to 'out.m3u8':
  Metadata:
    title           : LIVE VIEW
    encoder         : Lavf57.41.100
    Stream #0:0: Video: h264 (libx264), 1 reference frame, yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 29.97 fps, 90k tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc57.48.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 3000000/0/0 buffer size: 8000000 vbv_delay:
-1
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[h264 @ 00000000027d6dc0] error while decoding MB 22 38, bytestream -5
[h264 @ 00000000027d6dc0] concealing 3627 DC, 3627 AC, 3627 MV errors in P
frame
Past duration 0.998985 too large
*** 3 dup!
[rtsp @ 0000000000348bc0] max delay reached. need to consume packet
[rtsp @ 0000000000348bc0] RTP: missed 48 packets
[h264 @ 00000000023a4dc0] error while decoding MB 9 50, bytestream -9
[h264 @ 00000000023a4dc0] concealing 2200 DC, 2200 AC, 2200 MV errors in P
frame
*** 5 dup!
[rtsp @ 0000000000348bc0] max delay reached. need to consume packetp=8
drop=0 speed=0.0936x
[rtsp @ 0000000000348bc0] RTP: missed 1 packets
[rtsp @ 0000000000348bc0] max delay reached. need to consume packet
[rtsp @ 0000000000348bc0] RTP: missed 294 packets
[h264 @ 00000000030b0660] error while decoding MB 41 9, bytestream -27
[h264 @ 00000000030b0660] concealing 7088 DC, 7088 AC, 7088 MV errors in I
frame
*** 5 dup!
[rtsp @ 0000000000348bc0] max delay reached. need to consume packetp=13
drop=0 speed=0.581x
[rtsp @ 0000000000348bc0] RTP: missed 2 packets
[h264 @ 0000000001c4afe0] error while decoding MB 115 62, bytestream -5
[h264 @ 0000000001c4afe0] concealing 654 DC, 654 AC, 654 MV errors in P
frame
[rtsp @ 0000000000348bc0] max delay reached. need to consume packet
[rtsp @ 0000000000348bc0] RTP: missed 3 packets
[h264 @ 000000000034e160] error while decoding MB 90 44, bytestream -6
[h264 @ 000000000034e160] concealing 2839 DC, 2839 AC, 2839 MV errors in P
frame
[hls @ 00000000031b09a0] EXT-X-MEDIA-SEQUENCE:004.07 bitrate=N/A dup=13
drop=0 speed=0.832x
[rtsp @ 0000000000348bc0] max delay reached. need to consume packetp=13
drop=0 speed=0.883x
[rtsp @ 0000000000348bc0] RTP: missed 16 packets
[rtsp @ 0000000000348bc0] max delay reached. need to consume packet
[rtsp @ 0000000000348bc0] RTP: missed 68 packets
[h264 @ 00000000023a4dc0] concealing 6559 DC, 6559 AC, 6559 MV errors in I
frame
[rtsp @ 0000000000348bc0] max delay reached. need to consume packetp=13
drop=0 speed=0.879x
[rtsp @ 0000000000348bc0] RTP: missed 7 packets
[h264 @ 00000000027d7260] error while decoding MB 46 46, bytestream -5
[h264 @ 00000000027d7260] concealing 2643 DC, 2643 AC, 2643 MV errors in P
frame
[rtsp @ 0000000000348bc0] max delay reached. need to consume packet
[rtsp @ 0000000000348bc0] RTP: missed 9 packets
[rtsp @ 0000000000348bc0] max delay reached. need to consume packet
[rtsp @ 0000000000348bc0] RTP: missed 10 packets
[h264 @ 000000000034e160] cabac decode of qscale diff failed at 102 26
[h264 @ 000000000034e160] error while decoding MB 102 26, bytestream 1260
[h264 @ 000000000034e160] concealing 4987 DC, 4987 AC, 4987 MV errors in P
frame
[rtsp @ 0000000000348bc0] max delay reached. need to consume packet
[rtsp @ 0000000000348bc0] RTP: missed 2 packets
[h264 @ 00000000027d6dc0] concealing 913 DC, 913 AC, 913 MV errors in P
frame0 speed=0.884x
[rtsp @ 0000000000348bc0] max delay reached. need to consume packet
[rtsp @ 0000000000348bc0] RTP: missed 16 packets
*** 1 dup!
[h264 @ 00000000027d6dc0] error while decoding MB 77 63, bytestream -5
[h264 @ 00000000027d6dc0] concealing 572 DC, 572 AC, 572 MV errors in P
frame
*** 1 dup!
[rtsp @ 0000000000348bc0] max delay reached. need to consume packetp=15
drop=0 speed=0.887x
[rtsp @ 0000000000348bc0] RTP: missed 15 packets
[h264 @ 000000000034e160] error while decoding MB 24 41, bytestream -11
[h264 @ 000000000034e160] concealing 3265 DC, 3265 AC, 3265 MV errors in P
frame
*** 1 dup!
[rtsp @ 0000000000348bc0] max delay reached. need to consume packetp=16
drop=0 speed=0.891x
[rtsp @ 0000000000348bc0] RTP: missed 15 packets
[h264 @ 00000000030b0660] error while decoding MB 119 37, bytestream -5
[h264 @ 00000000030b0660] concealing 3650 DC, 3650 AC, 3650 MV errors in P
frame
[rtsp @ 0000000000348bc0] max delay reached. need to consume packet
[rtsp @ 0000000000348bc0] RTP: missed 170 packets
*** 1 dup!

I've tested with 2 different IP cameras on 2 different servers, but the
result always the same. Shouldn't be any networking problem, also the cam
directly connected to the PC.

Any idea?


br,
g.


More information about the ffmpeg-user mailing list