Giter VIP home page Giter VIP logo

chrome-audio-capturer's Introduction

Chrome Audio Capture

Chrome Audio Capture is a Chrome extension that allows users to capture any audio playing on the current tab. Multiple tabs can be captured simultaneously. Completed captures will be downloaded to the chrome downloads folder and will be saved as .wav or .mp3 files. Users will have the option to mute tabs that are currently being captured.

Chrome Audio Capture is available in the Chrome Store

Hotkeys for Windows:

  • Ctrl + Shift + S: Start capture on current tab
  • Ctrl + Shift + X: Stop capture on current tab

Hotkeys for MAC:

  • Command + Shift + U: Start capture on current tab
  • Command + Shift + X: Stop capture on current tab

The main interface of the extension

start

Interface during capture

capturing

Options

options

Several options are able to be changed in the extension:

  • 'Mute tabs that are being captured' allows the extension to force any tabs currently being captured to be muted on the system's audio output, but still have its audio captured and encoded to the resulting file.
  • 'Maximum capture time' changes the amount of time the extension will capture audio for before timing out, and has a limit to prevent exceeding Chrome's memory limit.
  • 'Output file format' allows users to choose whether the resulting file will be encoded into .wav or .mp3
  • 'MP3 Quality' is only applicable for .mp3 encodings, and will change the bitrate of the encode. (Low: 96 kbps, Medium: 192 kbps, High: 320 kbps)

Implementation Details

Capturing Audio

To capture the audio in the current tab, I used the chrome tabCapture API to obtain a MediaStream object of the current tab. Next I used the MediaStream object to initialize a recorder that will encode the stream into a .wav file using the Recorder.js library.

