dbermond / screencast

Interface to record a X11 desktop
GNU General Public License v2.0
115 stars 9 forks source link

pulseaudio device name #7

Open elig0n opened 4 years ago

elig0n commented 4 years ago

I have both arecord and pactl installed. I'm using pulseaudio. pactl list sources gives a lot of data that I'm not sure what the name for -i should be like. Long name like alsa_output.pci-000_00_00.1.hdmi- stereo.monitor do not work, neither 0, 1, pulse-0 or pulse:0. pulse alone is accepted but then no audio is recorded. ffmpeg -f x11grab and -f pulse -i 1 records audio almost alright (last second or so is cut). How to specify pulseaudio device then ?

arecord -l output:

List of CAPTURE Hardware Devices card 1: Generic [HD-Audio Generic], device 0: ALC887-VD Analog [ALC887-VD Analog] Subdevices: 0/1 Subdevice #0: subdevice #0 card 1: Generic [HD-Audio Generic], device 2: ALC887-VD Alt Analog [ALC887-VD Alt Analog] Subdevices: 1/1 Subdevice #0: subdevice #0

dbermond commented 4 years ago

How to specify pulseaudio device then ?

In short:

Does your ffmpeg has support for alsa demuxer (for example, does your ffmpeg is compiled with --enable-alsa?). If yes, specifying a pulseaudio input source with the -i option is currently not supported. If no, you can specify the long name for the pulseaudio input source.

The long story:

The goal of the -i option is to specify an alsa input device name, and not a pulseaudio one, as stated on the Readme:

-i, --audio-input=NAME
ALSA audio input device name.

The -i option is only used to specify a pulseaudio input source if your ffmpeg has no support for alsa demuxer (for example, if your ffmpeg is compiled without --enable-alsa). If your ffmpeg has no alsa demuxer support, screencast will detect this and will automatically try to use pulseaudio as a fallback interface if it's available on your ffmpeg.

If your ffmpeg has support for alsa demuxer, the best you can currently do in this case is to configure/set the default pulseaudio input source elsewhere and use the special value pulse with -i to try to record from the default pulseaudio input source.

In my experience, alsa in ffmpeg seems to work much better and to cause less problems than pulseaudio (as yourself described when using -f pulse in ffmpeg).

elig0n commented 4 years ago

If no, you can specify the long name for the pulseaudio input source.

$ ffmpeg |& grep alsa
$ pactl list sources
Source #0
[...]
Name: alsa_output.pci-0000_08_00.1.hdmi-stereo.monitor
[...]
$ screencast -i alsa_output.pci-0000_08_00.1.hdmi-stereo.monitor  -v vp9 -d :1.0 test.mp4
[...]
[ screencast ] error: 'alsa_output.pci-0000_08_00.1.hdmi-stereo.monitor' is not a valid ALSA input device name on this system
dbermond commented 4 years ago

screencast is detecting that your ffmpeg has alsa support, since it's not using the pulseaudio fallback interface.

Can you please post the output of ffmpeg -formats -v quiet | grep -E 'alsa|ALSA'? This will tell if your ffmpeg has support for alsa, as the alsa option at ffmpeg build time is autodetected.

Also, the log shows that your using an output source as input.