1

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

1 Answers1

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.

llogan
  • 11,868