Quiero agregar audio a mi ffmpeg cli a continuación
ffmpeg -framerate 25 -video_size 1920x1080 -f x11grab -i :0.0 -vf format=yuv420p http://localhost:8080/feed.ffm
EDITAR
arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC883 Analog [ALC883 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 2: ALC883 Alt Analog [ALC883 Alt Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
Y aquí está con -L
arecord -L
default
Playback/recording through the PulseAudio sound server
null
Discard all samples (playback) or generate zero samples (capture)
pulse
PulseAudio Sound Server
sysdefault:CARD=Intel
HDA Intel, ALC883 Analog
Default Audio Device
front:CARD=Intel,DEV=0
HDA Intel, ALC883 Analog
Front speakers
dmix:CARD=Intel,DEV=0
HDA Intel, ALC883 Analog
Direct sample mixing device
dmix:CARD=Intel,DEV=2
HDA Intel, ALC883 Alt Analog
Direct sample mixing device
dsnoop:CARD=Intel,DEV=0
HDA Intel, ALC883 Analog
Direct sample snooping device
dsnoop:CARD=Intel,DEV=2
HDA Intel, ALC883 Alt Analog
Direct sample snooping device
hw:CARD=Intel,DEV=0
HDA Intel, ALC883 Analog
Direct hardware device without any conversions
hw:CARD=Intel,DEV=2
HDA Intel, ALC883 Alt Analog
Direct hardware device without any conversions
plughw:CARD=Intel,DEV=0
HDA Intel, ALC883 Analog
Hardware device with all software conversions
plughw:CARD=Intel,DEV=2
HDA Intel, ALC883 Alt Analog
Hardware device with all software conversions
Respuesta1
Tienes que proporcionar una entrada de audio. Suponiendo que desea que suene el escritorio/"lo que escucha"/"mezcla estéreo", el método más sencillo es usar pavucontrol para seleccionar lo que desea grabar, luego usarEntrada PulseAudioen ffmpeg
.
pavucontrol
VerCapturando audio de escritorio con ffmpeg para usar pavucontrol.
O usarpactl list sources
Si no desea utilizar pavucontrol, enumere las fuentes de audio con pactl list sources
:
$ pactl list sources | grep monitor
Name: alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1.monitor
device.class = "monitor"
Name: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
device.class = "monitor"
Entonces corre ffmpeg
:
ffmpeg -framerate 25 -video_size 1920x1080 -f x11grab -i :0.0 -f pulse -i alsa_output.pci-0000_00_1b.0.analog-stereo.monitor -c:v libx264 -c:a aac -vf format=yuv420p http://localhost:8080/feed.ffm