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

can not find iphone devices which I plugged into my mac #11

Closed
krisdyZJU opened this issue May 20, 2016 · 22 comments · Fixed by #23
Closed

can not find iphone devices which I plugged into my mac #11

krisdyZJU opened this issue May 20, 2016 · 22 comments · Fixed by #23

Comments

@krisdyZJU
Copy link

krisdyZJU commented May 20, 2016

actually I want to use this command line tool to capture video of my iphone which I plugged into my mac when I do some manipulations on it, but after I execute videosnap in my mac: ./video -l, it only list my facetime HD camera, but no my iphone, but I can see my iphone when I open quicktime, any suggestions,thanks.

2016-05-20 11 27 28

@matthutchinson
Copy link
Owner

matthutchinson commented May 20, 2016

So the reason for this is, I still haven't updated videosnap to use the AVFoundation framework. The command is still using the old QTKit libraries.

I had started an av-foundation branch a while ago, but many things have got in the way and I haven't had the time I'd like to devote to this. As soon as it's release I'll update this issue to notify you..

@brooksc
Copy link

brooksc commented Jul 19, 2018

+1 for this request -- found videosnap as I was looking for an alternative to the broken and abandoned xrecord project... https://github.com/WPO-Foundation/xrecord/issues . Please let us know if you add ios recording! I often capture ios videos for bug reports and I'd love to automate this!

@aryalakshmi
Copy link

Is there any update on this issue? Will it work now for iphones connected to mac?

@matthutchinson
Copy link
Owner

matthutchinson commented Aug 29, 2018

Sorry I haven't had time to work on this project for a while, pull requests are always welcome!

@muuuh
Copy link

muuuh commented Aug 13, 2020

https://stackoverflow.com/a/32703158

It seem to work somehow with this patch:

#import <CoreMediaIO/CMIOHardware.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        CMIOObjectPropertyAddress prop = {
            kCMIOHardwarePropertyAllowScreenCaptureDevices,
            kCMIOObjectPropertyScopeGlobal,
            kCMIOObjectPropertyElementMaster
        };
        UInt32 allow = 1;
        CMIOObjectSetPropertyData(kCMIOObjectSystemObject, &prop, 0, NULL, sizeof(allow), &allow);
    }

@matthutchinson
Copy link
Owner

Thanks @muuuh for this suggestion!

I've just released v0.0.5, you should now be able to capture from any attached iOS device!

Here's an example capture from my iPhone X at -p High quality

@guptapunit
Copy link

guptapunit commented Mar 8, 2021

Hi, the videosnap -l command does not list my connected iPhone i am using the latest version.

Attaching the logs below if it helps, do let me know if i am doing something wrong of if there are some permissions to be enabled/disabled either on the device or the mac.

Punits-MacBook-Pro:bin punitgupta$ videosnap -l
Found 1 available video devices:
* FaceTime HD Camera
(base) Punits-MacBook-Pro:videosnap-main punitgupta$ videosnap -h
VideoSnap (0.0.6)

Record video and audio from a capture device

You can specify which device to capture from, the duration, encoding and a delay
period (before capturing starts). You can also disable audio recording.
By default videosnap will capture both video and audio from the default capture
device at 30fps, with a Medium quality preset and a short (0.5s) warm-up delay.

If no duration is specified, videosnap will record until you cancel with [Ctrl+c]
You can also use videosnap to list attached capture devices by name.

  usage: videosnap [options] [file ...]
example: videosnap -t 5.75 -d 'Built-in iSight' -p 'High' my_movie.mov

  -l          List attached capture devices
  -w x.xx     Set delay before capturing starts (in seconds, default 0.5s)
  -t x.xx     Set duration of video (in seconds)
  -d device   Set the capture device (by name, use -l to list attached devices)
  --no-audio  Don't capture audio
  -v          Turn ON verbose mode (OFF by default)
  -h          Show help
  -p          Set the encoding preset (Medium by default)
                High
                Medium (default)
                Low
                640x480
                1280x720

As you can see the version is 0.0.6.
The Version of Mac OS i am trying this on is Big Sur 11.2.2.

Something I've noticed is that if I launch Quicktime Player, select New Movie Recording and select my device as a Camera source, then my device is listed when i run the " videosnap -l " command.

@matthutchinson
Copy link
Owner

I've replicated the issue here, same problem; and if I close Quicktime Player, the device is no longer listed.
I've re-opened this issue for now.

When I have some time available I'll try to investigate further.

@vrbajiva
Copy link

vrbajiva commented Sep 9, 2021

Hi! 🙂 Sadly, I encountered this issue too.

