Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for audio recording #15

Closed
kapoorlakshya opened this issue Dec 4, 2018 · 7 comments
Closed

Add support for audio recording #15

kapoorlakshya opened this issue Dec 4, 2018 · 7 comments
Labels
enhancement New feature or request
Milestone

Comments

@kapoorlakshya
Copy link
Owner

kapoorlakshya commented Dec 4, 2018

See if audio recording can be supported through advanced. If not, look into implementing parameters for it.

@kapoorlakshya kapoorlakshya added the enhancement New feature or request label Dec 24, 2018
@kapoorlakshya kapoorlakshya added this to the v1.3.0 milestone May 8, 2019
@kapoorlakshya kapoorlakshya removed this from the v1.3.0 milestone Jul 26, 2019
@sh3p42d
Copy link

sh3p42d commented Nov 25, 2019

Hello! Thanks for the gem!
Is it possible to record video with audio now? I added settings to 'advanced' but got an error 'Unable to find a suitable output format for ***'. If its possible, I dont undestand where and what settings need to be set to do this. I use linux, if its important.

@kapoorlakshya
Copy link
Owner Author

Hi @sh3p42d, can you share the advanced configs (code for it) that you have tried? There is an example showing the audio configs on Linux over here: https://trac.ffmpeg.org/wiki/Capture/Desktop

If you need audio too, you can use ALSA (see Capture/ALSA for more info):
ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+100,200 -f alsa -ac 2 -i hw:0 output.mkv

I'll look into updating the gem with this feature very soon.

@sh3p42d
Copy link

sh3p42d commented Nov 25, 2019

Thank you for efficiency.
I want to run this command "ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+100,200 -f pulse -ac 2 -i default output.mp4"

This is my configs:

advanced = { 
    input: {
        video_size: '1024x768',
        framerate: '25',
        ac: '2'
    }
}
@recorder = ScreenRecorder::Desktop.new(input: ':0.0+100,200 pulse default', output: 'output.mp4', advanced: advanced)

How can i set the advanced configs for '-f pulse -ac 2 -i default'? Every time I got 'Unable to find a suitable output format for'.

@kapoorlakshya
Copy link
Owner Author

kapoorlakshya commented Nov 28, 2019

@sh3p42d I just pushed some code which will allow you to record audio with the following configs:

advanced = { 'f': 'pulse', 'ac': 2, 'i': 'default' } # Uses default sound output device
@recorder = ScreenRecorder::Desktop.new(output: 'output.mp4', advanced: advanced)

You can test it in your current project by adding this to your Gemfile:

gem 'screen-recorder', git: 'https://github.com/kapoorlakshya/screen-recorder.git', branch: 'master'

And you don't need to provide an input value if you're not using multiple screens. The default is set to :0 which should work on most systems. You can check your input number by executing echo $DISPLAY in the terminal.

I'll implement a better solution to record audio when I have more free time. Let me know if you run into any problems.

@kapoorlakshya
Copy link
Owner Author

I have pushed some more code to properly support and document the configs for capturing audio: https://github.com/kapoorlakshya/screen-recorder/compare/15_capture_audio

Will merge it after testing it on Windows and macOS over the weekend.

@kapoorlakshya
Copy link
Owner Author

Closed by 1ba5e55.

@kapoorlakshya kapoorlakshya added this to the v1.4.0 milestone Jan 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants