<p>You need to map all streams, so</p>

<pre><code>ffmpeg -video_size 1920x1080 -framerate 60
-f x11grab -i :0.0
-f pulse -i default
-f openal -i "Monitor of Headset H390 Analog Stereo"
-map 0 -map 1 -map 2
-c:v libx264rgb -crf 0 -preset ultrafast video.mkv
</code></pre>

<p>See <a href="http://ffmpeg.org/ffmpeg.html#Stream-selection" rel="nofollow noreferrer">http://ffmpeg.org/ffmpeg.html#Stream-selection</a> for how ffmpeg automatically selects streams when map is absent.</p>

CC BY-SA 4.0
2020-05-14T19:23:05.017Z
The same problem still happens.
LostXOR
CC BY-SA 4.0
2020-05-15T06:32:01.510Z
Share full log.
Gyan
CC BY-SA 4.0
2020-05-15T16:11:09.500Z
The video now has two separate audio tracks, but one is completely silent. The other one is the first source in the command.
LostXOR
CC BY-SA 4.0
2020-05-15T16:56:07.607Z
Share full log.
Gyan
CC BY-SA 4.0
2020-05-17T13:56:08.073Z
What do you mean by a "full log"? `ffmpeg` doesn't output a log as far as I know.
LostXOR
CC BY-SA 4.0
2020-05-17T15:04:51.283Z
The log refers to the stderr console output generated by ffmpeg. You can also add -report to save it to file.
Gyan
CC BY-SA 4.0
2020-05-17T22:26:20.387Z
Apparently it works now... That's strange.
LostXOR
CC BY-SA 4.0
2020-05-14T07:16:58.930Z
2020-05-14T07:16:58.930Z
Gyan
<p>I wrote a script to record my computer screen, my computer audio (The audio coming out of my speakers), and my microphone using <code>ffmpeg</code>:</p>

<pre><code>ffmpeg -video_size 1920x1080 -framerate 60
-f x11grab -i :0.0
-f pulse -i default
-f openal -i "Monitor of Headset H390 Analog Stereo" \
-c:v libx264rgb -crf 0 -preset ultrafast video.mkv
</code></pre>

<p>It records the video correctly, but not the audio. Only the first audio source (my microphone) is recorded. If I swap the order of <code>-f pulse -i default</code> and <code>-f openal -i "Monitor of Headset H390 Analog Stereo"</code>, only my computer audio is recorded. How can I record my computer audio and my microphone at the same time? (Preferrably to different tracks so I can change the volume individually while editing.)</p>

<p>My operating system is Linux Mint 5.3.0-51.</p>

<p><code>ffmpeg</code> log:</p>

<pre><code>ffmpeg started on 2020-05-17 at 17:07:47
Report written to "ffmpeg-20200517-170747.log"
Command line:
ffmpeg -video_size 1920x1080 -framerate 60 -f x11grab -i :0.0 -f openal -i "Monitor of Headset H390 Analog Stereo" -f pulse -i default -map 0 -map 1 -map 2 -report -c:v libx264rgb -crf 0 -preset ultrafast [FILE PATH]/clips/clip_7.mkv
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Splitting the commandline.
Reading option '-video_size' ... matched as AVOption 'video_size' with argument '1920x1080'.
Reading option '-framerate' ... matched as AVOption 'framerate' with argument '60'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'x11grab'.
Reading option '-i' ... matched as input url with argument ':0.0'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'openal'.
Reading option '-i' ... matched as input url with argument 'Monitor of Headset H390 Analog Stereo'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'pulse'.
Reading option '-i' ... matched as input url with argument 'default'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '1'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '2'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'libx264rgb'.
Reading option '-crf' ... matched as AVOption 'crf' with argument '0'.
Reading option '-preset' ... matched as AVOption 'preset' with argument 'ultrafast'.
Reading option '[FILE PATH]/clips/clip_7.mkv' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url :0.0.
Applying option f (force format) with argument x11grab.
Successfully parsed a group of options.
Opening an input file: :0.0.
[x11grab @ 0x55b2144705e0] Probe buffer size limit of 5000000 bytes reached
[x11grab @ 0x55b2144705e0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':0.0':
  Duration: N/A, start: 1589753267.078638, bitrate: N/A
    Stream #0:0, 1, 1/1000000: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1920x1080, 60 fps, 1000k tbr, 1000k tbn, 1000k tbc
Successfully opened the file.
Parsing a group of options: input url Monitor of Headset H390 Analog Stereo.
Applying option f (force format) with argument openal.
Successfully parsed a group of options.
Opening an input file: Monitor of Headset H390 Analog Stereo.
[openal @ 0x55b2144799a0] All info found
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, openal, from 'Monitor of Headset H390 Analog Stereo':
  Duration: N/A, start: 1589753267.137538, bitrate: 1411 kb/s
    Stream #1:0, 1, 1/1000000: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Successfully opened the file.
Parsing a group of options: input url default.
Applying option f (force format) with argument pulse.
Successfully parsed a group of options.
Opening an input file: default.
[pulse @ 0x55b21448eca0] All info found
Guessed Channel Layout for Input Stream #2.0 : stereo
Input #2, pulse, from 'default':
  Duration: N/A, start: 1589753267.142149, bitrate: 1536 kb/s
    Stream #2:0, 1, 1/1000000: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Successfully opened the file.
Parsing a group of options: output url [FILE PATH]/clips/clip_7.mkv.
Applying option map (set input stream mapping) with argument 0.
Applying option map (set input stream mapping) with argument 1.
Applying option map (set input stream mapping) with argument 2.
Applying option c:v (codec name) with argument libx264rgb.
Successfully parsed a group of options.
Opening an output file: [FILE PATH]/clips/clip_7.mkv.
[file @ 0x55b2144af2c0] Setting default whitelist 'file,crypto'
Successfully opened the file.
Stream mapping:
  Stream #0:0 -&gt; #0:0 (rawvideo (native) -&gt; h264 (libx264rgb))
  Stream #1:0 -&gt; #0:1 (pcm_s16le (native) -&gt; vorbis (libvorbis))
  Stream #2:0 -&gt; #0:2 (pcm_s16le (native) -&gt; vorbis (libvorbis))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
detected 4 logical cores
[graph 0 input from stream 0:0 @ 0x55b2144b49c0] Setting 'video_size' to value '1920x1080'
[graph 0 input from stream 0:0 @ 0x55b2144b49c0] Setting 'pix_fmt' to value '298'
[graph 0 input from stream 0:0 @ 0x55b2144b49c0] Setting 'time_base' to value '1/1000000'
[graph 0 input from stream 0:0 @ 0x55b2144b49c0] Setting 'pixel_aspect' to value '0/1'
[graph 0 input from stream 0:0 @ 0x55b2144b49c0] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0x55b2144b49c0] Setting 'frame_rate' to value '60/1'
[graph 0 input from stream 0:0 @ 0x55b2144b49c0] w:1440 h:900 pixfmt:bgr0 tb:1/1000000 fr:60/1 sar:0/1 sws_param:flags=2
[format @ 0x55b2144b3500] compat: called with args=[bgr0|bgr24|rgb24]
[format @ 0x55b2144b3500] Setting 'pix_fmts' to value 'bgr0|bgr24|rgb24'
[AVFilterGraph @ 0x55b2144b37c0] query_formats: 4 queried, 3 merged, 0 already done, 0 delayed
[libx264rgb @ 0x55b2144a9660] using mv_range_thread = 72
[libx264rgb @ 0x55b2144a9660] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264rgb @ 0x55b2144a9660] profile High 4:4:4 Predictive, level 4.2, 4:4:4 8-bit
[libx264rgb @ 0x55b2144a9660] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=0 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=0
Clipping frame in rate conversion by 0.000008
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[graph_1_in_1_0 @ 0x55b2145a0ae0] Setting 'time_base' to value '1/44100'
[graph_1_in_1_0 @ 0x55b2145a0ae0] Setting 'sample_rate' to value '44100'
[graph_1_in_1_0 @ 0x55b2145a0ae0] Setting 'sample_fmt' to value 's16'
[graph_1_in_1_0 @ 0x55b2145a0ae0] Setting 'channel_layout' to value '0x3'
[graph_1_in_1_0 @ 0x55b2145a0ae0] tb:1/44100 samplefmt:s16 samplerate:44100 chlayout:0x3
[format_out_0_1 @ 0x55b2145a0e60] Setting 'sample_fmts' to value 'fltp'
[format_out_0_1 @ 0x55b2145a0e60] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_1'
[AVFilterGraph @ 0x55b21459fc00] query_formats: 4 queried, 6 merged, 3 already done, 0 delayed
[auto_resampler_0 @ 0x55b2145a3120] [SWR @ 0x55b2145a34c0] Using s16p internally between filters
[auto_resampler_0 @ 0x55b2145a3120] ch:2 chl:stereo fmt:s16 r:44100Hz -&gt; ch:2 chl:stereo fmt:fltp r:44100Hz
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[graph_2_in_2_0 @ 0x55b214624420] Setting 'time_base' to value '1/48000'
[graph_2_in_2_0 @ 0x55b214624420] Setting 'sample_rate' to value '48000'
[graph_2_in_2_0 @ 0x55b214624420] Setting 'sample_fmt' to value 's16'
[graph_2_in_2_0 @ 0x55b214624420] Setting 'channel_layout' to value '0x3'
[graph_2_in_2_0 @ 0x55b214624420] tb:1/48000 samplefmt:s16 samplerate:48000 chlayout:0x3
[format_out_0_2 @ 0x55b214608180] Setting 'sample_fmts' to value 'fltp'
[format_out_0_2 @ 0x55b214608180] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_2'
[AVFilterGraph @ 0x55b214633380] query_formats: 4 queried, 6 merged, 3 already done, 0 delayed
[auto_resampler_0 @ 0x55b214605300] [SWR @ 0x55b21464fd20] Using s16p internally between filters
[auto_resampler_0 @ 0x55b214605300] ch:2 chl:stereo fmt:s16 r:48000Hz -&gt; ch:2 chl:stereo fmt:fltp r:48000Hz
Output #0, matroska, to '[FILE PATH]/clips/clip_7.mkv':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0, 0, 1/1000: Video: h264 (libx264rgb) (H264 / 0x34363248), bgr0(progressive), 1920x1080, q=-1--1, 60 fps, 1k tbn, 60 tbc
    Metadata:
      encoder         : Lavc57.107.100 libx264rgb
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1, 0, 1/1000: Audio: vorbis (libvorbis) (oV[0][0] / 0x566F), 44100 Hz, stereo, fltp
    Metadata:
      encoder         : Lavc57.107.100 libvorbis
    Stream #0:2, 0, 1/1000: Audio: vorbis (libvorbis) (oV[0][0] / 0x566F), 48000 Hz, stereo, fltp
    Metadata:
      encoder         : Lavc57.107.100 libvorbis
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
[x11grab @ 0x55b2144705e0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
Past duration 0.835838 too large
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
*** dropping frame 4 from stream 0 at ts 82
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
*** dropping frame 5 from stream 0 at ts 83
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
*** dropping frame 5 from stream 0 at ts 83
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
Clipping frame in rate conversion by 0.550987
*** dropping frame 6 from stream 0 at ts 84
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
[libx264rgb @ 0x55b2144a9660] frame=   0 QP=0.00 NAL=3 Slice:I Poc:0   I:5130 P:0    SKIP:0    size=381047 bytes
[matroska @ 0x55b2144a7b60] get_metadata_duration returned: 0
[matroska @ 0x55b2144a7b60] Writing block at offset 9, size 1, pts 0, dts 0, duration 3, keyframe 1
[matroska @ 0x55b2144a7b60] Writing block at offset 16, size 43, pts 0, dts 0, duration 3, keyframe 1
[matroska @ 0x55b2144a7b60] Writing block at offset 65, size 381569, pts 3, dts 3, duration 17, keyframe 1
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
Past duration 0.748894 too large
*** dropping frame 8 from stream 0 at ts 86
[libx264rgb @ 0x55b2144a9660] frame=   1 QP=0.00 NAL=2 Slice:P Poc:2   I:2951 P:292  SKIP:1887 size=88367 bytes
[matroska @ 0x55b2144a7b60] Writing block at offset 381643, size 1, pts 3, dts 3, duration 13, keyframe 1
[matroska @ 0x55b2144a7b60] Writing block at offset 381650, size 198, pts 3, dts 3, duration 12, keyframe 1
[matroska @ 0x55b2144a7b60] Writing block at offset 381855, size 190, pts 15, dts 15, duration 21, keyframe 1
[matroska @ 0x55b2144a7b60] Writing block at offset 382052, size 1, pts 16, dts 16, duration 23, keyframe 1
[matroska @ 0x55b2144a7b60] Writing block at offset 382059, size 192, pts 36, dts 36, duration 21, keyframe 1
[Repeated a lot of times]
[matroska @ 0x55b2144a7b60] Writing block at offset 171, size 1, pts 5517, dts 5517, duration 23, keyframe 1
[matroska @ 0x55b2144a7b60] Writing block at offset 178, size 1, pts 5540, dts 5540, duration 23, keyframe 1
[matroska @ 0x55b2144a7b60] Writing block at offset 185, size 1, pts 5564, dts 5564, duration 23, keyframe 1
[matroska @ 0x55b2144a7b60] Writing block at offset 192, size 1, pts 5587, dts 5587, duration 6, keyframe 1
[matroska @ 0x55b2144a7b60] end duration = 5593
[matroska @ 0x55b2144a7b60] stream 0 end duration = 4787
[matroska @ 0x55b2144a7b60] stream 1 end duration = 5593
[matroska @ 0x55b2144a7b60] stream 2 end duration = 4567
frame=   41 fps=9.5 q=-1.0 Lsize=    1760kB time=00:00:05.58 bitrate=2581.4kbits/s dup=0 drop=105 speed=1.29x    
video:1707kB audio:41kB subtitle:0kB other streams:0kB global headers:8kB muxing overhead: 0.677361%
Input file #0 (:0.0):
  Input stream #0:0 (video): 146 packets read (756864000 bytes); 146 frames decoded; 
  Total: 146 packets (756864000 bytes) demuxed
Input file #1 (Monitor of Headset H390 Analog Stereo):
  Input stream #1:0 (audio): 22 packets read (773588 bytes); 22 frames decoded (193397 samples); 
  Total: 22 packets (773588 bytes) demuxed
Input file #2 (default):
  Input stream #2:0 (audio): 20 packets read (876288 bytes); 20 frames decoded (219072 samples); 
  Total: 20 packets (876288 bytes) demuxed
Output file #0 ([FILE PATH]/clips/clip_7.mkv):
  Output stream #0:0 (video): 41 frames encoded; 41 packets muxed (1747992 bytes); 
  Output stream #0:1 (audio): 3021 frames encoded (193344 samples); 191 packets muxed (191 bytes); 
  Output stream #0:2 (audio): 3423 frames encoded (219072 samples); 223 packets muxed (41851 bytes); 
  Total: 455 packets (1790034 bytes) muxed
188 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x55b2144af5a0] Statistics: 16 seeks, 18 writeouts
[libx264rgb @ 0x55b2144a9660] frame I:1     Avg QP: 0.00  size:381047
[libx264rgb @ 0x55b2144a9660] frame P:40    Avg QP: 0.00  size: 34161
[libx264rgb @ 0x55b2144a9660] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264rgb @ 0x55b2144a9660] mb P  I16..4: 50.9%  0.0%  0.0%  P16..4:  1.5%  0.0%  0.0%  0.0%  0.0%    skip:47.6%
[libx264rgb @ 0x55b2144a9660] coded y,u,v intra: 4.3% 1.1% 2.3% inter: 2.1% 0.3% 1.0%
[libx264rgb @ 0x55b2144a9660] i16 v,h,dc,p: 98%  2%  0%  0%
[libx264rgb @ 0x55b2144a9660] kb/s:2922.60
Exiting normally, received signal 2.
</code></pre>

<ffmpeg><audio-recording><tracks>
Record two audio sources as separate tracks?
LostXOR
# Record two audio sources as separate tracks?

(Asked by: username_0 on 2020-05-13)

I wrote a script to record my computer screen, my computer audio (The audio coming out of my speakers), and my microphone using ffmpeg:
ffmpeg -video_size 1920x1080 -framerate 60
-f x11grab -i :0.0
-f pulse -i default
-f openal -i "Monitor of Headset H390 Analog Stereo" \
-c:v libx264rgb -crf 0 -preset ultrafast video.mkv

It records the video correctly, but not the audio. Only the first audio source (my microphone) is recorded. If I swap the order of -f pulse -i default and -f openal -i "Monitor of Headset H390 Analog Stereo", only my computer audio is recorded. How can I record my computer audio and my microphone at the same time? (Preferrably to different tracks so I can change the volume individually while editing.)
My operating system is Linux Mint 5.3.0-51.
ffmpeg log:
ffmpeg started on 2020-05-17 at 17:07:47
Report written to "ffmpeg-20200517-170747.log"
Command line:
ffmpeg -video_size 1920x1080 -framerate 60 -f x11grab -i :0.0 -f openal -i "Monitor of Headset H390 Analog Stereo" -f pulse -i default -map 0 -map 1 -map 2 -report -c:v libx264rgb -crf 0 -preset ultrafast [FILE PATH]/clips/clip_7.mkv
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Splitting the commandline.
Reading option '-video_size' ... matched as AVOption 'video_size' with argument '1920x1080'.
Reading option '-framerate' ... matched as AVOption 'framerate' with argument '60'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'x11grab'.
Reading option '-i' ... matched as input url with argument ':0.0'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'openal'.
Reading option '-i' ... matched as input url with argument 'Monitor of Headset H390 Analog Stereo'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'pulse'.
Reading option '-i' ... matched as input url with argument 'default'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '1'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '2'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'libx264rgb'.
Reading option '-crf' ... matched as AVOption 'crf' with argument '0'.
Reading option '-preset' ... matched as AVOption 'preset' with argument 'ultrafast'.
Reading option '[FILE PATH]/clips/clip_7.mkv' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url :0.0.
Applying option f (force format) with argument x11grab.
Successfully parsed a group of options.
Opening an input file: :0.0.
[x11grab @ 0x55b2144705e0] Probe buffer size limit of 5000000 bytes reached
[x11grab @ 0x55b2144705e0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':0.0':
  Duration: N/A, start: 1589753267.078638, bitrate: N/A
    Stream #0:0, 1, 1/1000000: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1920x1080, 60 fps, 1000k tbr, 1000k tbn, 1000k tbc
Successfully opened the file.
Parsing a group of options: input url Monitor of Headset H390 Analog Stereo.
Applying option f (force format) with argument openal.
Successfully parsed a group of options.
Opening an input file: Monitor of Headset H390 Analog Stereo.
[openal @ 0x55b2144799a0] All info found
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, openal, from 'Monitor of Headset H390 Analog Stereo':
  Duration: N/A, start: 1589753267.137538, bitrate: 1411 kb/s
    Stream #1:0, 1, 1/1000000: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Successfully opened the file.
Parsing a group of options: input url default.
Applying option f (force format) with argument pulse.
Successfully parsed a group of options.
Opening an input file: default.
[pulse @ 0x55b21448eca0] All info found
Guessed Channel Layout for Input Stream #2.0 : stereo
Input #2, pulse, from 'default':
  Duration: N/A, start: 1589753267.142149, bitrate: 1536 kb/s
    Stream #2:0, 1, 1/1000000: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Successfully opened the file.
Parsing a group of options: output url [FILE PATH]/clips/clip_7.mkv.
Applying option map (set input stream mapping) with argument 0.
Applying option map (set input stream mapping) with argument 1.
Applying option map (set input stream mapping) with argument 2.
Applying option c:v (codec name) with argument libx264rgb.
Successfully parsed a group of options.
Opening an output file: [FILE PATH]/clips/clip_7.mkv.
[file @ 0x55b2144af2c0] Setting default whitelist 'file,crypto'
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264rgb))
  Stream #1:0 -> #0:1 (pcm_s16le (native) -> vorbis (libvorbis))
  Stream #2:0 -> #0:2 (pcm_s16le (native) -> vorbis (libvorbis))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
