wulkano / aperture Goto Github PK
View Code? Open in Web Editor NEWRecord the screen on macOS
License: MIT License
Record the screen on macOS
License: MIT License
We should check if aperture.main
and aperture.renderer
are called by the correct process.
The methods we are using to get the devices are now deprecated:
developer.apple.com/documentation/avfoundation/avcapturedevice/1390520-devices
Suggested is that we use https://developer.apple.com/documentation/avfoundation/avcapturedevice/discoverysession instead
AVFoundation allows specifying the codec used in a recording. It would be very nice to support this in Aperture so that it can be included in Kap's settings.
Need some simple test that confirms it works.
There is a $80.00 open bounty on this issue. Add more on Issuehunt.
- Checkout the Issuehunt explorer to discover more funded issues.
- Need some help from other developers? Add your repositories on Issuehunt to raise funds.
Is it possible to buffer raw data to web socket instead of recording? So it be capture with nodejs and stream to real time screen video
Since the latest commit I'm unable to build aperture.js
.
This is my package.json
:
[...]
"dependencies": {
"aperture.js": "https://github.com/wulkano/aperture.js.git#0d9e86c4ba9cfb2fa22fb8155878441a011d4079"
}
[...]
Now, if I run npm install
it works.
But when I change aperture.js
to the commit 2e485a65e10b6a8ed10b1cee96ae5717811febc4
it breaks with the following message:
The following build commands failed:
CompileSwift normal x86_64
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(2 failures)
npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/Cellar/node/6.2.1/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v6.2.1
npm ERR! npm v3.9.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build: `cd swift && xcodebuild && mv build/release/aperture main && rm -r build`
npm ERR! Exit status 65
npm ERR!
npm ERR! Failed at the [email protected] build script 'cd swift && xcodebuild && mv build/release/aperture main && rm -r build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the aperture.js package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! cd swift && xcodebuild && mv build/release/aperture main && rm -r build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs aperture.js
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls aperture.js
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! Please include the following file with any support request:
npm ERR! /Users/[TOP_SECRET]/Developer/[TOPSECRET]/[TOPSECRET]/node_modules/aperture.js/npm-debug.log
npm WARN optional Skipping failed optional dependency /7zip-bin/7zip-bin-linux:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN optional Skipping failed optional dependency /7zip-bin/7zip-bin-win:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN [TOP_SECRET]@0.1.0 No repository field.
npm WARN [TOP_SECRET]@0.1.0 No license field.
npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/Cellar/node/6.2.1/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v6.2.1
npm ERR! npm v3.9.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] postinstall: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'npm run build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the aperture.js package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs aperture.js
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls aperture.js
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
Before this output I got some errors with swift:
AVFoundation.AVCaptureFileOutputRecordingDelegate:133:17: note: protocol requires function 'captureOutput(_:didFinishRecordingToOutputFileAtURL:fromConnections:error:)' with type '(AVCaptureFileOutput!, didFinishRecordingToOutputFileAtURL: NSURL!, fromConnections: [AnyObject]!, error: NSError!) -> Void'
public func captureOutput(captureOutput: AVCaptureFileOutput!, didFinishRecordingToOutputFileAtURL outputFileURL: NSURL!, fromConnections connections: [AnyObject]!, error: NSError!)
^
/Users/[TOP_SECRET]/Developer/[TOP_SECRET]/[TOP_SECRET]/node_modules/aperture.js/swift/aperture/Recorder.swift:59:18: error: value of type 'AVCaptureMovieFileOutput' has no member 'startRecording'
self.output?.startRecording(toOutputFileURL: self.destination, recordingDelegate: self);
(For example)
Related PR's:
Initial support for Windows capture with Aperture.CLI (#56)
Initial Windows support (#38)
Edit from @skllcrn:
We've thought a lot about this and have decided to focus our efforts on macOS. That means that we will not officially support or maintain Aperture or Kap on other platforms.
This is free and open-source side project for us which we do to learn and have fun, the fact of the matter is that we're not currently motivated to maintain these projects on other platforms. That might change in the future, but for now we're giving the lead to the community. We encourage a fork of Aperture to support other platforms, we'd even encourage you to use the Aperture name, as long as as you develop it to maintain API parity and share our focus on performance and quality.
I am using Aperture through Aperture-Node to create simple screen recordings.
When I run the code to list all the available screens, all of them show up as Unknown screen
.
[ { id: 1, name: 'Unknown screen' } ]
Is there a way to improve this so that it shows something more valuable?
I am on macOS 12.3 with a M1 Max machine.
I'm trying to find something that would capture an area in a "space" even if this space is not currently visible on any monitors. Is it possible to do this by setting an appropriate crop area? Happy to try and contribute some code if you have an idea on how this could be implemented.
Top/left support would be extremely useful in some situations.
There is a $80.00 open bounty on this issue. Add more on Issuehunt.
- Checkout the Issuehunt explorer to discover more funded issues.
- Need some help from other developers? Add your repositories on Issuehunt to raise funds.
I've been trying to get the example to run, but it's proving difficult.
It keeps getting stuck at line 20: print("Failed to initialize")
After digging around some, I can confirm that I have read/write permissions, the destination URL is valid, I can pick up the iPhone's ID, it just keeps failing.
I've attached the output logs below, but I don't think these are really problems.
I also tried using the screen recording, instead of a iOS device, but that didn't work either, failing to initialize as well. The app has access to the systemβs camera/microphone.
I was able to capture the screen with Aperture-Node, but Iβm looking to using Aperture as part of my Swift native app.
Lastly, why would the example script be about recording an iOS device, when this was made to record the Mac's screen? There's hardly any info regarding Mac/AVFoundation, so I feel like there should at least be an example for macOS as well. I know it's trivial, but it could go a long way for others.
2021-03-30 15:10:35.333166-0700 Aperture_Test[6323:393386] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x6000028f2500> 30010C1C-93BF-11D8-8B5B-000A95AF9C6A
2021-03-30 15:10:35.337822-0700 Aperture_Test[6323:393386] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x6000028f8600> F8BB1C28-BAE8-11D6-9C31-00039315CD46
2021-03-30 15:10:35.463648-0700 Aperture_Test[6323:393386] [] CMIOHardware.cpp:379:CMIOObjectGetPropertyData Error: 2003332927, failed
2021-03-30 15:10:35.463685-0700 Aperture_Test[6323:393386] [] CMIOHardware.cpp:379:CMIOObjectGetPropertyData Error: 2003332927, failed
2021-03-30 15:10:35.463702-0700 Aperture_Test[6323:393386] [] CMIOHardware.cpp:379:CMIOObjectGetPropertyData Error: 2003332927, failed
Hey π ,
i'm very new in this topic (which node packages and stuff).
But it is possible to distribute a binary of aperture
instead of the source code?
Currently we have to run it on a macOS machine (or at least on a machine which support swift
and xcodebuild
) because we compile the swift code at [npm|yarn] install
time.
I'm currently experimenting with BitBucket Pipelines which doesn't support macOS builds ATM.
Which means I can't use my app with aperture
it :(
So it would be great if you can distribute binarys! π
Thank you π¨
In electron you can use getUserMedia on all platforms, why is this better?
I've recently reported a bug in Electron regarding a serious low frame rate using desktopCapturer API: electron/electron#8278
Seems that this project will save my life, but since the app I'm working on needs to be able to choose any open window as a recording source and I did not find anything in the documentation, I wonder if this can be accomplished somehow.
Does this feature exist or are you planing to include it?
Thanks.
Looks like kap
is MIT, but didn't want to assume the same for this project? Thanks.
In the JavaScript and Swift code.
From ac3dcc4#commitcomment-20097149:
I've tried passing a cropRect into the init, but the output video is still 3686x2304. I have my display scaling set to 1920x1200, when I run
self.globalAperture = try! Aperture.init(destination: self.documentDirURL.appendingPathComponent(name).appendingPathExtension("mp4"), framesPerSecond: 60, cropRect: NSScreen.main?.frame, showCursor: true, highlightClicks: true, audioDevice: nil)
the NSScreen.main?.frame returns (0,0,1920,1200) so I'm not sure where the 3686x2304 is coming from. When running, I get an error that says 'CMIO_Unit_Convertor_VideoToolboxCompressor.cpp:2367 cmio assert: "!mInitialized" at NotWritable - (err=0)' but I haven't been able to find much about this. And it still records the video, so I'm not sure exactly what the issue is. Is there a better way to pass in desired output resolutions?
I hope you are not hating me right now for asking for many things, but I'm having serious issues with my project and this module is still my main option to move forward.
By any chance, is there an easy way to output video chunks to stdout so I can easily pipe to ffmpeg and fix moov atom (progressive download or faststart, whatever it's called)?
I'd appreciate if you can give me a hint.
Thanks!
Why this module does not allow macOS < 10.12 by default? I tested it on El Capitan (10.11) by editing the module file and it works like a charm.
See the previous effort in #67.
Is it possible to use aperture without node.js? I want to use it in my native macOS app or is there a better library for that?
From: #48 (comment)
Either assign after init or add a convenience init that accepts an Options
struct.
The screen recording capabilities of this macOS implementation is incredibly impressive.
Would it be possible to add the ability to record Webcams as well with this method to be able to efficiently create "RAW" recordings of screen and webcam, in separate files, right from the CLI?
I am currently using ffmpeg
for the webcam and Aperture
for the screen, but would love to be able to use even less CPU for this.
Cheers.
Must have some tests. Not the easiest thing to test, but I'll put something together soon.
I'd like to know what's the displayId
if I'm not using the default main display.
Can I get the display IDs list as audio like using aperture.audioDevices()
?
Hey! Great work on this library. I was trying to use Electron own screen recording and this is way more performant. Is there a way to specify the path where I want to save the recording? Would be great if I could pass that as an option when starting the recording. I see you are using the tmp
package for creating the directory in a tmp folder. Is there a performance reason behind using a temporary folder and not a custom path?
Thanks!
I'm using github as dependency since npm has the same version but with different source code and method getAudioSources is missing.
Thanks.
Would it be possible to record the internal audio (Sound effects, music, etc.)?
Need doc comments in the source code.
Kap works fine, but when I try to use aperture directly I get this error:
/path/to/project/node_modules/semver/semver.js:293
throw new TypeError('Invalid Version: ' + version);
^
TypeError: Invalid Version: 10.13
at new SemVer (/path/to/project/node_modules/semver/semver.js:293:11)
at compare (/path/to/project/node_modules/semver/semver.js:566:10)
at Function.gte (/path/to/project/node_modules/semver/semver.js:615:10)
at Function.x.isGreaterThanOrEqualTo.input [as isGreaterThanOrEqualTo] (/path/to/project/node_modules/macos-version/index.js:46:16)
at Function.x.assertGreaterThanOrEqualTo.input [as assertGreaterThanOrEqualTo] (/path/to/project/node_modules/macos-version/index.js:56:9)
at new Aperture (/path/to/project/node_modules/aperture/index.js:12:18)
at module.exports (/path/to/project/node_modules/aperture/index.js:118:24)
at Object.<anonymous> (/path/to/project/screencapture.js:2:37)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
Hi.
At first thanks for this library. The produced video with default settings (default bitrate) is too big, we needed to make the filesize smaller. I was unable to specify video bitrate in existing aperture code, so i did a little library rewrite based on some projects I have found on internet. It is working for us, we are able to specify audio/video bitrate now. Feel free to reuse and integrate changes in this commits. https://github.com/Matho/aperture/commits/master
Martin
Hey please add the steps for implementing this in Mac .
was looking through the apis, can't tell, but could I just record an Audio stream and save that as an audio file like mp3?
Hi aperture team, I know you've put in a lot of work on the swift screen capture code. Neat stuff btw. I only found the project because I was googling around to see if anyone else had made an electron app for camera and screen recording. I'm currently working on my own version.
I wanted to share my ffmpeg tests with you guys. I've been working on simultaneous webcam and screen recording and haven't encountered any CPU hogging like you guys report in the main readme file for aperture. I started investigating to see what our differences were.
It looks like the main difference is with the preset used for encoding. By default ffmpeg will use a value of -preset medium
However, I have been using a value of -preset ultrafast
This gives larger files, but worth it if you're concerned about CPU usage. The presets control the encoding speed-to-compression ratio. So the medium
preset is compressing more, and using more of your cpu.
ffmpeg -y -thread_queue_size 50 -f avfoundation -framerate 30 -i 1:0 -c:v libx264 -preset ultrafast -r 30 ./ScreenTest1.mp4
ffmpeg -y -thread_queue_size 50 -f avfoundation -framerate 30 -i 1:0 -c:v libx264 -preset medium -r 30 ./ScreenTest2.mp4
Again, just wanted to share these tests in the hopes that I can help in some small way. It would be nice to use ONLY ffmpeg because then you'd have more cross platform opportunities.
I've started the work in ce2e228.
We still need to add support for recording the iOS screen. It's not considered a screen, but rather a normal video input, so we need to add some custom logic for that.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.