Connected iOS devices are not listed using videosnap -l (while QuickTime is running), although I can see them listed in QuickTime video sources.

MacBook Air (M1, 2020)

@IGPenguin
Copy link

IGPenguin commented Sep 16, 2021

Hey @matthutchinson, I know you are probably quite busy lately as we all are, but this is a huge opportunity to fix a problem potentionaly affecting hundreds of M1 chip Mac users.

You can really make a difference by providing efficient command line solution to iOS device screen recording for many of the Mobile Toolkit users as well as all of those using your Videosnap tool on latest Macbooks.

Please take a quick look at this issue, maybe there is a simple hotfix just waiting for your action.

Thank you for your time and all your priceless contributions to our community.

@matthutchinson
Copy link
Owner

I'll try to investigate this weekend, or early next week.

@IGPenguin
Copy link

Hello @matthutchinson, any news on this issue? 🥺

@matthutchinson
Copy link
Owner

I worked on this today and have a fix, will release a new version (0.0.7) and explain more soon. This isn't an M1 specific issue.

@IGPenguin
Copy link

Cool, thank you very much for your effort!

Looking forward to new update. 🤞

matthutchinson added a commit that referenced this issue Oct 19, 2021
* Refactor how verbosity is set (now up front in initWithVerbosity)
* Use AVCaptureDeviceDiscoverySession (macOS >= 10.15)
* Default device now chosen from first discovered device
* Reword man and help slightly
* Release built for M1 & Intel (Any mac)
* Fixes #11
@matthutchinson
Copy link
Owner

Still having some intermittent issues with this.. looking into it further

@matthutchinson
Copy link
Owner

matthutchinson commented Oct 22, 2021

OK, please try this new release and let me know (on Intel and/or M1).

This works for me (Intel and M1), but I have noticed that if I run the command quickly in succession, it can sometimes fail to pick up connected devices for screen capture.

After (a LOT) of debugging and googling, I've traced this down to a Kernel error thrown when macOS attempts to connect to the DAL assistant to grab a port to communicate with the virtual capture device.


NOTE: when capturing the device will not output any audio, but audio will be recorded to the movie file.

Also note, the --no-audio flag won't work when recording from an attached device - for now just mute the device if you want that. This is down to the fact that the virtual capture device that AVFoundation sees for this is a muxed device type.

@matthutchinson
Copy link
Owner

If you continue to have issues, please add -v to your command and paste your output here, along with device and macOS version #'s

@matthutchinson
Copy link
Owner

matthutchinson commented Oct 22, 2021

I've added this section to the README explaining the following...

Capturing from connected iOS devices

It is possible to screen capture video & audio from an attached iOS device.

For the device to be discovered you must confirm that you
Trust This Computer on the device when it is connected and unlocked.

There are some limitations and issues with iOS screen capturing.

  • (issue) the --no-audio flag currently has no effect (workaround: mute the device)
  • (issue) currently broken on M1 macs (due to this error)
  • (limitation) when capturing, the device will not output any audio (but audio will be recorded to the movie file)
  • (limitation) occasionally the device fails to be discovered, this can happen when
    • another process is already capturing from the device
    • the macOS kernel fails to connect to the DAL assistant to communicate with the virtual capture device

@matthutchinson
Copy link
Owner

matthutchinson commented Oct 22, 2021

So turns out while the device is now recognised OK on M1 Macs (and listed OK), capturing fails, with this error - this seems to be an Apple issue.

It is possible to record/screen capture via Quicktime Movie recording, so this must be do-able. I think the best course of action is to rewrite this project in Swift, using more up-to-date framework classes, and adhering to the latest guidelines in the AVFoundation documentation.

@IGPenguin
Copy link

Hi @matthutchinson so there are still some issues on M1 after all. I am not able to capture any recording. See the verbose output below:

(caught signal: [2])
(stopping recording)
(finished writing to movie file)
(stopping capture session)

Failed to capture any video
(reason: Cannot Record)

Are there any steps we can take to fix this, or everything we can do is to hope that Apple will resolve this somehow?
Also i think that this issue should be reopened, since it is not resolved for now.

@matthutchinson
Copy link
Owner

So the issue title/description here is based around

can not find iphone devices which I plugged into my Mac

That should now be resolved on M1 and Intel Macs. Capturing from a connected iPhone on an M1 Mac is currently broken, so we need another issue for that. Capturing from a connected webcam should work tho.

Can you pls create another issue and describe what's happening ... i.e. what command you're running and the output with -v flag on.

@IGPenguin
Copy link

IGPenguin commented Nov 26, 2021

Alright, im on it. 🤝

Edit: So I created following issue: #24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants