MaartenBaert / ssr

SimpleScreenRecorder, a screen recorder for Linux
http://www.maartenbaert.be/simplescreenrecorder/
GNU General Public License v3.0
2.58k stars 290 forks source link

[Feature Request] Multiple audio inputs #67

Open GreatEmerald opened 11 years ago

GreatEmerald commented 11 years ago

Recording several audio inputs is quite important. Right now that is only achievable by doing some fiddling with PulseAudio as documented on the website. It would be nice if it was possible to record more than one audio stream at a time from the recorder directly.

MaartenBaert commented 11 years ago

Yes, I know. It would also create less problems since it depends less on PulseAudio. I'm working on JACK support right now, that has to be completed before I add support for multiple audio inputs.

GreatEmerald commented 11 years ago

All right, just making sure you have it on the to-do list, and that I get notified once it's done :)

Brottweiler commented 10 years ago

Would this mean input for speaker sound input (sound from speakers like a game, mumble...), and an option to also select your microphone? Because "native" support for both microphone and speaker sound would be very needed!

MaartenBaert commented 10 years ago

@Brottweiler: I'm not sure yet how I will do it, but you will probably have a checkbox to enable a second audio stream and you will be able to select a different input for each stream.

mikesbytes commented 10 years ago

I have an idea for implementing this:

In the "Record Audio" panel, have a little plus and minus button. Pressing plus adds an input, minus removes one.

Each input has 5 options, backend, source, seperate file, codec, and stream. File, and stream (codec as well?) could maybe be hidden by default, and revealed by an "advanced" checkbox.

Seperate file records the audio into a seperate file. Stream makes a seperate stream in the main video file, so that way you can have seperate desktop and microphone audio, that way you can edit the mic without tainting the rest.

Codec is self explanatory. Options like AAC, MP3, bitrates, etc.

MaartenBaert commented 10 years ago

The biggest challenge is not the user interface but the backend that has to do the actual work ;).

Almost all file formats support multiple audio streams per file, so there is no need for separate files (in fact it is less efficient and it complicates things). And I don't really see the point of using different codecs or bit rates for separate audio streams. I suppose it could be useful in some very specific cases, but who is going to bother with optimal audio settings when audio is only 5% of the total file size?

Lucki commented 10 years ago

@MaartenBaert It would be useful to have at least three input and output streams (game sound, microfone, mumble)

Brottweiler commented 10 years ago

Would be nice to be able to select what applications to record, so you select your microphone, then you select your game, aswell as mumble, but not your music player.

Is it possible to be able to somehow select what "Playback channel", that pavucontrol shows for example, to record?

Lucki commented 10 years ago

You can connect your ports with jack. Mumble and the microphone use jack directly, the game is connected over a pulse-jack-bridge. So yes, you need a music player, which use jack, so it doesn't get in the same sound-channel with the game. Or… i made it way too complicated.

MaartenBaert commented 10 years ago

AFAIK PulseAudio doesn't provide a way to record a single application. It's definitely possible with JACK, but you will have to connect things manually.

amxsc commented 10 years ago

@MaartenBaert

I hate to even ask this but has there been any progress on this feature.

The reason I'm asking is that I'm using SSR and the audio from my headset microphone is very quite compared to my headset speaker audio. If I use Pulse Audio Volume Control to boost the microphone my voice is now fine but I get a lot of static noise in the audio recording. I have tried to filter the audio in post processing but since the speaker and microphone are now combined removing the static noise caused by the microphone boost also removes a lot of the games sounds through the speakers. If I could record both the microphone and speaker audio on different channels I should be able to filter out the noise in the microphone audio and leave the speaker audio the way it is.

Also wanted to add a quick ---> Thank You <--- for a great program.

Amxsc

MaartenBaert commented 10 years ago

I hate to even ask this but has there been any progress on this feature.

Nope, not yet. I'm working on some other features that I need to complete first. I don't have much free time at the moment, so this is going to take some time.

Anomitee commented 10 years ago

AFAIK PulseAudio doesn't provide a way to record a single application. It's definitely possible with JACK, but you will have to connect things manually.

Hi there @MaartenBaert

I've found a method for recording specific applications in separate streams using PulseAudio to separate things. This makes use of planned feature of multiple audio streams, and should allow recording and separate editing of different audio streams. It's a bit of a long read - sorry about that (I like to explain things), which is why I've decided to make it a gist: https://gist.github.com/Anomitee/328dc469e24b66428aea

Here's a short version, with less explainations:

Run the following commands, changing NAME to anything you like (I'd suggest names like "mumble" or "minecraft" etc.: pactl load-module module-null-sink sink_name=NAME_out pactl load-module module-loopback source=NAME_out.monitor This create a Null Output in the output tab of pavucontrol and a monitor of it in the inputs tab. You can send all your applications to Null Output, and record both your mic and the Monitor of Null Output. If you want a separate audio stream for each applications (for editing), repeat the two commands as many times as you need to and send each application to a separate Null Ouput. Record the whole lot with SSR.

Quick drawing to illustrate: http://i.imgur.com/L91T1XW.jpg

Edit: forgot to mention that running pactl unload-module module-null-sink pactl unload-module module-loopback will revert all of this after you've finished recording.

iamgreaser commented 10 years ago

As much as PulseAudio sucks, I also know that it is at least theoretically possible to handle more than 2 channels, and also theoretically possible to reroute things. From my understanding, it's really only a matter of "change the number of channels used in the input and file output", and "make your code work with more than 2 channels"

A quick test with ffmpeg shows that it's possible to make mkv files with 3 channels.

I might have a crack at this myself some time.

MaartenBaert commented 10 years ago

Yes, this is of course possible in SSR, but I have to rewrite some things. The synchronizer in its current form doesn't work properly with multiple inputs. Previewing also becomes more complex (I want to be able to preview channels before mixing, and also the final mixed result). My plan is to add separate VideoMixer and AudioMixer classes that sit in front of the synchronizer. These should convert all streams to a global clock (essentially hrt_time_micro() * sample_rate / 1000000), mix them together, and send the result to Synchronizer (which does the usual stuff, minus the time and drift correction which is no longer necessary). The mixers would inherit VideoSource and AudioSource respectively, and they would create multiple instances of some secondary class (VideoMixerInput?) which inherits VideoSink or AudioSink. They should be able to operate independently from Synchronizer, because the synchronizer is tied to the output and can't be used for previewing when the output is not running.