[FFmpeg-user] Trouble with encodnig UDP->RTMP

антон савицкий antonjobber at yandex.ru
Mon Nov 16 18:11:41 CET 2015


Hello,everybody.

I have some problems with my UDP-> RTMP stream.

To start with I do it by this script:

#!/bin/sh
exec 2>&1

in="udp://127.0.0.1:10078?reuse=1"
out1="rtmp://127.0.0.1:1935/appname/test.sdp"



exec /usr/bin/ffmpeg -re -i $in -maxrate 3000k -bufsize 256000 -vcodec libx264 -s 1024x576 -x264opts keyint=50 -keyint_min 25 -acodec libmp3lame -ar 44100 -deinterlace -f flv $out1

That`s what I tryed to change but there was no result:
#exec /usr/bin/ffmpeg -re -i $in -bufsize 256000 -vcodec copy -acodec libmp3lame -ar 44100 -deinterlace -f flv $out1
#exec /usr/bin/ffmpeg -re -i $in -vcodec libx264 -s 1024x576 -x264opts keyint=50 -keyint_min 25 -acodec libfaac -deinterlace -f flv $out1
#exec /usr/bin/ffmpeg -re -i $in -vcodec libx264 -acodec libfaac -deinterlace -f flv $out1

When I start streaming,ffmpeg log:

[h264 @ 0xa3ae80] no frame!
Input #0, mpegts, from 'udp://127.0.0.1:10078?reuse=1':
  Duration: N/A, start: 53211.840000, bitrate: 192 kb/s
  Program 2
    Stream #0:0[0x1f4]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt470bg), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x2bc](RUS): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s
[libx264 @ 0xa696e0] using SAR=1/1
[libx264 @ 0xa696e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0xa696e0] profile High, level 3.1
[libx264 @ 0xa696e0] 264 - core 130 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - 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=36 lookahead_threads=4 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=50 keyint_min=25 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, flv, to 'rtmp://pub1.rtmp.s01.l.novoetv.cdnvideo.ru/novoetv/test.sdp?auth=140812jDNr':
  Metadata:
    encoder         : Lavf55.48.100
    Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 1024x576 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 1k tbn, 25 tbc
    Metadata:
      encoder         : Lavc55.69.100 libx264
    Stream #0:1(RUS): Audio: aac (libfaac) ([10][0][0][0] / 0x000A), 48000 Hz, stereo, s16, 128 kb/s
    Metadata:
      encoder         : Lavc55.69.100 libfaac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (mp2 (native) -> aac (libfaac))
Press [q] to stop, [?] for help
[mpegts @ 0xa26e00] PES packet size mismatchime=00:01:24.24 bitrate=1108.6kbits/s
[mp2 @ 0xa48a20] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
[h264 @ 0x3cf2320] concealing 799 DC, 799 AC, 799 MV errors in B frame08.5kbits/s
[h264 @ 0x38e6780] Reference 4 >= 334772kB time=00:04:12.01 bitrate=1130.3kbits/s
[h264 @ 0x38e6780] error while decoding MB 25 7, bytestream 3935
[h264 @ 0x38e6780] concealing 1329 DC, 1329 AC, 1329 MV errors in B frame
[mpegts @ 0xa26e00] PES packet size mismatchime=00:04:27.37 bitrate=1132.6kbits/s
[mp2 @ 0xa48a20] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
[h264 @ 0x3696a00] concealing 754 DC, 754 AC, 754 MV errors in P frame31.0kbits/s
[mpegts @ 0xa26e00] PES packet size mismatchime=00:04:57.31 bitrate=1133.5kbits/s
    Last message repeated 1 times
[h264 @ 0x38e6780] concealing 492 DC, 492 AC, 492 MV errors in P frame32.9kbits/s
[mp2 @ 0xa48a20] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
[h264 @ 0x3a0e640] Reference 4 >= 241235kB time=00:04:57.52 bitrate=1135.4kbits/s
[h264 @ 0x3a0e640] error while decoding MB 31 29, bytestream 5000
[h264 @ 0x3a0e640] concealing 333 DC, 333 AC, 333 MV errors in B frame
[h264 @ 0x372a960] concealing 546 DC, 546 AC, 546 MV errors in B frame
[h264 @ 0x3b36500] left block unavailable for requested intra4x4 mode -1 at 0 23s
[h264 @ 0x3b36500] error while decoding MB 0 23, bytestream 30282
[h264 @ 0x3b36500] concealing 634 DC, 634 AC, 634 MV errors in I frame
frame= 9581 fps= 22 q=28.0 size=   56972kB time=00:06:36.96 bitrate=1175.7kbits/s

When ffmpeg write "Error while decoding stream #0:1: Invalid data found when processing input" sound stops for a second and there is no problems with stream for about an hour,after that video  or audio disappears and there are a lot of artefacts.
Ffrobe of stream at this moment isn`t differ with ffprobe at the beginning.

I made the tcpdump of UDP stream and collect it into the stream(Follow the udp stream by Wireshark)when problem appears,and there is no problems with it.

ffrobe of UDP:

ffprobe udp://127.0.0.1:10078?reuse=1

ffprobe version 2.3 Copyright (c) 2007-2014 the FFmpeg developers
  built on Jul 25 2014 17:34:36 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --enable-avfilter --enable-libmp3lame --enable-libfaac --enable-libvorbis --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3
  libavutil      52. 92.100 / 52. 92.100
  libavcodec     55. 69.100 / 55. 69.100
  libavformat    55. 48.100 / 55. 48.100
  libavdevice    55. 13.102 / 55. 13.102
  libavfilter     4. 11.100 /  4. 11.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
[h264 @ 0x26c7300] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x26c7300] decode_slice_header error
[h264 @ 0x26c7300] no frame!
[h264 @ 0x26c7300] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x26c7300] decode_slice_header error
[h264 @ 0x26c7300] no frame!
Input #0, mpegts, from 'udp://127.0.0.1:10078?reuse=1':
  Duration: N/A, start: 22906.090311, bitrate: 192 kb/s
  Program 2
    Stream #0:0[0x1f4]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt470bg), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x2bc](RUS): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s

Maybe problem connects with encoding (mp2 (native) -> aac (libfaac))
? Can anybody help?


More information about the ffmpeg-user mailing list