우선 재생 및 HD 비디오 (1920x1080), 카메라 해상도를 1920x1080 프로그램 표시 및 검정색 배경으로 변경하면 카메라 해상도가 720x576 경우 문제없이 작동합니다. . 문제가 내 솔루션에 있다고 확신합니다. Blackmagic Decklink Studio 2에 포함 된 DesktopVideo를 사용할 때 카메라의 HD 비디오를 보여주기 때문입니다. 둘째, 어떻게 AForge로 비디오를 변환합니까? 해상도 및 프레임 레이트 변경과 같이 코덱 및 비트 전송률을 변경할 수 있지만 "FileWriter.Open"에서 Resolution 및 FrameRate를 변경하면 명령에서 오류 해상도가 표시되고 FrameRate가 Bitmap과 같아야합니다. 카메라에서 캡처하고 있습니다.AF 변환 및 문제와 HD
누구든지 이러한 문제를 해결하는 방법을 알고 있다면 정보를 공유해주세요. 감사합니다!
여기서 코드
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using AForge.Video;
using AForge.Video.DirectShow;
using AForge.Video.FFMPEG;
using AForge.Video.VFW;
namespace WindowsFormsApplication12
{
public partial class Form1 : Form
{
private FilterInfoCollection VideoCaptureDevices;
private VideoCaptureDevice FinalVideo = null;
private VideoCaptureDeviceForm captureDevice;
private Bitmap video;
//private AVIWriter AVIwriter = new AVIWriter();
private VideoFileWriter FileWriter = new VideoFileWriter();
private SaveFileDialog saveAvi;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
VideoCaptureDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
captureDevice = new VideoCaptureDeviceForm();
}
private void button1_Click(object sender, EventArgs e)
{
/////capture device list
if (captureDevice.ShowDialog(this) == DialogResult.OK)
{
VideoCaptureDevice videoSource = captureDevice.VideoDevice;
FinalVideo = captureDevice.VideoDevice;
FinalVideo.NewFrame += new NewFrameEventHandler(FinalVideo_NewFrame);
FinalVideo.Start();
}
}
void FinalVideo_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
if (butStop.Text == "Stop Record")
{
video = (Bitmap)eventArgs.Frame.Clone();
pictureBox1.Image = (Bitmap)eventArgs.Frame.Clone();
//AVIwriter.Quality = 0;
FileWriter.WriteVideoFrame(video);
//AVIwriter.AddFrame(video);
}
else
{
video = (Bitmap)eventArgs.Frame.Clone();
pictureBox1.Image = (Bitmap)eventArgs.Frame.Clone();
}
}
private void button2_Click(object sender, EventArgs e)
{
////record button
saveAvi = new SaveFileDialog();
saveAvi.Filter = "Avi Files (*.avi)|*.avi";
if (saveAvi.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
int h = captureDevice.VideoDevice.VideoResolution.FrameSize.Height;
int w = captureDevice.VideoDevice.VideoResolution.FrameSize.Width;
FileWriter.Open(saveAvi.FileName, w, h,25,VideoCodec.Default,5000000);
FileWriter.WriteVideoFrame(video);
//AVIwriter.Open(saveAvi.FileName, w, h);
butStop.Text = "Stop Record";
//FinalVideo = captureDevice.VideoDevice;
//FinalVideo.NewFrame += new NewFrameEventHandler(FinalVideo_NewFrame);
//FinalVideo.Start();
}
}
private void butStop_Click(object sender, EventArgs e)
{
if (butStop.Text == "Stop Record")
{
butStop.Text = "Stop";
if (FinalVideo == null)
{ return; }
if (FinalVideo.IsRunning)
{
//this.FinalVideo.Stop();
FileWriter.Close();
//this.AVIwriter.Close();
pictureBox1.Image = null;
}
}
else
{
this.FinalVideo.Stop();
FileWriter.Close();
//this.AVIwriter.Close();
pictureBox1.Image = null;
}
}
private void button3_Click(object sender, EventArgs e)
{
pictureBox1.Image.Save("IMG" + DateTime.Now.ToString("hhmmss") + ".jpg");
}
private void button4_Click(object sender, EventArgs e)
{
this.Close();
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (FinalVideo == null)
{ return; }
if (FinalVideo.IsRunning)
{
this.FinalVideo.Stop();
FileWriter.Close();
//this.AVIwriter.Close();
}
}
}
}
아무 것도 변환하지 않을 것입니다. HD에서 캡처 장치 (카메라)의 옵션을 FullHD로 변경하면 검은 색 화면이 표시되고 HD 일 때는 제대로 작동합니다. –
구성이 신호 소스 및/또는 형식과 일치하지 않으면 Blackmagic 장치가 검정색을 표시합니다. 원본 필터를 올바르게 설정해야합니다 (올바른 해상도, 프로그래밍 방식으로 소스를 수정하거나이 장치의 제어판에서 각각의 기본값을 변경해야합니다). 데스크톱 비디오가 정상적으로 작동한다고해서 필터를 사용하여 비디오를 캡처 할 수있는 것은 아닙니다. 데스크톱 비디오는 사용자가 사용하는 필터를 사용하지 않고 대신 캡처를 위해 DeckLink SDK를 공유하고 Blackmagic은 이미 사용중인 DirectShow 인터페이스를 더 이상 사용하지 않습니다. –