Sharex: Sound recording from two sources at same time

Created on 7 Aug 2019  路  11Comments  路  Source: ShareX/ShareX

Hello,
is it possible to record both my desktop audio and microphone audio at the same time on Windows 10? If not is there some workaround, e.g. install some mixer instead of virtual-audio-capture that put all audio sources together?

Invalid

Most helpful comment

It is possible to use the "Use custom command" and achieve the required behavior.
But anyway, GUI option for this would be desirable for beginners, and not much technically literate people.

This is how we add two inputs into a single capture:
ffmpeg.exe -y -rtbufsize 150M -f dshow -framerate 30 -i video="screen-capture-recorder":audio="virtual-audio-capturer":audio="Microphone (USB PnP Audio Device)" -c:v libx264 -r 30 -preset ultrafast -tune zerolatency -crf 28 -pix_fmt yuv420p -movflags +faststart -c:a aac -strict -2 -ac 2 -b:a 128k "output.mp4"

The bold part is what I added to achieve what I need => system sound and mic in a single capture.

All 11 comments

I'd like to second this! I would really like to record from both sources at the same time

FFmpeg CLI not supports that.

I've done some digging on this. I definitely think it's possible. Here's a thread related to this using the screen-capture-recorder that ShareX uses: https://github.com/rdp/screen-capture-recorder-to-video-windows-free/issues/119

And here is a proof of concept: https://youtu.be/CrhpaZ8GQrE

I created this with ShareX by downloading the source code and making the following change in FFmpegHelper.cs:

public bool Record()
{
    recordingStarted = false;
    string commands = Options.GetFFmpegCommands();
    commands = commands.Replace(":audio=\"Microphone (Realtek High Definition Audio)\"",
        " -f dshow -i audio=\"virtual-audio-capturer\" -f dshow -i audio=\"Microphone (Realtek High Definition Audio)\" -filter_complex amix=inputs=2:duration=first:dropout_transition=3");
    return Run(Options.FFmpeg.FFmpegPath, commands);
}

Obviously this is not the exact proper way to do it, but it's proof that it IS possible

@Jaex Have you looked into this at all? I could look into the ShareX source code some more and probably make most of a pull request, but I don't know at all the best practices for editing ShareX UI (and this would definitely require a UI change to allow the user to select a "Both" option when selecting the screen recording audio source)

I did. Enabling audio recording already kills fps of a lot of users, adding such workarounds would make it worse. Also for most users microphone recording becomes quite etc. So people should use proper recording software for such stuffs.

Good to know. I'll probably add my own workaround in the source code locally still. Thanks for the response!

Can't you use "Use custom commands" option in screen recording options window to accomplish it. So you don't have to edit source?

Oh, I'll have to look into that. Didn't know there was such a thing (still pretty new to ShareX). Thanks for the tip!

It is possible to use the "Use custom command" and achieve the required behavior.
But anyway, GUI option for this would be desirable for beginners, and not much technically literate people.

This is how we add two inputs into a single capture:
ffmpeg.exe -y -rtbufsize 150M -f dshow -framerate 30 -i video="screen-capture-recorder":audio="virtual-audio-capturer":audio="Microphone (USB PnP Audio Device)" -c:v libx264 -r 30 -preset ultrafast -tune zerolatency -crf 28 -pix_fmt yuv420p -movflags +faststart -c:a aac -strict -2 -ac 2 -b:a 128k "output.mp4"

The bold part is what I added to achieve what I need => system sound and mic in a single capture.

And here is a proof of concept: https://youtu.be/CrhpaZ8GQrE

I created this with ShareX by downloading the source code and making the following change in FFmpegHelper.cs:

public bool Record()
{
    recordingStarted = false;
    string commands = Options.GetFFmpegCommands();
    commands = commands.Replace(":audio=\"Microphone (Realtek High Definition Audio)\"",
        " -f dshow -i audio=\"virtual-audio-capturer\" -f dshow -i audio=\"Microphone (Realtek High Definition Audio)\" -filter_complex amix=inputs=2:duration=first:dropout_transition=3");
    return Run(Options.FFmpeg.FFmpegPath, commands);
}

Obviously this is not the exact proper way to do it, but it's proof that it IS possible

After adjusting this suggestion, I was able to change ShareX screen recording command to the following:

-rtbufsize 150M -f gdigrab -framerate $fps$ -offset_x $area_x$ -offset_y $area_y$ -video_size $area_width$x$area_height$ -draw_mouse $cursor$ -i desktop -f dshow -i audio="virtual-audio-capturer" -f dshow -i audio="Microphone Array (Realtek High Definition Audio(SST))" -filter_complex amix=inputs=2:duration=first:dropout_transition=3 -c:v libx264 -r $fps$ -preset ultrafast -tune zerolatency -crf 28 -pix_fmt yuv420p -movflags +faststart -c:a libmp3lame -qscale:a 4 -y "$output$"
#works well, recording both audio channels and right region of video.

Which worked well on my machine, allows me to record the right region of the screen plus multiple audio channels simultaneously.

Task settings> Capture > screen recorder > screen recorder options> check on "use custom commands" then paste it there.
should look like this

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wilandlane picture wilandlane  路  3Comments

Atmaks picture Atmaks  路  3Comments

WebFreak001 picture WebFreak001  路  3Comments

sparxz picture sparxz  路  4Comments

nickodemos picture nickodemos  路  3Comments