ffmpeg 流式传输到 Steam,错误和反馈

ffmpeg 流式传输到 Steam,错误和反馈

我正在使用以下命令流式传输 30fps 视频的连续播放列表:

ffmpeg -re -f concat -safe 0 -i ~/myplaylist.txt -c:v libx264 -preset veryfast -b:v 6000k -maxrate 6000k -bufsize 2M -g 60 -c:a aac -b:a 160k -ac 2 -ar 44100 -f flv rtmp://myhost/my_streamkey

当我在 Twitch 上直播时,它运行完美。当我在 Steam 上直播时,它经常崩溃,而且似乎主要是在从一个视频切换到下一个视频时(尽管有时只是在视频中间)。

Steam 广播页面的反馈是:

确保上传关键帧间隔设置为 2 秒并使用恒定比特率 (CBR)。将编码器图片组 (GOP) 限制为帧速率的最多两倍。

命令行的输出是:

$ ffmpeg -re -f concat -safe 0 -i ~/myplaylist.txt -c:v libx264 -preset veryfast -b:v 6000k -maxrate 6000k -bufsize 2M -g 60 -c:a aac -b:a 160k -ac 2 -ar 44100 -f flv rtmp://myhost/my_streamkey
ffmpeg version 4.3.1-0york0~18.04 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/usr --extra-version='0york0~18.04' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --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-librsvg --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-libwavpack --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-libzimg --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x563ff0161040] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from '/path/to/myplaylist.txt':
  Duration: N/A, start: 0.000000, bitrate: 7699 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 7510 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
    Metadata:
      creation_time   : 2020-11-12T14:10:16.000000Z
      handler_name    : ?Mainconcept Video Media Handler
      encoder         : AVC Coding
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s
    Metadata:
      creation_time   : 2020-11-12T14:10:16.000000Z
      handler_name    : #Mainconcept MP4 Sound Media Handler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x563ff03792c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512
[libx264 @ 0x563ff03792c0] profile High, level 4.0
[libx264 @ 0x563ff03792c0] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - 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=12 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=1 keyint=60 keyint_min=6 scenecut=40 intra_refresh=0 rc_lookahead=10 rc=abr mbtree=1 bitrate=4500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=6000 vbv_bufsize=2000 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
Output #0, flv, to 'rtmp://myhost/my_streamkey':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #0:0(eng): Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p(progressive), 1920x1080, q=-1--1, 4500 kb/s, 29.97 fps, 1k tbn, 29.97 tbc
    Metadata:
      creation_time   : 2020-11-12T14:10:16.000000Z
      handler_name    : ?Mainconcept Video Media Handler
      encoder         : Lavc58.91.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 6000000/0/4500000 buffer size: 2000000 vbv_delay: N/A
    Stream #0:1(eng): Audio: aac (LC) ([10][0][0][0] / 0x000A), 44100 Hz, stereo, fltp, 160 kb/s
    Metadata:
      creation_time   : 2020-11-12T14:10:16.000000Z
      handler_name    : #Mainconcept MP4 Sound Media Handler
      encoder         : Lavc58.91.100 aac
av_interleaved_write_frame(): Connection reset by peer00.90 bitrate=4382.7kbits/s speed=0.999x
    Last message repeated 1 times
[flv @ 0x563ff01925c0] Failed to update header with correct duration.
[flv @ 0x563ff01925c0] Failed to update header with correct filesize.
Error writing trailer of rtmp://myhost/my_streamkey: Connection reset by peer
frame= 9019 fps= 30 q=23.0 Lsize=  161053kB time=00:05:00.93 bitrate=4384.2kbits/s speed=0.999x

video:155757kB audio:4964kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.205955%
[libx264 @ 0x563ff03792c0] frame I:265   Avg QP:18.20  size: 93130
[libx264 @ 0x563ff03792c0] frame P:3327  Avg QP:22.66  size: 29256
[libx264 @ 0x563ff03792c0] frame B:5427  Avg QP:22.91  size:  6949
[libx264 @ 0x563ff03792c0] consecutive B-frames: 16.7%  7.1%  6.2% 70.0%
[libx264 @ 0x563ff03792c0] mb I  I16..4: 42.2% 31.5% 26.3%
[libx264 @ 0x563ff03792c0] mb P  I16..4: 16.5% 20.0%  2.9%  P16..4: 17.7%  5.5%  2.2%  0.0%  0.0%    skip:35.2%
[libx264 @ 0x563ff03792c0] mb B  I16..4:  2.3%  2.6%  0.1%  B16..8: 12.3%  2.7%  0.2%  direct: 5.4%  skip:74.3%  L0:43.2% L1:48.0% BI: 8.8%
[libx264 @ 0x563ff03792c0] 8x8 transform intra:48.1% inter:20.7%
[libx264 @ 0x563ff03792c0] coded y,uvDC,uvAC intra: 37.1% 40.0% 12.4% inter: 5.0% 8.9% 0.3%
[libx264 @ 0x563ff03792c0] i16 v,h,dc,p: 45% 26% 16% 13%
[libx264 @ 0x563ff03792c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 29% 24%  4%  3%  3%  4%  3%  4%
[libx264 @ 0x563ff03792c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 24% 16%  6%  6%  6%  6%  5%  5%
[libx264 @ 0x563ff03792c0] i8c dc,h,v,p: 55% 21% 19%  5%
[libx264 @ 0x563ff03792c0] Weighted P-Frames: Y:2.8% UV:1.3%
[libx264 @ 0x563ff03792c0] kb/s:4246.17
[aac @ 0x563ff0193640] Qavg: 11175.629
Conversion failed!

我一直在研究文档,我确信文档或输出中有一些明显的答案,但我的视频/流媒体知识非常基础。

非常感谢您的帮助

相关内容