流式传输/记录桌面、麦克风和系统输出

流式传输/记录桌面、麦克风和系统输出

我尝试传输我的桌面和两个音频:系统输出和麦克风。我使用此命令,但我的系统 (hw:0,0) 的音频在输出文件中听不到...

avconv \
-f alsa -i pulse \
-f alsa -i hw:0,0 \
-f x11grab -r 10 -s 1600x900 -i :0.0 \
-map 0:a -map 1:a -map 2:v \
-acodec libvorbis -ab 160k \
-vcodec libvpx \
-threads 4 -deadline realtime -cpu-used 0 -qmin 2 -qmax 5 \
-y desktop-recording.webm;

如果我运行此命令但没有初始输入,声音就会被正常录制:

avconv \
-f alsa -i hw:0,0 \
-f x11grab -r 10 -s 1600x900 -i :0.0 \
-map 0:a -map 1:v \
-acodec libvorbis -ab 160k \
-vcodec libvpx \
-threads 4 -deadline realtime -cpu-used 0 -qmin 2 -qmax 5 \
-y desktop-recording.webm;

我如何传输/记录所有 3 个输入?

注意:这是命令输出:

gazambuja@linux:~$ avconv -ac 2 -f alsa -i pulse -f alsa -i hw:0,0 -f x11grab -r 10 -s 1600x900 -i :0.0 -map 0:a -map 1:a -map 2:v -acodec libvorbis -ab 160k -vcodec libvpx -threads 4 -deadline realtime -cpu-used 0 -qmin 2 -qmax 5 -y desktop-recording.webm; mplayer desktop-recording.webm 
avconv version 0.8.5-6:0.8.5-0ubuntu0.12.10.1, Copyright (c) 2000-2012 the Libav developers
  built on Jan 24 2013 14:52:53 with gcc 4.7.2
[alsa @ 0x96df900] capture with some ALSA plugins, especially dsnoop, may hang.
[alsa @ 0x96df900] Estimating duration from bitrate, this may be inaccurate
Input #0, alsa, from 'pulse':
  Duration: N/A, start: 1364262041.999468, bitrate: N/A
    Stream #0.0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
[alsa @ 0x96e0320] Estimating duration from bitrate, this may be inaccurate
Input #1, alsa, from 'hw:0,0':
  Duration: N/A, start: 10169.999299, bitrate: N/A
    Stream #1.0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
[x11grab @ 0x96e13e0] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1600 height: 900
[x11grab @ 0x96e13e0] shared memory extension  found
[x11grab @ 0x96e13e0] Estimating duration from bitrate, this may be inaccurate
Input #2, x11grab, from ':0.0':
  Duration: N/A, start: 1364262042.244502, bitrate: 460799 kb/s
    Stream #2.0: Video: rawvideo, bgra, 1600x900, 460799 kb/s, 10 tbr, 1000k tbn, 10 tbc
Incompatible pixel format 'bgra' for codec 'libvpx', auto-selecting format 'yuv420p'
[buffer @ 0x96fbc20] w:1600 h:900 pixfmt:bgra
[avsink @ 0x96e0ec0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
[scale @ 0x96d4460] w:1600 h:900 fmt:bgra -> w:1600 h:900 fmt:yuv420p flags:0x4
[libvpx @ 0x96d46a0] v1.1.0
Output #0, webm, to 'desktop-recording.webm':
  Metadata:
    encoder         : Lavf53.21.1
    Stream #0.0: Audio: libvorbis, 48000 Hz, 2 channels, s16, 160 kb/s
    Stream #0.1: Audio: libvorbis, 48000 Hz, 2 channels, s16, 160 kb/s
    Stream #0.2: Video: libvpx, yuv420p, 1600x900, q=2-5, 200 kb/s, 1k tbn, 10 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le -> libvorbis)
  Stream #1:0 -> #0:1 (pcm_s16le -> libvorbis)
  Stream #2:0 -> #0:2 (rawvideo -> libvpx)

答案1

它正在混合您的音频,但您正在将音频映射到两个单独的流。

Stream #0:0 -> #0:0 (pcm_s16le -> libvorbis)
Stream #1:0 -> #0:1 (pcm_s16le -> libvorbis)

默认情况下,大多数视频播放器会播放文件中的第一个音频和视频流。例如,当您在 VLC 中播放视频时,您可以右键单击Audio -> Audio Track ->,然后选择Audio 1Audio 2

您可以使用合并如果您愿意的话,可以使用过滤器来合并音频吗?

相关内容