I found many answers on the subject, but no one works for me. Would you give me directions or working examples of how it works. It may be useful to other people in future
Asked
Active
Viewed 7,772 times
1
-
Have you tried this ? https://gist.github.com/laurenarcher/4644aacef51e734d33d5 – Liso Mar 16 '17 at 00:58
-
Yes but this is for webcam stream. I search for desktop – Георги Няголов Mar 16 '17 at 01:13
-
Oh sorry, didn't notice that. – Liso Mar 16 '17 at 01:16
1 Answers
3
1. Choose audio
You can use pavucontrol to choose which audio source ffmpeg
will record, such as "desktop" or microphone. This is explained in Capturing ONLY desktop audio with ffmpeg
.
2. Encode
Now use ffmpeg
to stream to YouTube:
ffmpeg -f x11grab -framerate 30 -video_size 1280x720 -i :0.0 -f pulse -i default -c:v libx264 -preset fast -cfr 26 -maxrate 2500k -bufsize 5000k -g 60 -vf format=yuv420p -c:a aac -b:a 128k -f flv rtmp://youtube
If your
ffmpeg
doesn't have--enable-libpulse
, and therefore no pulse input device, you can try replacing-f pulse -i default
with-f alsa -i pulse
to use the ALSA input device instead.Don't just copy and paste the example: you'll need to choose an appropriate
-maxrate
and-bufsize
. See FFmpeg Wiki: Encoding for Streaming Sites for more info.