How to fix Sound on ffmpeg x11grab capture screen

Published by: Emil // Date 6.3.2018 // Views: 1207 // Add to Twitter :: Facebook

Image
After 3 hours I found finally what kind of Sound Problem I had on my Ubuntu Gnome. I read and read a lot of topics from stackoverflow and other private blogs and tried to fix x11grab sound problem. Some post are recommending parameters as "-f alsa -i pulse", other that is other way "-f pulse -ac 2". At the end was just the wrong source selected in pulseaudio manager named as "pavucontrol".


After I installed the pavucontrol, I start Sound Card Configurator from Terminal, chosed "Analog Stereo" and voila, Worked!




# So how I did it?
# I installed first the sound manager:
sudo apt-get install pavucontrol

# I start the manager in Terminal typing:
pavucontrol

# I clicked on last tab, number 5 and selected "Analog Stereo"
# I finally made a capture test like:

ffmpeg -f x11grab -framerate 30 -video_size 1900x1080 -i :0.0 -f alsa -i pulse \
-c:v libx264 -preset fast -crf 26 -maxrate 1500k -bufsize 500k -g 30 \
-vf format=yuv420p -c:a aac -b:a 64k -f flv outut.mkv