chrome.tabCapture.capture({audio: true}, (stream) => {
  let startTabId;
  chrome.tabs.query({active:true, currentWindow: true}, (tabs) => startTabId = tabs[0].id)
  const liveStream = stream;
  const audioCtx = new AudioContext();
  const source = audioCtx.createMediaStreamSource(stream);
  let mediaRecorder = new Recorder(source);

Tab Management

To allow audio capture on multiple tabs simultaneously, I stored the tabId of each tab being captured into the sessionStorage object. When a stopCapture command is issued, the extension will check whether the current tab is the same as the tab that the capture was started on, and only stop the specific instance of the capture on the current tab.

const stopCapture = function() {
  let endTabId;
  chrome.tabs.query({active: true, currentWindow: true}, (tabs) => {
    endTabId = tabs[0].id;
    if(mediaRecorder && startTabId === endTabId){
      mediaRecorder.stop();
      mediaRecorder.exportWAV((blob)=> {
        const audioURL = window.URL.createObjectURL(blob);
        const now = new Date(Date.now());
        const currentDate = now.toDateString();
        chrome.downloads.download({url: audioURL, filename: `${currentDate.replace(/\s/g, "-")} Capture`})
      })

Audio Playback During Capture

By default, using tabCapture will mute the audio on the current tab in order for the capture to take place. To allow audio to continue playing during the capture, I created an Audio object which has its source linked to the ongoing stream that is being captured. In the options menu, users will have the option to keep the tab muted or unmuted during the capture.

chrome.storage.sync.get({
  muteTab: false
}, (options) => {
  if(!options.muteTab) {
    let audio = new Audio();
    audio.srcObject = liveStream;
    audio.play();
  }
});

License

This extension uses LAME MP3 encoder, licensed LGPL. Everything else is under the MIT License.

Future Work

  • Ability to cut parts of the audio off before saving
  • Ability to pause and resume captures

chrome-audio-capturer's People

Contributors

arblast avatar londane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chrome-audio-capturer's Issues

Capture audio input + output?

Hi there, thanks for building this great chrome extension!

Is it possible to add a feature to capture the web audio input and output so I get two separate files of the input and output audio? I am asking as i would like to capture a conversation in a video conferencing call.

Audio quality fix - Help!

Hi!

My team and I have been using the Chrome Audio Capture extension for a while and for some reason, on some computers, the recording has distortions or bad quality. We were wondering if you had any idea why this happens, or if there are some settings we could check out in our computers to fix the problem. I believe most problems were on Mac, but we also had some on Windows, and other member of the team use Mac and it works fine.

Thanks a lot!

Editing The Extension

How can I use JavaScript code to control when to start and stop recording instead of button?
Is it possible?

Thanks

Crop - Suggestion

I'm back. :)
The last and final suggestion to the extension get even more perfect would be a auto crop or let the user crop the recording and remove the silence at the beginning and at the end that usually happen.
Maybe when encoding to mp3 it's possible to verify the silence.
Thank you again for the best Chrome Extension ever!

How to trigger it programatically?

Is there a way to trigger the start/stop of the recording and set the name of the output file from the console? I want to trigger it multiple times in the same page

MP3

Any plan to add the possibility to save as .mp3?

Hotkey for stopping does not work on Mac

Chrome v 96.0.4664.55 (official build), no other Chrome extnsions installed
MacOS 10.14.6

Hotkey for starting (cmd + shift + u ) works
Hotkey for stopping (cmd + shift + x) has no effect
Manual stopping via extension button with mouse works.

Up front file name and location capture

You have some nice features to mute tabs, and have multiple streams captured at the same time.

But it would be very, very nice, to capture the file name and location/destination up front so the capture could be saved when it is done, and not just site there.

Would that be possible, or too difficult a trigger to set up?

Thanks!

Chrome Audio Capture panel responds to no mouse nor keyboard events

Sometimes, but not always, clicking on the Save Capture button produces no action. In other words, although the Save Capture button has been clicked, the count of captured minutes and seconds continues to advance, and no new tab opens with a progress bar showing how the audio file is progressively being saved.

Indeed, no mouse nor keyboard action has any effect on the Chrome Audio Capture panel. Events (or actions) that have no effect include:

  • Clicking the Cancel Capture button,
  • Pressing [Ctrl + Shift + X] keys on the keyboard, or
  • Pressing [Ctrl + Shift + S] keys on the keyboard.

What could cause this behavior (or non-behavior)? How does one avoid it?

Chrome Audio Capture does not Save Capture when that button is clicked - Screenshot 2023-12-05 130807

Change hotkeys

A nice features would be changing the hotkeys. Are you interested in implementing this or a pull request?

Chrome Audio can't access files

Chrome audio stopped saving...i.e...once you press save file, it cannot open my file system to save and gets stuck. Any way to fix it?

Choose WAV or MP3 after recording, not via options

When I'm sampling something for my DAW, I want WAV. If I'm sampling something to share with friends on Discord, say, I want MP3. I'm constantly going into settings to change the format.

A much better design IMO would be to let the user pick format after recording, rather than via settings.

ScreenShot

I see the last update to this project was 4 years ago. If you don't feel like implementing this but think it's a worthwhile change, I could make the change and issue a pull request. If you're not accepting pull requests, let me know and I'll just build my own version.

Time limit

Hi,
After long time search i got a perfect solution for this plugin.
But its a time limit for only 20 mints. if increase to 2 hrs it would be great for me.
Kindly accept my request and give a solution for me.

Thank you

sarathi

Not capturing all the sites

Hey thanks for this great effort.
I just tried to capture audio from this website but didnt work. But on youtube and other sites it works fine. Any clue how can this be fixed? Thanks.

change the time I would like

Hello, I need to increase the limit by 20 minutes of acquisition to about 1 hour and leave the computer to record for about 1 hour. It's possible? thank you so much.

Host Audio Files on Server - Suggestion

To circumvent the memory limitations, have you considered uploading the clips to a server whenever they max out?

At the end of the recording period the user would be prompted to download the result. The Cadillac solution would return a single file but I'd be thrilled with a zip of 20 minute clips.

I wish I could commit time to helping but I'd happily pay for the "premium" feature as a consolation.

Theoretical stuffs

Is it only the Chrome Web Store that doesn't allow extensions for record audio from places like YouTube?

If so, does that mean that Chrome fully allows a Javascript call to record audio from places like YouTube?

Not that I would download and modify your extension for my personal use or anything. ;)

h

valkyrie.mp4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.