Skip to content

Instantly share code, notes, and snippets.

@haxpor
Created April 6, 2019 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haxpor/2c462edb00a7f4c971b9b77eb700c6af to your computer and use it in GitHub Desktop.
Save haxpor/2c462edb00a7f4c971b9b77eb700c6af to your computer and use it in GitHub Desktop.
Error log of ffmpeg capting screen video then feed into rtmp target
$ ffmpeg -analyzeduration 0 -video_size 1280x1080 -framerate 25 -re -f x11grab -i :0.0 -c:v libx264 -crf 23 -flags +global_header -preset ultrafast -minrate 7200 -maxrate 8k -vsync 1 -f flv -metadata streamName=ZombieHeroLiveStream rtmp://127.0.0.1/live-video
ffmpeg version 3.4.4-0ubuntu0.18.04.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --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-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --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-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
[x11grab @ 0x558615791aa0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':0.0':
Duration: N/A, start: 1554574508.478983, bitrate: N/A
Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1280x1080, 25 fps, 1000k tbr, 1000k tbn, 1000k tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x55861579c640] VBV maxrate specified, but no bufsize, ignored
[libx264 @ 0x55861579c640] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x55861579c640] profile High 4:4:4 Predictive, level 4.0, 4:4:4 8-bit
[libx264 @ 0x55861579c640] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=6 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
Output #0, flv, to 'rtmp://127.0.0.1/live-video':
Metadata:
streamName : ZombieHeroLiveStream
encoder : Lavf57.83.100
Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv444p, 1280x1080, q=-1--1, 25 fps, 1k tbn, 25 tbc
Metadata:
encoder : Lavc57.107.100 libx264
Side data:
cpb: bitrate max/min/avg: 8000/0/0 buffer size: 0 vbv_delay: -1
More than 1000 frames duplicated 11186kB time=00:00:49.96 bitrate=1834.2kbits/s dup=998 drop=0 speed=0.998x
av_interleaved_write_frame(): Connection reset by peer29.88 bitrate=2021.8kbits/s dup=1791 drop=0 speed=0.998x
Last message repeated 2 times
[flv @ 0x55861579ad20] Failed to update header with correct duration.
[flv @ 0x55861579ad20] Failed to update header with correct filesize.
Error writing trailer of rtmp://127.0.0.1/live-video: Connection reset by peer
frame= 2260 fps= 25 q=16.0 Lsize= 23399kB time=00:01:30.08 bitrate=2127.9kbits/s dup=1795 drop=0 speed=0.998x
video:23358kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.177785%
[libx264 @ 0x55861579c640] frame I:10 Avg QP:11.20 size:790554
[libx264 @ 0x55861579c640] frame P:2250 Avg QP:13.31 size: 7173
[libx264 @ 0x55861579c640] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 @ 0x55861579c640] mb P I16..4: 0.4% 0.0% 0.0% P16..4: 3.9% 0.0% 0.0% 0.0% 0.0% skip:95.7%
[libx264 @ 0x55861579c640] coded y,u,v intra: 38.9% 36.7% 36.4% inter: 1.9% 1.3% 1.3%
[libx264 @ 0x55861579c640] i16 v,h,dc,p: 66% 30% 3% 1%
[libx264 @ 0x55861579c640] kb/s:2127.86
Conversion failed!
@kennykarnama
Copy link

have you found about the root cause ?

@haxpor
Copy link
Author

haxpor commented Nov 17, 2019

@kennykarnama it's quite a while for this problem, I looked back to my archive, you can try the following command which I marked to my archive as successful attempt (record both audio and screen then combine it together to separate target rtmp)

ffmpeg -analyzeduration 0 -thread_queue_size 512 -rtmp_live live -flags +global_header -i "rtmp://127.0.0.1/live-video" -analyzeduration 0 -thread_queue_size 512 -rtmp_live live -flags +global_header -i "rtmp://127.0.0.1/live-audio" -c:v copy -c:a copy -map 0:v -map 1:a -async 1 -vsync 1 -video_size 1280x1080 -fflags +genpts -framerate 30 -preset ultrafast -minrate 7200 -maxrate 8k -flags +global_header -segment_list_flags +live -rtmp_live live -f flv -metadata streamName=ZombieHeroLiveStream "rtmp://127.0.0.1/live"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment