title: How to record screen with audio in VLC on MacOSX
body: <p>I came across this <a href="https://stackoverflow.com/questions/6538426/how-to-capture-microphone-input-in-vlc">How to capture microphone input in VLC?</a> and in this post it is said that:</p>
  
  <blockquote>
    <p>Mac: Use VLC 2.0.0 or later and utilize the qtsound module:</p>
  </blockquote>
  
  <pre><code>/Applications/VLC.app/Contents/MacOS/VLC -vvv qtsound:// 
  </code></pre>
  
  <p>If I run this command, VLC takes the sound from the microphone and outputs it to the speakers:</p>
  
  <pre><code>/Applications/VLC.app/Contents/MacOS/VLC qtsound://
  </code></pre>
  
  <p>Is there a way to record this to a file?
  If there is, is there a way to combine it with a screen recording and produce a screen cast with sound?</p>
  
  <p>So far I managed to record the screen cast but I was unable to add sound to the video recordings:</p>
  
  <pre><code>/Applications/VLC.app/Contents/MacOS/VLC -I dummy screen:// --screen-fps=25 --sout "#transcode{vcodec=h264,vb072,acodec=mp4a,ab=128}:standard{access=file,mux=mp4,dst="~/Desktop/vlc-output-terminal.mp4"}"
  </code></pre>
  
  <p>Any idea how to record sound from the microphone using VLC and qtsound (or other input)? </p>
  
  <p><strong>Update:</strong></p>
  
  <p>On Linux it works with a so-called <strong>--input-slave</strong> parameter which I tried to replicate on mac with the mac audio device:</p>
  
  <pre><code>/Applications/VLC.app/Contents/MacOS/VLC -vvv -I dummy  screen:// --input-slave qtsound://AppleHDAEngineInput:1B,0,1,0:1 --sout "#transcode{vcodec=h264,vb=1024,acodec=mp4a,ab=128}:standard{access=file,mux=mp4,dst="~/Desktop/vlc-output-terminal.mp4"}"
  </code></pre>
  
  <p>Unfortunately, even though VLC says everything is fine, the output file is invalid and always just 44 bytes long. Here is the console output of the command:</p>
  
  <pre><code>APPLEs-MacBook-Pro:deploy-mac myuser$ /Applications/VLC.app/Contents/MacOS/VLC -vvv -I dummy  screen:// --input-slave qtsound://AppleHDAEngineInput:1B,0,1,0:1 --sout "#transcode{vcodec=h264,vb=1024,acodec=mp4a,ab=128}:standard{access=file,mux=mp4,dst="/Users/myuser/Desktop/vlc-output-terminal.mp4"}"
  VLC media player 2.1.5 Rincewind (revision 2.1.4-59-g5f258d5)
  [0x100503250] main libvlc debug: VLC media player - 2.1.5 Rincewind
  [0x100503250] main libvlc debug: Copyright © 1996-2014 the VideoLAN team
  [0x100503250] main libvlc debug: revision 2.1.4-59-g5f258d5
  [0x100503250] main libvlc debug: configured with ../extras/package/macosx/../../../configure  '--prefix=/Users/fkuehne/Desktop/videolan/gits/vlc-2.1/release/vlc_install_dir' '--enable-macosx' '--enable-merge-ffmpeg' '--enable-growl' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-shout' '--enable-ncurses' '--enable-twolame' '--enable-realrtsp' '--enable-libass' '--enable-macosx-audio' '--enable-macosx-eyetv' '--enable-macosx-qtkit' '--enable-macosx-vout' '--disable-caca' '--disable-skins2' '--disable-xcb' '--disable-sdl' '--disable-samplerate' '--disable-macosx-dialog-provider' '--with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk' '--build=x86_64-apple-darwin10' '--with-macosx-version-min=10.6' 'build_alias=x86_64-apple-darwin10' 'CC=xcrun clang' 'CXX=xcrun clang++' 'OBJC=xcrun clang'
  [0x100503250] main libvlc debug: searching plug-in modules
  [0x100503250] main libvlc debug: loading plugins cache file /Applications/VLC.app/Contents/MacOS/plugins/plugins.dat
  [0x100503250] main libvlc debug: recursively browsing `/Applications/VLC.app/Contents/MacOS/plugins'
  [0x100503250] main libvlc debug: saving plugins cache /Applications/VLC.app/Contents/MacOS/plugins/plugins.dat
  [0x100503250] main libvlc debug: plug-ins loaded: 373 modules
  [0x100503250] main libvlc debug: opening config file (/Users/myuser/Library/Preferences/org.videolan.vlc/vlcrc)
  [0x100503250] main libvlc debug: translation test: code is "C"
  [0x100503250] main libvlc debug: CPU has capabilities MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 FPU 
  [0x100477360] main interface debug: looking for interface module matching "(null),none": 15 candidates
  [0x100477360] main interface debug: no interface modules matched
  [0x100477360] main interface error: no suitable interface module
  [0x100478c70] main input debug: Creating an input for 'Media Library'
  [0x100478c70] main input debug: Input is a meta file: disabling unneeded options
  [0x100478c70] main input debug: using timeshift granularity of 50 MiB, in path '/tmp'
  [0x100478c70] main input debug: `file/xspf-open:///Users/myuser/Library/Application%20Support/org.videolan.vlc/ml.xspf' gives access `file' demux `xspf-open' path `/Users/myuser/Library/Application%20Support/org.videolan.vlc/ml.xspf'
  [0x100478c70] main input debug: creating demux: access='file' demux='xspf-open' location='/Users/myuser/Library/Application%20Support/org.videolan.vlc/ml.xspf' file='/Users/myuser/Library/Application Support/org.videolan.vlc/ml.xspf'
  [0x10047bf40] main demux debug: looking for access_demux module matching "file": 14 candidates
  [0x10047bf40] main demux debug: no access_demux modules matched
  [0x100478c70] main input debug: creating access 'file' location='/Users/myuser/Library/Application%20Support/org.videolan.vlc/ml.xspf', path='/Users/myuser/Library/Application Support/org.videolan.vlc/ml.xspf'
  [0x10047c5f0] main access debug: looking for access module matching "file": 18 candidates
  [0x10047c5f0] filesystem access debug: opening file `/Users/myuser/Library/Application Support/org.videolan.vlc/ml.xspf'
  [0x10047c5f0] main access debug: using access module "filesystem"
  [0x10047ca00] main stream debug: Using stream method for AStream*
  [0x10047ca00] main stream debug: starting pre-buffering
  [0x10047ca00] main stream debug: received first data after 0 ms
  [0x10047ca00] main stream debug: pre-buffering done 296 bytes in 0s - 15213 KiB/s
  [0x10047cc60] main stream debug: looking for stream_filter module matching "any": 9 candidates
  [0x10047cc60] main stream debug: no stream_filter modules matched
  [0x10047cc60] main stream debug: looking for stream_filter module matching "record": 9 candidates
  [0x10047cc60] main stream debug: using stream_filter module "record"
  [0x100478c70] main input debug: creating demux: access='file' demux='xspf-open' location='/Users/myuser/Library/Application%20Support/org.videolan.vlc/ml.xspf' file='/Users/myuser/Library/Application Support/org.videolan.vlc/ml.xspf'
  [0x10047d4d0] main demux debug: looking for demux module matching "xspf-open": 63 candidates
  [0x10047d4d0] playlist demux debug: using XSPF playlist reader
  [0x10047d4d0] main demux debug: using demux module "playlist"
  [0x10047d6e0] main demux meta debug: looking for meta reader module matching "any": 2 candidates
  [0x10047d6e0] lua demux meta debug: Trying Lua scripts in /Users/myuser/Library/Application Support/org.videolan.vlc/lua/meta/reader
  [0x10047d6e0] lua demux meta debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader
  [0x10047d6e0] lua demux meta debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader/filename.luac
  [0x10047d6e0] lua demux meta debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/meta/reader
  [0x10047d6e0] main demux meta debug: no meta reader modules matched
  [0x100478c70] main input debug: `file/xspf-open:///Users/myuser/Library/Application%20Support/org.videolan.vlc/ml.xspf' successfully opened
  [0x1004817e0] main xml reader debug: looking for xml reader module matching "any": 1 candidates
  [0x1004817e0] main xml reader debug: using xml reader module "xml"
  [0x10047d4d0] playlist demux debug: parsed 0 tracks successfully
  [0x100478c70] main input debug: EOF reached
  [0x10047d4d0] main demux debug: removing module "playlist"
  [0x10047cc60] main stream debug: removing module "record"
  [0x10047c5f0] main access debug: removing module "filesystem"
  [0x100477870] main playlist debug: creating audio output
  [0x10047ca00] main audio output debug: looking for audio output module matching "any": 4 candidates
  [0x10047ca00] auhal audio output debug: found 4 audio device(s)
  [0x10047ca00] auhal audio output debug: DevID: 39 DevName: AirPlay
  [0x10047ca00] auhal audio output debug: found 1 stream formats for stream id 40
  [0x10047ca00] auhal audio output debug: DevID: 65 DevName: Built-in Microphone
  [0x10047ca00] auhal audio output debug: this 'Built-in Microphone' is INPUT only. skipping...
  [0x10047ca00] auhal audio output debug: DevID: 55 DevName: Built-in Input
  [0x10047ca00] auhal audio output debug: this 'Built-in Input' is INPUT only. skipping...
  [0x10047ca00] auhal audio output debug: DevID: 47 DevName: Built-in Output
  [0x10047ca00] auhal audio output debug: found 16 stream formats for stream id 48
  [0x10047ca00] main audio output debug: restart requested (2)
  [0x10047ca00] main audio output debug: using audio output module "auhal"
  [0x100477870] main playlist debug: keeping audio output
  [0x100477870] main playlist debug: adding item `screen://' ( screen:// )
  [0x100477870] main playlist debug: no fetch required for (null) (art currently (null))
  [0x100506170] main interface debug: looking for interface module matching "hotkeys,none": 15 candidates
  [0x100506170] main interface debug: using interface module "hotkeys"
  [0x100506590] main interface debug: looking for interface module matching "dummy": 15 candidates
  [0x100506590] dummy interface: using the dummy interface module...
  [0x100506590] main interface debug: using interface module "dummy"
  [0x100477870] main playlist debug: processing request item: null, node: Playlist, skip: 0
  [0x100477870] main playlist debug: rebuilding array of current - root Playlist
  [0x100477870] main playlist debug: rebuild done - 1 items, index -1
  [0x100477870] main playlist debug: starting playback of the new playlist item
  [0x100477870] main playlist debug: resyncing on screen://
  [0x100477870] main playlist debug: screen:// is at 0
  [0x100477870] main playlist debug: creating new input thread
  [0x10048e9e0] main input debug: Creating an input for 'screen://'
  [0x100506cb0] main stream output debug: using sout chain=`transcode{vcodec=h264,vb=1024,acodec=mp4a,ab=128}:standard{access=file,mux=mp4,dst=/Users/myuser/Desktop/vlc-output-terminal.mp4}'
  [0x100506cb0] main stream output debug: stream=`standard'
  [0x100507250] main stream out debug: looking for sout stream module matching "standard": 20 candidates
  [0x100507250] main stream out debug: set config option: sout-standard-access to file
  [0x100507250] main stream out debug: set config option: sout-standard-mux to mp4
  [0x100507250] main stream out debug: set config option: sout-standard-dst to /Users/myuser/Desktop/vlc-output-terminal.mp4
  [0x100507e50] main access out debug: looking for sout access module matching "file": 8 candidates
  [0x100507e50] access_output_file access out debug: file access output opened (/Users/myuser/Desktop/vlc-output-terminal.mp4)
  [0x100507e50] main access out debug: using sout access module "access_output_file"
  [0x100508430] main mux debug: looking for sout mux module matching "mp4": 10 candidates
  [0x100508430] mux_mp4 mux debug: Mp4 muxer opened
  [0x100508430] main mux debug: using sout mux module "mux_mp4"
  [0x100507250] stream_out_standard stream out debug: using `file/mp4:///Users/myuser/Desktop/vlc-output-terminal.mp4'
  [0x100507250] main stream out debug: using sout stream module "stream_out_standard"
  [0x100506cb0] main stream output debug: stream=`transcode'
  [0x1005087a0] main stream out debug: looking for sout stream module matching "transcode": 20 candidates
  [0x1005087a0] main stream out debug: set config option: sout-transcode-vcodec to h264
  [0x1005087a0] main stream out debug: set config option: sout-transcode-vb to 1024
  [0x1005087a0] main stream out debug: set config option: sout-transcode-acodec to mp4a
  [0x1005087a0] main stream out debug: set config option: sout-transcode-ab to 128
  [0x1005087a0] stream_out_transcode stream out debug: codec audio=mp4a 0Hz 0 channels 128Kb/s
  [0x1005087a0] stream_out_transcode stream out debug: codec video=h264 0x0 scaling: 0.000000 1024kb/s
  [0x1005087a0] main stream out debug: using sout stream module "stream_out_transcode"
  [0x10048e9e0] main input debug: using timeshift granularity of 50 MiB, in path '/tmp'
  [0x10048e9e0] main input debug: `screen://' gives access `screen' demux `' path `'
  [0x10048e9e0] main input debug: creating demux: access='screen' demux='' location='' file='(null)'
  [0x10050a4b0] main demux debug: looking for access_demux module matching "screen": 14 candidates
  [0x10050a4b0] screen demux debug: screen width: 1920, height: 1200, depth: 32
  [0x10048e9e0] main input debug: selecting program id=0
  [0x10050a4b0] main demux debug: using access_demux module "screen"
  [0x10048e9e0] main input debug: adding slave input 'qtsound://AppleHDAEngineInput:1B,0,1,0:1'
  [0x10048e9e0] main input debug: `qtsound://AppleHDAEngineInput:1B,0,1,0:1' gives access `qtsound' demux `' path `AppleHDAEngineInput:1B,0,1,0:1'
  [0x10048e9e0] main input debug: creating demux: access='qtsound' demux='' location='AppleHDAEngineInput:1B,0,1,0:1' file='(null)'
  [0x100492f20] main demux debug: looking for access_demux module matching "qtsound": 14 candidates
  [0x100492f20] qtsound.lo demux debug: qtsound uid = AppleHDAEngineInput:1B,0,1,0:1
  [0x100492f20] qtsound.lo demux debug: qtsound : uid = AppleHDAEngineInput:1B,0,1,0:1
  [0x100492f20] qtsound.lo demux debug: qtsound audio 0/2 localizedDisplayName: Built-in Microphone uniqueID: AppleHDAEngineInput:1B,0,1,0:1
  [0x100492f20] qtsound.lo demux debug: Device found
  [0x100492f20] qtsound.lo demux debug: created valid audio capture input facility
  [0x100492f20] qtsound.lo demux debug: initialized audio output
  [0x100492f20] qtsound.lo demux debug: Audio localized format summary: Linear PCM, 24 bit little-endian signed integer, 2 channels, 44100 Hz**
  [0x100492f20] qtsound.lo demux debug: Audio format description attributes: {
      audioStreamBasicDescription = "&lt;00000000 8088e540 6d63706c 04000000 08000000 01000000 08000000 02000000 18000000 00000000&gt;";
  }
  </code></pre>
  
  <p>Beyond this point VLC does nothing and I have to kill it with Ctrl-C becasue nothing happens further.
  From the above log, I guess that what's the most relevant regarding the audio part is that everything seems to work just fine, no error or complaint on the VLC side:</p>
  
  <pre><code>[0x10048e9e0] main input debug: `qtsound://AppleHDAEngineInput:1B,0,1,0:1' gives access `qtsound' demux `' path `AppleHDAEngineInput:1B,0,1,0:1'
      [0x10048e9e0] main input debug: creating demux: access='qtsound' demux='' location='AppleHDAEngineInput:1B,0,1,0:1' file='(null)'
      [0x100492f20] main demux debug: looking for access_demux module matching "qtsound": 14 candidates
      [0x100492f20] qtsound.lo demux debug: qtsound uid = AppleHDAEngineInput:1B,0,1,0:1
      [0x100492f20] qtsound.lo demux debug: qtsound : uid = AppleHDAEngineInput:1B,0,1,0:1
      [0x100492f20] qtsound.lo demux debug: qtsound audio 0/2 localizedDisplayName: Built-in Microphone uniqueID: AppleHDAEngineInput:1B,0,1,0:1
      [0x100492f20] qtsound.lo demux debug: Device found
      [0x100492f20] qtsound.lo demux debug: created valid audio capture input facility
      [0x100492f20] qtsound.lo demux debug: initialized audio output
      [0x100492f20] qtsound.lo demux debug: Audio localized format summary: Linear PCM, 24 bit little-endian signed integer, 2 channels, 44100 Hz**
      [0x100492f20] qtsound.lo demux debug: Audio format description attributes: {
          audioStreamBasicDescription = "&lt;00000000 8088e540 6d63706c 04000000 08000000 01000000 08000000 02000000 18000000 00000000&gt;";
      }
  </code></pre>