[FFmpeg-user] RTMP publish after live fisheye dewarping stream

Julio Cesar juliocnc.fontoura at gmail.com
Fri Sep 2 20:32:00 EEST 2022

I have an RTSP stream for a 180 fisheye camera in a remote network, and I
would like to get it, make it equirectangular and publish to a RTMP server.
My current script is:
for((;;)); do \
        ffmpeg -loglevel debug -use_wallclock_as_timestamps 1
-rtsp_transport tcp -i rtsp://xxxxxx \
        -vf "v360=fisheye:e:ih_fov=180:iv_fov=180:pitch=90" -c:v libx264
-preset veryfast -profile:v high -an \
        -f flv -flvflags no_duration_filesize rtmp://yyyyyy; \
        sleep 1; \

After some seconds it throws some errors and freezes:

ffmpeg version 5.0.1-1+20.04.sav1 Copyright (c) 2000-2022 the FFmpeg
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: --prefix=/usr --extra-version=1+20.04.sav1
--toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
--incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl
--disable-stripping --enable-gnutls --enable-ladspa --enable-libaom
--enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca
--enable-libcdio --enable-libcodec2 --enable-libflite
--enable-libfontconfig --enable-libfreetype --enable-libfribidi
--enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame
--enable-libmysofa --enable-libopenjpeg --enable-libopenmpt
--enable-libopus --enable-libpulse --enable-librabbitmq
--enable-librubberband --enable-libshine --enable-libsnappy
--enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh
--enable-libtheora --enable-libtwolame --enable-libvidstab
--enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265
--enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi
--enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl
--enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libdav1d
--enable-librist --enable-libvmaf --enable-libzimg --enable-crystalhd
--enable-libmfx --enable-libsvtav1 --enable-libdc1394 --enable-libdrm
--enable-libiec61883 --enable-chromaprint --enable-frei0r
--enable-libplacebo --enable-libx264 --enable-shared
  libavutil      57. 17.100 / 57. 17.100
  libavcodec     59. 18.100 / 59. 18.100
  libavformat    59. 16.100 / 59. 16.100
  libavdevice    59.  4.100 / 59.  4.100
  libavfilter     8. 24.100 /  8. 24.100
  libswscale      6.  4.100 /  6.  4.100
  libswresample   4.  3.100 /  4.  3.100
  libpostproc    56.  3.100 / 56.  3.100
Input #0, rtsp, from 'xxxxxx':
    title           : www rtsp live
    comment         : LIVE555 Streaming Media v2017.01.26
  Duration: N/A, start: 1662139508.709184, bitrate: N/A
  Stream #0:0: Audio: aac (LC), 44100 Hz, mono, fltp
  Stream #0:1: Video: h264 (High), yuvj420p(pc, smpte170m, progressive),
2112x2112, 15 fps, 15 tbr, 90k tbn
Stream mapping:
  Stream #0:1 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x55bacd722a40] using cpu capabilities: MMX2 SSE2Fast SSSE3
[libx264 @ 0x55bacd722a40] profile High, level 5.1, 4:2:0, 8-bit
[libx264 @ 0x55bacd722a40] 264 - core 164 r3094 bfc87b7 - H.264/MPEG-4 AVC
codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options:
cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1
psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1
cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6
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=1 keyint=250 keyint_min=15
scenecut=40 intra_refresh=0 rc_lookahead=10 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://yyyyyy':
    title           : www rtsp live
    comment         : LIVE555 Streaming Media v2017.01.26
    encoder         : Lavf59.16.100
  Stream #0:0: Video: h264 ([7][0][0][0] / 0x0007), yuvj420p(pc, smpte170m,
progressive), 4224x2112, q=2-31, 15 fps, 1k tbn
      encoder         : Lavc59.18.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
[h264 @ 0x55bacd68cfc0] error while decoding MB 84 45, bytestream
-61639.1kbits/s dup=0 drop=1 speed=0.983x
[h264 @ 0x55bacd68cfc0] concealing 11449 DC, 11449 AC, 11449 MV errors in P
rtsp://xxxxxx: corrupt decoded frame in stream 1
[h264 @ 0x55bacd697840] error while decoding MB 55 44, bytestream
-20640.5kbits/s dup=0 drop=1 speed=0.988x
[h264 @ 0x55bacd697840] concealing 11610 DC, 11610 AC, 11610 MV errors in I
[h264 @ 0x55bacd68cfc0] error while decoding MB 39 77, bytestream -14
[h264 @ 0x55bacd68cfc0] concealing 7270 DC, 7270 AC, 7270 MV errors in P
rtsp://xxxxxx: corrupt decoded frame in stream 1=1637.6kbits/s dup=0 drop=1
[h264 @ 0x55bacd83af40] error while decoding MB 83 71, bytestream -6
[h264 @ 0x55bacd83af40] concealing 8018 DC, 8018 AC, 8018 MV errors in P
[rtsp @ 0x55bacd675880] CSeq 6 expected, 0 received.

I have played a lot with the encoding parameters but I can't find one
Camera configuration is 2058x2058 5120kbps 15fps. It has audio in the rtsp
stream but I don't need it, that is why I am using -an.
PC configuration is c5.xlarge AWS (4vCPU 8GB RAM).

More information about the ffmpeg-user mailing list