我需要从网络摄像头捕获视频并保存到文件(mp4格式).使用C#.net 4.0应用程序执行此操作的最佳方法是什么?
有没有涉及WIA(Windows Image Acquisition)/ DirectShow的解决方案?或者我需要使用其中任何一个吗?
在 Android 上,当您开始在应用程序中录制视频时,会发出通知声音。有没有可靠的方法来禁用它?
在我的 OSX 应用程序中,我使用下面的代码来显示来自相机的预览。
[[self session] beginConfiguration];
NSError *error = nil;
AVCaptureDeviceInput *newVideoDeviceInput = [AVCaptureDeviceInput deviceInputWithDevice:captureDevice error:&error];
if (captureDevice != nil) {
[[self session] removeInput: [self videoDeviceInput]];
if([[self session] canAddInput: newVideoDeviceInput]) {
[[self session] addInput:newVideoDeviceInput];
[self setVideoDeviceInput:newVideoDeviceInput];
} else {
DLog(@"WTF?");
}
}
[[self session] commitConfiguration];
Run Code Online (Sandbox Code Playgroud)
但是,我需要检测来自相机的预览可用的确切时间。
换句话说,我试图检测与 OSX 下的 Facetime 相同的时刻,一旦相机提供预览,动画就会开始。
实现这一目标的最佳方法是什么?
可以通过此代码防止Android应用程序屏幕截图
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
super.onCreate(savedInstanceState);
}
Run Code Online (Sandbox Code Playgroud)
但是在每个屏幕上都编写这段代码很麻烦。有什么方法可以在清单应用程序或任何地方声明它。
我发现下面的 git 使用func capturer(_ capturer: RTCVideoCapturer, didCapture frame: RTCVideoFrame)
of既简单又高效RTCVideoCapturerDelegate
。你得到RTCVideoFrame
然后转换CVPixelBuffer
为修改。
https://gist.github.com/lyokato/d041f16b94c84753b5e877211874c6fc
但是,我发现 Chronium 说获得 PixelBuffer 的 nativeHandle 不再可用(链接如下)。我尝试了 frame.buffer.pixelbuffer...,但是,查看框架 > 标题 > RTCVideoFrameBuffer.h,我发现 CVPixelBuffer 也从这里消失了!
https://codereview.webrtc.org/2990253002
有什么好的方法可以转换RTCVideoFrame
为CVPixelBuffer
?或者我们有更好的方法来修改从 RTCCameraVideoCapturer 捕获的视频吗?
下面的链接建议直接修改 sdk,但希望我们可以在 Xcode 上实现这一点。
我正在尝试在摄像机录制的视频中检测人脸。当我使用网络摄像头视频时,它工作正常。但是,对于摄像机录制的视频,视频会旋转 -90 度。请建议我,如何获得用于人脸检测的实际视频输出?
import cv2
import sys
cascPath = sys.argv[1]
faceCascade = cv2.CascadeClassifier('C:/Users/HP/Anaconda2/pkgs/opencv-3.2.0-np112py27_204/Library/etc/haarcascades/haarcascade_frontalface_default.xml')
#video_capture = cv2.videoCapture(0)
video_capture = cv2.VideoCapture('C:/Users/HP/sample1.mp4')
w=int(video_capture.get(3))
h=int(video_capture.get(4))
#output = cv2.VideoWriter('output_1.avi',cv2.VideoWriter_fourcc('M','J','P','G'), 60,frameSize = (w,h))
while True:
ret, frame = video_capture.read()
frame = rotateImage(frame,90)
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(gray, 1.3, 5)
# Draw a rectangle around the faces
for (x, y, w, h) in faces:
cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)
#cv2.imshow('face',i)
#output.write(frame)
cv2.imshow('Video', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
video_capture.release() …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 javascript 自动从网站下载视频。
Google Chrome 允许我右键单击并“另存为”视频,但我必须手动单击才能保存视频。
据我所知,网站获取视频并将其转换为斑点,如果您检查(ctrl + i)视频,您可以获得视频链接。
这是我尝试下载的链接之一: https: //www.wcoanimesub.tv/jojo-no-kimyou-na-bouken-tv-episode-17-english-subbed
谁能给我关于如何下载嵌入视频的建议?
编辑:
我不想使用 chrome 扩展。
ps我不知道去哪里问这个问题,所以就放在这里了。
可能重复:
ffmpeg:转换前后的视频长度不同
最近,我一直试图将FFmpeg用于一个应用程序,当涉及到时间参数(毫秒分辨率)时需要非常精确的操作.不幸的是,我很惊讶地发现FFmpeg的操作功能会返回一些不准确的结果.
这是'ffmpeg'的输出:
ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
built on Jul 25 2012 19:55:05 with gcc 4.2.1 (Apple Inc. build 5664)
configuration: --enable-gpl --enable-shared --enable-pthreads --enable-libx264 --enable-libmp3lame
libavutil 51. 54.100 / 51. 54.100
libavcodec 54. 23.100 / 54. 23.100
libavformat 54. 6.100 / 54. 6.100
libavdevice 54. 0.100 / 54. 0.100
libavfilter 2. 77.100 / 2. 77.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100 …
Run Code Online (Sandbox Code Playgroud) 我试图让视频循环播放.我想检查它是否到达视频的末尾,以便我可以重新实现它; 我如何让它循环?
VideoStream::VideoStream(Filters* f, char* fileNam):
filter(f),
fileName(fileNam){
TestON = true;
cap = new VideoCapture(fileNam);
};
void VideoStream::readFrame(){
if(!cap->isOpened()) // check if we succeeded
cerr<<"cannot open video file";
if(cap->get(CV_CAP_PROP_POS_AVI_RATIO==1)){
cap = new VideoCapture(fileName);
}
Mat image;
cap->read(image);
if(!image.empty())
imshow("haha", image);
waitKey(1);
image.release();
};
Run Code Online (Sandbox Code Playgroud) 我正在开发一个桌面应用程序,它要求我连接到网络摄像头并以MPEG,AVI,MP4和WMV格式录制(保存)视频并刻录到CD/DVD中.该应用程序是在Win Forms中.我只是在寻找免费或开源的解决方案或控件.
我已经使用Aforge.Net将AVI保存为AVI,但它需要更多的尺寸来保存(例如15sce 320x240视频的60-100MB).我预计10秒会有1MB.这是代码:
using System;
using System.Drawing;
using System.Windows.Forms;
using AForge.Video;
using AForge.Video.DirectShow;
using AForge.Video.VFW;
namespace Aforge_Web_Cam
{
public partial class VideoForm : Form
{
private FilterInfoCollection VideoCaptureDevices;
private VideoCaptureDevice FinalVideo = null;
private VideoCaptureDeviceForm captureDevice;
private Bitmap video;
private AVIWriter AVIwriter = new AVIWriter();
private SaveFileDialog saveAvi;
public VideoForm()
{
InitializeComponent();
}
private void VideoForm_Load(object sender, EventArgs e)
{
VideoCaptureDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
captureDevice = new VideoCaptureDeviceForm();
}
private void butStart_Click(object sender, EventArgs e)
{
if (captureDevice.ShowDialog(this) == …
Run Code Online (Sandbox Code Playgroud) video-capture ×10
video ×3
android ×2
opencv ×2
.net-4.0 ×1
audio ×1
c# ×1
c++ ×1
capture ×1
cocoa ×1
ffmpeg ×1
ios ×1
javascript ×1
objective-c ×1
python ×1
screenshot ×1
webcam ×1
webrtc ×1