cytopia / ffscreencast

ffscreencast - ffmpeg screencast/desktop-recording with video overlay and multi monitor support
MIT License
1.78k stars 78 forks source link

Support for system audio (not mic) #28

Closed frakman1 closed 6 years ago

frakman1 commented 6 years ago

Test platform: MacBookAir OSX 10.12.6 Sierra

I would like record system audio (i.e. audio coming out of the speakers and no microphone audio). I don't see a device like that listed when I use --list option.

Is this possible?

$ffscreencast --list
Available screen recording devices (monitors):

[1] Capture screen 0

Available audio recording devices (monitors):

[0] NoMachine Microphone Adapter
[1] Built-in Microphone
[2] NoMachine Audio Adapter

Available camera recording devices:

[0] FaceTime HD Camera (1280x720@ 30.000000]fp 640x480@ 30.000000]fp 320x240@ 30.000000]fp)
frakman1 commented 6 years ago

I found a workaround.

I had to install SoundFlower. Follow this guide to install and setup input and output. Note that you won't be able to actually hear any system audio as it is redirected to the SoundFlower device. You will see the meter move however to prove that it is working.

I selected that sound device after finding its index like this:

$ffscreencast --alist
Available audio recording devices (microphones):

[0] Soundflower (2ch)
[1] Built-in Microphone
[2] Soundflower (64ch)

Using ffscreencast -a0 gave me this error: Unknown encoder 'libfaac'

So I used its --dry output and modified libfaac -> aac and it started working!

/usr/local/bin/ffmpeg -hide_banner -loglevel info -thread_queue_size 512 -f avfoundation  -i "1" -thread_queue_size 512 -f avfoundation -ac 2 -i ":0" -c:a aac -c:v
libx264 -crf 0 -preset ultrafast -threads 0 "/Users/xxx/Desktop/Screencast 2018-04-24 at 13.41.25.mkv"

Just remember to reset your Input/Output sound devices in System Properties -> Sound to default (Microphone and Internal Speaker respectively) to hear it correctly in the recording.