brutella / hkcam

Open-Source HomeKit Surveillance Camera
https://hochgatterer.me/hkcam/
Apache License 2.0
925 stars 141 forks source link

No stream from MacBook iSight #10

Closed MRvH88 closed 5 years ago

MRvH88 commented 5 years ago

When using my iSight cam on my MacBook I cannot get a stream to homekit, in terminal I receive the following message: [avfoundation @ 0x7fd349000000] Selected framerate (30.000000) is not supported by the device

It shows the following frame rates are possible: [avfoundation @ 0x7fd349000000] 1280x720@[29.970000 29.970000]fps [avfoundation @ 0x7fd349000000] 1280x720@[25.000000 25.000000]fps [avfoundation @ 0x7fd349000000] 1280x720@[23.999981 23.999981]fps [avfoundation @ 0x7fd349000000] 1280x720@[14.999993 14.999993]fps

Is it possible to change the frame rate? Or can it possibly be an other issue?

brutella commented 5 years ago

Does it work when you explicitly set the frame rate to 25 in stream.go like this?

fmt.Sprintf(" -framerate 25") +
MRvH88 commented 5 years ago

No still getting the same message:

[avfoundation @ 0x7fadd8000000] Selected framerate (30.000000) is not supported by the device [avfoundation @ 0x7fadd8000000] Supported modes: [avfoundation @ 0x7fadd8000000] 160x120@[29.970000 29.970000]fps [avfoundation @ 0x7fadd8000000] 160x120@[25.000000 25.000000]fps [avfoundation @ 0x7fadd8000000] 160x120@[23.999981 23.999981]fps [avfoundation @ 0x7fadd8000000] 160x120@[14.999993 14.999993]fps [avfoundation @ 0x7fadd8000000] 176x144@[29.970000 29.970000]fps [avfoundation @ 0x7fadd8000000] 176x144@[25.000000 25.000000]fps [avfoundation @ 0x7fadd8000000] 176x144@[23.999981 23.999981]fps [avfoundation @ 0x7fadd8000000] 176x144@[14.999993 14.999993]fps [avfoundation @ 0x7fadd8000000] 320x240@[29.970000 29.970000]fps [avfoundation @ 0x7fadd8000000] 320x240@[25.000000 25.000000]fps [avfoundation @ 0x7fadd8000000] 320x240@[23.999981 23.999981]fps [avfoundation @ 0x7fadd8000000] 320x240@[14.999993 14.999993]fps [avfoundation @ 0x7fadd8000000] 352x288@[29.970000 29.970000]fps [avfoundation @ 0x7fadd8000000] 352x288@[25.000000 25.000000]fps [avfoundation @ 0x7fadd8000000] 352x288@[23.999981 23.999981]fps [avfoundation @ 0x7fadd8000000] 352x288@[14.999993 14.999993]fps [avfoundation @ 0x7fadd8000000] 640x480@[29.970000 29.970000]fps [avfoundation @ 0x7fadd8000000] 640x480@[25.000000 25.000000]fps [avfoundation @ 0x7fadd8000000] 640x480@[23.999981 23.999981]fps [avfoundation @ 0x7fadd8000000] 640x480@[14.999993 14.999993]fps [avfoundation @ 0x7fadd8000000] 960x540@[29.970000 29.970000]fps [avfoundation @ 0x7fadd8000000] 960x540@[25.000000 25.000000]fps [avfoundation @ 0x7fadd8000000] 960x540@[23.999981 23.999981]fps [avfoundation @ 0x7fadd8000000] 960x540@[14.999993 14.999993]fps [avfoundation @ 0x7fadd8000000] 1024x576@[29.970000 29.970000]fps [avfoundation @ 0x7fadd8000000] 1024x576@[25.000000 25.000000]fps [avfoundation @ 0x7fadd8000000] 1024x576@[23.999981 23.999981]fps [avfoundation @ 0x7fadd8000000] 1024x576@[14.999993 14.999993]fps [avfoundation @ 0x7fadd8000000] 1280x720@[29.970000 29.970000]fps [avfoundation @ 0x7fadd8000000] 1280x720@[25.000000 25.000000]fps [avfoundation @ 0x7fadd8000000] 1280x720@[23.999981 23.999981]fps [avfoundation @ 0x7fadd8000000] 1280x720@[14.999993 14.999993]fps default: Input/output error

I receive this message when opening the Home app and looking at the camera component.

MRvH88 commented 5 years ago

Had a second look at it and got it working (still get the above messages though). I changed the following to stream.go:

Added the line you mentioned: fmt.Sprintf(" -framerate 25") +

Slashed out: //fmt.Sprintf(" -framerate %d", s.framerate(video.Attributes)) + //fmt.Sprintf(" -framerate %d", video.Attributes.Framerate) +

brutella commented 5 years ago

FYI https://github.com/brutella/hkcam/blob/master/ffmpeg/stream.go#L153-L154

MRvH88 commented 5 years ago

Yes I also saw this, I tried changing it to 25 but did nothing so left it at 30. Can confirm that it is working on a MacBook Pro 13" early 2011, however I do not have sound. But if I read it correctly it is not yet implemented?