detected 4 logical cores
[graph 0 input from stream 0:0 @ 0x55b2144b49c0] Setting 'video_size' to value '1920x1080'
[graph 0 input from stream 0:0 @ 0x55b2144b49c0] Setting 'pix_fmt' to value '298'
[graph 0 input from stream 0:0 @ 0x55b2144b49c0] Setting 'time_base' to value '1/1000000'
[graph 0 input from stream 0:0 @ 0x55b2144b49c0] Setting 'pixel_aspect' to value '0/1'
[graph 0 input from stream 0:0 @ 0x55b2144b49c0] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0x55b2144b49c0] Setting 'frame_rate' to value '60/1'
[graph 0 input from stream 0:0 @ 0x55b2144b49c0] w:1440 h:900 pixfmt:bgr0 tb:1/1000000 fr:60/1 sar:0/1 sws_param:flags=2
[format @ 0x55b2144b3500] compat: called with args=[bgr0|bgr24|rgb24]
[format @ 0x55b2144b3500] Setting 'pix_fmts' to value 'bgr0|bgr24|rgb24'
[AVFilterGraph @ 0x55b2144b37c0] query_formats: 4 queried, 3 merged, 0 already done, 0 delayed
[libx264rgb @ 0x55b2144a9660] using mv_range_thread = 72
[libx264rgb @ 0x55b2144a9660] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264rgb @ 0x55b2144a9660] profile High 4:4:4 Predictive, level 4.2, 4:4:4 8-bit
[libx264rgb @ 0x55b2144a9660] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=0 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=0
Clipping frame in rate conversion by 0.000008
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[graph_1_in_1_0 @ 0x55b2145a0ae0] Setting 'time_base' to value '1/44100'
[graph_1_in_1_0 @ 0x55b2145a0ae0] Setting 'sample_rate' to value '44100'
[graph_1_in_1_0 @ 0x55b2145a0ae0] Setting 'sample_fmt' to value 's16'
[graph_1_in_1_0 @ 0x55b2145a0ae0] Setting 'channel_layout' to value '0x3'
[graph_1_in_1_0 @ 0x55b2145a0ae0] tb:1/44100 samplefmt:s16 samplerate:44100 chlayout:0x3
[format_out_0_1 @ 0x55b2145a0e60] Setting 'sample_fmts' to value 'fltp'
[format_out_0_1 @ 0x55b2145a0e60] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_1'
[AVFilterGraph @ 0x55b21459fc00] query_formats: 4 queried, 6 merged, 3 already done, 0 delayed
[auto_resampler_0 @ 0x55b2145a3120] [SWR @ 0x55b2145a34c0] Using s16p internally between filters
[auto_resampler_0 @ 0x55b2145a3120] ch:2 chl:stereo fmt:s16 r:44100Hz -> ch:2 chl:stereo fmt:fltp r:44100Hz
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[graph_2_in_2_0 @ 0x55b214624420] Setting 'time_base' to value '1/48000'
[graph_2_in_2_0 @ 0x55b214624420] Setting 'sample_rate' to value '48000'
[graph_2_in_2_0 @ 0x55b214624420] Setting 'sample_fmt' to value 's16'
[graph_2_in_2_0 @ 0x55b214624420] Setting 'channel_layout' to value '0x3'
[graph_2_in_2_0 @ 0x55b214624420] tb:1/48000 samplefmt:s16 samplerate:48000 chlayout:0x3
[format_out_0_2 @ 0x55b214608180] Setting 'sample_fmts' to value 'fltp'
[format_out_0_2 @ 0x55b214608180] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_2'
[AVFilterGraph @ 0x55b214633380] query_formats: 4 queried, 6 merged, 3 already done, 0 delayed
[auto_resampler_0 @ 0x55b214605300] [SWR @ 0x55b21464fd20] Using s16p internally between filters
[auto_resampler_0 @ 0x55b214605300] ch:2 chl:stereo fmt:s16 r:48000Hz -> ch:2 chl:stereo fmt:fltp r:48000Hz
Output #0, matroska, to '[FILE PATH]/clips/clip_7.mkv':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0, 0, 1/1000: Video: h264 (libx264rgb) (H264 / 0x34363248), bgr0(progressive), 1920x1080, q=-1--1, 60 fps, 1k tbn, 60 tbc
    Metadata:
      encoder         : Lavc57.107.100 libx264rgb
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1, 0, 1/1000: Audio: vorbis (libvorbis) (oV[0][0] / 0x566F), 44100 Hz, stereo, fltp
    Metadata:
      encoder         : Lavc57.107.100 libvorbis
    Stream #0:2, 0, 1/1000: Audio: vorbis (libvorbis) (oV[0][0] / 0x566F), 48000 Hz, stereo, fltp
    Metadata:
      encoder         : Lavc57.107.100 libvorbis
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
[x11grab @ 0x55b2144705e0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
Past duration 0.835838 too large
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
*** dropping frame 4 from stream 0 at ts 82
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
*** dropping frame 5 from stream 0 at ts 83
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
*** dropping frame 5 from stream 0 at ts 83
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
Clipping frame in rate conversion by 0.550987
*** dropping frame 6 from stream 0 at ts 84
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
[libx264rgb @ 0x55b2144a9660] frame=   0 QP=0.00 NAL=3 Slice:I Poc:0   I:5130 P:0    SKIP:0    size=381047 bytes
[matroska @ 0x55b2144a7b60] get_metadata_duration returned: 0
[matroska @ 0x55b2144a7b60] Writing block at offset 9, size 1, pts 0, dts 0, duration 3, keyframe 1
[matroska @ 0x55b2144a7b60] Writing block at offset 16, size 43, pts 0, dts 0, duration 3, keyframe 1
[matroska @ 0x55b2144a7b60] Writing block at offset 65, size 381569, pts 3, dts 3, duration 17, keyframe 1
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
[rawvideo @ 0x55b214479380] PACKET SIZE: 5184000, STRIDE: 5760
Past duration 0.748894 too large
*** dropping frame 8 from stream 0 at ts 86
[libx264rgb @ 0x55b2144a9660] frame=   1 QP=0.00 NAL=2 Slice:P Poc:2   I:2951 P:292  SKIP:1887 size=88367 bytes
[matroska @ 0x55b2144a7b60] Writing block at offset 381643, size 1, pts 3, dts 3, duration 13, keyframe 1
[matroska @ 0x55b2144a7b60] Writing block at offset 381650, size 198, pts 3, dts 3, duration 12, keyframe 1
[matroska @ 0x55b2144a7b60] Writing block at offset 381855, size 190, pts 15, dts 15, duration 21, keyframe 1
[matroska @ 0x55b2144a7b60] Writing block at offset 382052, size 1, pts 16, dts 16, duration 23, keyframe 1
[matroska @ 0x55b2144a7b60] Writing block at offset 382059, size 192, pts 36, dts 36, duration 21, keyframe 1
[Repeated a lot of times]
[matroska @ 0x55b2144a7b60] Writing block at offset 171, size 1, pts 5517, dts 5517, duration 23, keyframe 1
[matroska @ 0x55b2144a7b60] Writing block at offset 178, size 1, pts 5540, dts 5540, duration 23, keyframe 1
[matroska @ 0x55b2144a7b60] Writing block at offset 185, size 1, pts 5564, dts 5564, duration 23, keyframe 1
[matroska @ 0x55b2144a7b60] Writing block at offset 192, size 1, pts 5587, dts 5587, duration 6, keyframe 1
[matroska @ 0x55b2144a7b60] end duration = 5593
[matroska @ 0x55b2144a7b60] stream 0 end duration = 4787
[matroska @ 0x55b2144a7b60] stream 1 end duration = 5593
[matroska @ 0x55b2144a7b60] stream 2 end duration = 4567
frame=   41 fps=9.5 q=-1.0 Lsize=    1760kB time=00:00:05.58 bitrate=2581.4kbits/s dup=0 drop=105 speed=1.29x    
video:1707kB audio:41kB subtitle:0kB other streams:0kB global headers:8kB muxing overhead: 0.677361%
Input file #0 (:0.0):
  Input stream #0:0 (video): 146 packets read (756864000 bytes); 146 frames decoded; 
  Total: 146 packets (756864000 bytes) demuxed
Input file #1 (Monitor of Headset H390 Analog Stereo):
  Input stream #1:0 (audio): 22 packets read (773588 bytes); 22 frames decoded (193397 samples); 
  Total: 22 packets (773588 bytes) demuxed
Input file #2 (default):
  Input stream #2:0 (audio): 20 packets read (876288 bytes); 20 frames decoded (219072 samples); 
  Total: 20 packets (876288 bytes) demuxed
Output file #0 ([FILE PATH]/clips/clip_7.mkv):
  Output stream #0:0 (video): 41 frames encoded; 41 packets muxed (1747992 bytes); 
  Output stream #0:1 (audio): 3021 frames encoded (193344 samples); 191 packets muxed (191 bytes); 
  Output stream #0:2 (audio): 3423 frames encoded (219072 samples); 223 packets muxed (41851 bytes); 
  Total: 455 packets (1790034 bytes) muxed
188 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x55b2144af5a0] Statistics: 16 seeks, 18 writeouts
[libx264rgb @ 0x55b2144a9660] frame I:1     Avg QP: 0.00  size:381047
[libx264rgb @ 0x55b2144a9660] frame P:40    Avg QP: 0.00  size: 34161
[libx264rgb @ 0x55b2144a9660] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264rgb @ 0x55b2144a9660] mb P  I16..4: 50.9%  0.0%  0.0%  P16..4:  1.5%  0.0%  0.0%  0.0%  0.0%    skip:47.6%
[libx264rgb @ 0x55b2144a9660] coded y,u,v intra: 4.3% 1.1% 2.3% inter: 2.1% 0.3% 1.0%
[libx264rgb @ 0x55b2144a9660] i16 v,h,dc,p: 98%  2%  0%  0%
[libx264rgb @ 0x55b2144a9660] kb/s:2922.60
Exiting normally, received signal 2.

**Tags:** ffmpeg, audio-recording, tracks


---

## 1 answers

### Answer by username_1 on 2020-05-14. Score: 3 | Accepted answer

You need to map all streams, so
ffmpeg -video_size 1920x1080 -framerate 60
-f x11grab -i :0.0
-f pulse -i default
-f openal -i "Monitor of Headset H390 Analog Stereo"
-map 0 -map 1 -map 2
-c:v libx264rgb -crf 0 -preset ultrafast video.mkv

See http://ffmpeg.org/ffmpeg.html#Stream-selection for how ffmpeg automatically selects streams when map is absent.

> **Comments:**
> **username_0**: The same problem still happens.  
> **username_1**: Share full log.  
> **username_0**: The video now has two separate audio tracks, but one is completely silent. The other one is the first source in the command.  
> **username_1**: Share full log.  
> **username_0**: What do you mean by a "full log"? `ffmpeg` doesn't output a log as far as I know.  
> **username_1**: The log refers to the stderr console output generated by ffmpeg. You can also add -report to save it to file.  
> **username_0**: Apparently it works now... That's strange.  

---

