Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
How do I access my default video camera on my mac? I know on Linux it is /dev/video0 but my Mac does not have that. I'm trying to capture my webcam into ffmpeg
ffmpeg -i /dev/video0
But it won't work because /dev/video0 doesn't exist.
You can achieve this by using VLC's qtcapture (QTKit) or avcapture (AVFoundation) module introduced with VLC 2.0.0 and
Try this via command line - Note: you still need to hit play i guess:
QTCapture (using the QTKit Framework)
VLC.app/Contents/MacOS/VLC -vvv qtcapture://
AVCapture (using the AVFoundation Framework)
VLC.app/Contents/MacOS/VLC -vvv avcapture://
You can also control this via GUI: VLC -> File -> Open Capture Device...
Also if you really want to have control over things you can look into AVFoundation Framework or the older QTKit Framework to access your camera (video/audio devices) programmatically.
If you have trouble finding devices try to debug it by finding out if the device is actually recognized by VLC. The verbose output through the terminal or the Log View in GUI mode should show you which devices are actually available:
here's the documentation for macOS:
OS X users can use the avfoundation and qtkit input devices for
grabbing integrated iSight cameras as well as cameras connected via
USB or FireWire:
AVFoundation is available on Mac OS X 10.7 (Lion) and later. Since
then, Apple recommends AVFoundation for stream grabbing on OS X and
iOS devices. QTKit is available on Mac OS X 10.4 (Tiger) and later.
QTKit has been marked deprecated since OS X 10.7 (Lion) and may not be
available on future releases.
here's an example using linux, but it can be done with the above link just as easily with macos.
My impression is that it's hard to impossible. Apple locked it down quite a bit. There's the nearly unfindable iSightCapture which apparently only works when run directly on the command line (used to work fine in scripts before 10.4, but Apple blocked that), and I think it only takes images, not video.
Considering someone wrote that, it should be possible to access it programmatically, but iSightCapture is not open source, and I haven't been able to find how to do it myself. Though I admit I gave up pretty quickly once I realized it's clearly not a standard webcam.
Related
To reproduce the problem you can use the JavaFX sample project AdvancedMedia. Replace the flv video with a mp4 one which encoding type is supported by JavaFX.
Edit: I thought maybe people are having trouble to edit the sample. Just place a video in the project root folder and set MEDIA_URL to new File("video.mp4").toURI().toString().
It works great on Windows platforms. However, on Mac the video stutters in the beginning and before it ends. When running the project on terminal with java -jar AdvancedMedia.jar it shows the following messages:
AVF info: checkDecoderUsage, vaCodecString: <Gen6>
AVF info: pp_hw_name: RenderingEngine, id: 3ea, m_pp_nowait: 1
AVF info: RingBufferPool wr:0, rd:108, reset:93, warning:0
I saw this error occurs with MacBook Pro, Air, i5/i7 processors etc. Is there any way to solve the stuttering/error messages?
I tested running with -Dprism.verbose=true and I saw a major difference between Windows and Mac platforms: on Windows the Prism platform init order is d3d sw while on Mac it is es2 sw; the Prism pipeline name is com.sun.prism.d3d.D3DPipeline and com.sun.prism.es2.ES2Pipeline respectively.
Maybe a possible solution is to use the same D3D pipeline on Mac? But if running with -Dprism.order=d3d,sw it gives java.lang.ClassNotFoundException: com.sun.prism.d3d.D3DPipeline.
I also tried to increase JVM memory with the -Xms option but it had no effect. So it really seems to be a codecs issue even though the videos play smoothly on other platforms.
I was testing a Windows generated jar on Mac, so now I also tried to build the AdvancedMedia example on Mac thinking it could make some difference, but nothing changed.
It seems that maybe this is more like a JavaFX bug report than a question.
A little off-topic, but I have to say that before this I tried C++ and VLCj approaches for my application and I changed it only because of Mac functionality issues...
I found out that this bug happens on Mac with any H.264 encoded video, regardless of the file extension. So as described on the docs, the only other alternative JavaFX offers is to use VP6 encoding, which is not easy to get - see my other question - but at least the videos will run smoothly and without any rendering error messages.
Having my webcam plugged in, I'm able to manipulate the video/audio stream in my MAC OS app.
Now I'd like to output it as a new virtual video/audio device that I can select as a camera input in apps like "Skype" or QuickTime.
I've looked into i/o kit framework and the reference webpage says this:
"To add digital video capabilities to your software, use the QuickTime
APIs."
I believe this needs to be updated because QuickTime APIs have been replaced by CoreMedia IO.
So I looked into CoreMediaIO and found a sample code from Apple dev website that also is obsolete and won't run on XCode 7.x with OS Yosemite+.
I've also looked in AVFoundation but it seems like a dead end.
I'm lost at this point. I know it's doable since CamTwist software is doing it.
Anyone has an idea how to approach this?
CoreMediaIO is definitely the way to go, as that's what Apple currently uses in its hardware. On my system (2015 rMBP), /Library/CoreMediaIO/Plug-Ins/DAL/ contains AppleCamera.plugin and iOSScreenCapture.plugin, for the webcam and capturing from iDevice.
I assume the example you're referring to is this one?
It doesn't quite compile out of the box, but I got it to build with the OSX 10.11 SDK eventually. You need Apple's Core Audio Utility Classes, point the 'Sources/Extras/CoreAudio/PublicUtility' group in the Xcode project at those, and then fix a variable initialisation (remove the = NULL where it complains about a private constructor) and comment out a few lines in SamplePrefix.h. I haven't run it, but I see no reason why it wouldn't. If you don't have a kext signing certificate, you may need to take steps to load unsigned kexts to run the sample.
Is your webcam using the old video-digitaizer driver (driver .component file is located in /Library/QuickTime)? I was able to see my UVC-camera and DAL camera in QuickTime player. My understanding is that Apps written in AVFoundation will not recongize old vdig driver. On the contrary, Apps written using Sequence Grabber (very old) / QTCapture (old) will recongize your device.
Hope this helps.
I'm new to Mac programming and am really getting confused on what is the correct way to capture any webcam.
Learnt:
On Windows - Directshow filters are the only recommended way.
On Mac, there are atleast three frameworks. This is what I've understood by searching through the forums. Please correct me if I am wrong.
QuickTime - 32 bit applications only
QTKit - 64 bit applications only
AV Foundation - OS X 10.7 and above.
(I've gone through some posts which said - when QTKit is used, some webcams were not even recognized. But did't understand what to do)
Requirement: Capture any Webcam (internal or external - any vendor) on Mac OS X 10.7 and above in a 64 bit application, which is built on OS X 10.6 (due to large chunk of frameworks not migrated to Xcode 4 at the current moment code has to be built on Xcode 3.2.5 on OS X 10.6. We are planning to migrate to Xcode 4, but it takes more time and cant fit it in the current release schedule). So, I cant use AV Foundation.
Question: If we use QTKit alone, will the application be able to capture all webcams? Or some webcams with 32 bit drivers or drivers which support only AV Foundation fail? Is the right way to capture on Mac is to implement the capture functionality using all three frameworks?
I was under the impression that AV Foundation doesn't support third-party codecs. If I try to open an Avid DNxHD QuickTime movie in my application it doesn't work, as expected.
However, if I open a DNxHD movie in QuickTime Player X (which also uses AVF) it opens and plays back fine and even says it's a DNxHD in the Info window.
Does anyone know how Apple is achieving this?
I believe that QuickTime Player X is built on QT X, not on top of AVF. In fact, I think it uses (something like) QTKit, which will launch a 32-bit proxy process if necessary to open files that are only supported by 32-bit codecs.
You can access QT X via the QTKit framework, if you specify the 'playback only' attribute when you open the file, but then you can only play it back (as the flag suggests!). Even enumerating the number of tracks will fail. If you don't specify playback-only, then you are limited to QT7 components, accessed via a 32-bit proxy if your app is 64-bit.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 months ago.
The community reviewed whether to reopen this question 2 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
Having been caught out recently when a web site I launched displayed perfectly on IE, Firefox, Chrome and Safari on Windows but was corrupted when viewed using Safari on the Mac (by a potential customer), I need to start testing how my sites look when viewed on a Mac.
Problem is, I don't own a Mac.
I've tried BrowsrCamp, which claims to provide VNC access to a Mac with lots of browsers installed, but after finding it unreliable (so far, it's worked 1 day in the last 5) I need another solution.
Any suggestions?
The best site to test website and see them realtime on MAC Safari is by using
Browserstack
They have like 25 free minutes of first time testing and then 10 free mins each day..You can even test your pages from your local PC by using their WEB TUNNEL Feature
I tested 7 to 8 pages in browserstack...And I think they have some java debugging tool in the upper right corner that is great help
For my case (a small, personal project) https://www.lambdatest.com/ was very helpful. Free tier allows for 6 sessions per month.
Meanwhile, MacOS High Sierra can be run in VirtualBox (on a PC) for Free.
It's not really fast but it works for general browser testing.
How to setup see here: https://www.howtogeek.com/289594/how-to-install-macos-sierra-in-virtualbox-on-windows-10/
I'm using this for a while now and it works quite well
You don't have to pay for those online service and still be able to use latest Safari for free with these choices:
A) Install VMware 🧡
Use Google to find VMware + free MacOs ISO image. This solution is significantly faster than VirtualBox.
B) Install VirtualBox and download free MacOS High Sierra image
See tutorial here: https://www.wikigain.com/install-macos-high-sierra-virtualbox-windows/
Use these vbox settings to increase resolution and memory, but it is still very laggy and slow:
cd "C:\Program Files\Oracle\VirtualBox\"
VBoxManage setextradata "macOS" VBoxInternal2/EfiGraphicsResolution 1920x1080
VBoxManage modifyvm "macOS" --vram 256
If it's a major concern to start doing a lot of testing on a Mac, then I would definitely suggest buying a second hand Mac, or perhaps building a Hackintosh. The former gets you up and running quickly, the latter gives you a lot of power for the same price.
For just the odd piece of testing, running OS X in VMWare on your current PC is a cheaper option.
Unfortunately you cannot run MacOS X on anything but a genuine Mac.
MacOS X Server however can be run in VMWare. A stopgap solution would be to install it inside a VM. But you should be aware that MacOS X Server and MacOS X are not exactly the same, and your testing is not going to be exactly what the user has. Not to mention the $499 price tag.
Simplest way is to buy yourself a cheap mac mini or a laptop with a broken screen used on ebay, plug it onto your network and access it via VNC to do your testing.
Amazon AWS recently launched macOS EC2 instances.
As of now (Dec 2020) they are pretty pricey, you have to reserve them minimum for 24h.
You can connect to the instance via VNC (sample guide for connecting from Windows) and test your browser.
https://turbo.net/ offers a browser sandbox in which containerised virtual machines run browser sessions for you. I tried it with Safari on my Windows development machine and it seems to work very well.
Litmus may help you. It will take screenshots of your webpage(s) in a wide variety of browsers so you can make sure that your site works in all of them. A free alternative (Litmus is a paid service) is Browsershots, but you do get what you pay for. (In some screenshots that Browershots returns, the browser hasn't yet finished loading the webpage...)
Of course, as other people have suggested, buying a Mac is also a good solution (and may be better, depending on the kind of testing you need to do), because then you can test your website yourself in any of the browsers that run under Mac OS X or Windows.