Open ScottRFrost opened 6 years ago
Have not tried but will give it a shot.
FFmpeg's site made it look like you just had to pass a specific command line to FFmpeg https://trac.ffmpeg.org/wiki/StreamingGuide , but I don't know how difficult this would be to work into what you already have in Captura.
Once you log in to twitch, you go to https://www.twitch.tv/{your_username_here}/dashboard/settings/streamkey and get a streaming key that stars with "live_" that you then append to your URL. Presumably you could just prompt users on how to get this key and save it for use every time they stream.
So your command line would include: -f flv "rtmp://live.twitch.tv/app/{streaming_key_here}"
I followed the guides and tried streaming to both Twitch and YouTube Live.
Maybe the problem is that my internet connection is not fast enough. Will try some more workarounds.
It's not unusual to have some latency on Twitch. As you linked to in your encoding guide, make sure you use -crf when encoding for streaming.
I found this .sh script in a gist for YouTube Live streaming via FFMPEG, hopefully it's helpful: https://gist.github.com/olasd/9841772
I have tried that script already. Yes, I'm using the -crf
option.
I'll test on a better internet connection in a few days and let you know.
Throw up a build and I'll help you test
https://ci.appveyor.com/api/buildjobs/0cp18jiabrb2v04r/artifacts/temp%2FCaptura-Portable.zip
Go to Configure > FFMpeg
and set up Twitch and YouTube Live keys.
Select Streaming
as video writer type and select Twitch or YouTube Live.
Thank You
I'm able to reproduce both of your results.
Twitch.tv works with 9-10 second latency (which is similar to what I get on OBS or Geforce Experience) streaming.
Youtube Live says "Starting" for status, but apparently never receives data because even after 1 minute of streaming nothing ever appears. I tried a few different options like "-i 0.0" and "-strict experimental" in arguments but wasn't able to get it to work no matter what I tried.
To debug things I tried setting to a local rtmp address, i.e. rtmp://127.0.0.1:8090. However, ffmpeg crashes right around 6 seconds into the recording with the following error (this is with captura 9.0.0 beta):
ARGS:
-------------
-thread_queue_size 512 -framerate 20 -f rawvideo -pix_fmt nv12 -video_size 2560x1440 -i \\.\pipe\captura-95b0d585-c58c-4f29-be04-cf3790ba6f18 -r 20 -vcodec libx264 -crf 15 -pix_fmt yuv420p -preset ultrafast -g 40 -r 20 -f flv rtmp://127.0.0.1:8090/stream
OUTPUT:
-------------
ffmpeg version git-2020-03-30-8d019db Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200328
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 42.102 / 56. 42.102
libavcodec 58. 77.101 / 58. 77.101
libavformat 58. 42.100 / 58. 42.100
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 77.101 / 7. 77.101
libswscale 5. 6.101 / 5. 6.101
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
Input #0, rawvideo, from '\\.\pipe\captura-95b0d585-c58c-4f29-be04-cf3790ba6f18':
Duration: N/A, start: 0.000000, bitrate: 884736 kb/s
Stream #0:0: Video: rawvideo (NV12 / 0x3231564E), nv12, 2560x1440, 884736 kb/s, 20 tbr, 20 tbn, 20 tbc
Multiple -r options specified for stream 0, only the last option '-r 20' will be used.
[tcp @ 00000113feda1240] Connection to tcp://127.0.0.1:8090 failed: Error number -138 occurred
[rtmp @ 00000113feda0d00] Cannot open connection tcp://127.0.0.1:8090
rtmp://127.0.0.1:8090/stream: Unknown error
I'm not sure if anything is streamed at all. I'm investigating whether it's just a bad set of ffmpeg args. But conceptually this is all happening on the ffmpeg side, and the only change is the change in destination (from a local file to a rtmp address), so I'm a bit confused as to why it crashes.
@ericjang How are you creating the RTMP server at rtmp://127.0.0.1:8090? Are you using FFserver?
This app is SO much easier to use than OBS for recording from the screen.
Is there any way you'd consider adding Twitch / YouTube Live / LiveStream / etc support for real time streaming?