我在 Ubuntu 上使用 FFMPEG 录制声音时遇到了一些问题。
ffmpeg -v verbose -f x11grab -y -r 60 -s 1920x1080 -i :0.0 -vcodec mpeg4 -f alsa -i pulse -ar 44100 -acodec libmp3lame -ab 192k -ac 2 output.mp4 -qscale 0
视频播放完美,文件大小较小,但没有声音输出。
答案1
默认设置 ?
在这里,Kubuntu 13.10-ffmpeg 2.1.4
此处的默认值是 PulseAudion 控制:“内置音频模拟立体声”,捕获没有声音。
我需要将 Alsa Capture 更改为内置音频模拟立体声的监视器。这样捕获就有声音了。
演练在这里:
a) 启动 pavucontrol
PulseAudio 音量控制或 pavucontrol 是:
:~$ apt-cache show pavucontrol
Package: pavucontrol
Priority: optional
Section: universe/sound
...
Description: PulseAudio Volume Control
PulseAudio, previously known as Polypaudio, is a sound server for POSIX and
WIN32 systems. It is a drop in replacement for the ESD sound server with
much better latency, mixing/re-sampling quality and overall architecture.
.
PulseAudio Volume Control (pavucontrol) is a simple GTK+ based volume
control tool (mixer) for the PulseAudio sound server. In contrast to
classic mixer tools this one allows you to control both the volume of
hardware devices and of each playback stream separately. It also allows
you to redirect a playback stream to another output device without
interrupting playback.
Homepage: http://0pointer.de/lennart/projects/pavucontrol/
b)启动ffmpeg脚本
c)选择声源
此处 pavucontrol 有选项:
答案2
希望对你有帮助
ffmpeg -f video4linux2 -i /dev/video0 -acodec libmp3lame -t 20 output.mp4
您可以设置录音时间限制。
喜欢-t hh:mm::ss
答案3
经过这些帖子的五年,楼主的下面命令仍然在我的 Ubuntu 18.04 上运行
ffmpeg -v verbose -f x11grab -y -r 60 -i :0.0 -vcodec mpeg4 -f alsa -i pulse -ar 44100 -acodec libmp3lame -ab 192k -ac 2 output.mp4 -qscale
我将开始用它来录制我的屏幕,谢谢!