Ich möchte Audio zu meiner ffmpeg-CLI hinzufügen.
ffmpeg -framerate 25 -video_size 1920x1080 -f x11grab -i :0.0 -vf format=yuv420p http://localhost:8080/feed.ffm
BEARBEITEN
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
Und hier ist mit -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
Antwort1
Sie müssen einen Audioeingang bereitstellen. Angenommen, Sie möchten den Desktop-/„Was Sie hören“-/„Stereo-Mix“-Sound, dann ist die einfachste Methode, mit pavucontrol auszuwählen, was Sie aufnehmen möchten, und dannPulseAudio-EingangIn ffmpeg
.
Abonnieren
SehenAufnehmen von Desktop-Audio mit ffmpeg zur Verwendung von pavucontrol.
Oder verwenden Siepactl list sources
Wenn Sie pavucontrol nicht verwenden möchten, listen Sie die Audioquellen mit folgendem auf 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"
Dann renne 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