I am streaming a concat playlist of 30fps videos using the following:

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 

When I stream this to Twitch, it works flawlessly. When I stream to Steam, it crashes frequently and seemingly mostly when changing from one video to the next (though sometimes just in the middle of a video).

The feedback from the Steam broadcast page says:

Make sure your upload key-frame interval is set to 2 seconds and use constant bitrate (CBR). Limit your encoders group of picture (GOP) to at most two times your framerate.

The output from command line is:

$ 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 - - 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! 

I've been working my way through the docs and I'm sure there's some obvious answer in the docs or in the output, but my video/streaming knowledge is pretty basic.

Any help very much appreciated 🙏

UPDATE: Info from each input in playlist.txt...

 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42mp41 creation_time : 2020-11-10T10:36:22.000000Z Duration: 02:07:02.93, start: 0.000000, bitrate: 5304 kb/s Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 5110 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc (default) Metadata: creation_time : 2020-11-10T10:36:22.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 (default) Metadata: creation_time : 2020-11-10T10:36:22.000000Z handler_name : #Mainconcept MP4 Sound Media Handler Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '2.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42mp41 creation_time : 2020-11-10T11:03:14.000000Z Duration: 02:11:03.21, start: 0.000000, bitrate: 7017 kb/s Stream #1:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 6823 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc (default) Metadata: creation_time : 2020-11-10T11:03:14.000000Z handler_name : ?Mainconcept Video Media Handler encoder : AVC Coding Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default) Metadata: creation_time : 2020-11-10T11:03:15.000000Z handler_name : #Mainconcept MP4 Sound Media Handler Input #2, mov,mp4,m4a,3gp,3g2,mj2, from '3.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42mp41 creation_time : 2020-11-10T11:33:40.000000Z Duration: 02:09:47.01, start: 0.000000, bitrate: 5979 kb/s Stream #2:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 5785 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc (default) Metadata: creation_time : 2020-11-10T11:33:40.000000Z handler_name : ?Mainconcept Video Media Handler encoder : AVC Coding Stream #2:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default) Metadata: creation_time : 2020-11-10T11:33:40.000000Z handler_name : #Mainconcept MP4 Sound Media Handler 
3

Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy