因此,要在Linux上使用ffmpeg录制网络摄像头视频,您可以使用类似...
ffmpeg -f video4linux2 -s 640x480 -i /dev/video0 out.avi
Run Code Online (Sandbox Code Playgroud)
但是在Mac上这不起作用,所以我想知道你如何用mac上的ffmpeg与isight进行记录?
我已经研究了很多人说它无法完成,但大多数这些帖子都很老了所以我想知道从那以后它是否有所改变.
我试图使用Python(版本2.7或2.6)和PyObjC(版本2.2)从内置到Macbook Pro中的Apple iSight摄像头捕获单帧.
作为一个起点,我使用了这个旧的StackOverflow问题.为了验证它是否有意义,我交叉引用了它似乎基于的Apple的MyRecorder示例.不幸的是,我的脚本不起作用.
我的重要问题是:
在下面粘贴的示例脚本中,预期的操作是在调用startImageCapture()之后,我应该从CaptureDelegate开始打印"Got a frame ..."消息.但是,相机的指示灯从不打开,代表的回调永远不会执行.
此外,在startImageCapture()期间没有失败,所有函数声称成功,并且它成功找到iSight设备.分析pdb中的会话对象表明它具有有效的输入和输出对象,输出具有分配的委托,设备未被其他进程使用,并且在调用startRunning()之后会话被标记为正在运行.
这是代码:
#!/usr/bin/env python2.7
import sys
import os
import time
import objc
import QTKit
import AppKit
from Foundation import NSObject
from Foundation import NSTimer
from PyObjCTools import AppHelper
objc.setVerbose(True)
class CaptureDelegate(NSObject):
def captureOutput_didOutputVideoFrame_withSampleBuffer_fromConnection_(self, captureOutput,
videoFrame, sampleBuffer,
connection):
# This should get called for every captured frame
print "Got a frame: %s" % videoFrame
class QuitClass(NSObject):
def quitMainLoop_(self, aTimer):
# Just stop the main loop. …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用ffserver和ffmpeg进行网络摄像头的实时视频流.我在网上找到了一些资源(#1和#2),这或多或少都做同样的事情.
我在运行OS X 10.6.5的MacBook Pro上.网络摄像头是iSight集成摄像头.如果我查看/ dev /我找不到类似于/ dev/video*的内容,那么iSight摄像头的安装位置以及如何在ffmpeg命令中引用它:
ffmpeg -r 15 -s 320x240 -f video4linux -i/dev/video0 http:// localhost:8090/webcam.ffm
有任何想法吗?
是否可以通过编程方式访问macbook上的iSight摄像头?通过这个我的意思是我希望能够在命令中从iSight摄像头抓取静止帧,然后用它们做一些事情.如果是这样,它是否只能使用目标c访问,还是可以使用其他语言?
我想获得我的Macbook(集成的iSight网络摄像头)的网络摄像头流.
我使用Java,我对Objective-C一无所知,所以我正在寻找一个"全java"解决方案.我发现了一些类示例,但它们是在2005年制作的,它们不适用于我的系统.
我意识到没有关于isight光传感器使用的任何公开文档,但是像ShadowBook这样的程序(如此处所示)能够访问亮度数据,我只是想知道是否有人能够获得类似的结果和知道如何访问这个传感器?谢谢!
我有以下PyObjC脚本:
from Foundation import NSObject
import QTKit
error = None
capture_session = QTKit.QTCaptureSession.alloc().init()
print 'capture_session', capture_session
device = QTKit.QTCaptureDevice.defaultInputDeviceWithMediaType_(QTKit.QTMediaTypeVideo)
print 'device', device, type(device)
success = device.open_(error)
print 'device open success', success, error
if not success:
raise Exception(error)
capture_device_input = QTKit.QTCaptureDeviceInput.alloc().initWithDevice_(device)
print 'capture_device_input', capture_device_input, capture_device_input.device()
success = capture_session.addInput_error_(capture_device_input, error)
print 'session add input success', success, error
if not success:
raise Exception(error)
capture_decompressed_video_output = QTKit.QTCaptureDecompressedVideoOutput.alloc().init()
print 'capture_decompressed_video_output', capture_decompressed_video_output
class Delegate(NSObject):
def captureOutput_didOutputVideoFrame_withSampleBuffer_fromConnection_(self, captureOutput, videoFrame, sampleBuffer, connection):
print videoFrame, sampleBuffer, connection
delegate = …Run Code Online (Sandbox Code Playgroud) 几天后,我无法再从opencv应用程序中打开我的iSight摄像头了.cap = cv2.VideoCapture(0)返回并cap.isOpened()返回true.但是,cap.grab()只需返回false.有任何想法吗?
示例代码:
import cv2
cv2.namedWindow("preview")
vc = cv2.VideoCapture(0)
rval = True
while rval:
rval, frame = vc.read()
cv2.imshow("preview", frame)
key = cv2.waitKey(20)
if key == 27: # exit on ESC
break
Run Code Online (Sandbox Code Playgroud)
我正在尝试从QT电影的各个帧中提取像素数据.
我想我需要使用CV,因为QTKit和NSImage会太慢......
我需要比较包含网络摄像头当前帧(iSight)的缓冲区(CVImageBufferRef)中图像的每个像素.所以我需要速度.
抱歉我的英语不好,我是意大利语.