我可以在电影拍摄模式下录制视频(第6.4.3节EDSDK API),但我需要逐步录制视频并拍摄照片。所以我有一个问题:是否可以使用sdk更改视频和照片模式?如果是,我们应该在相机上安装哪种模式?如何使用SDK做到这一点?我们的相机型号是佳能eos 650D。在第6.4.2节EDSDK API中,我读取了在视频录制之前使用实时查看模式,但它的解决方案并不起作用。我尝试使用下面的代码。
#include <QCoreApplication>
#include "EDSDK/Header/EDSDK.h"
#include <Windows.h>
#include <QDebug>
EdsError startLiveview(EdsCameraRef camera)
{
EdsError err = EDS_ERR_OK;
// Get the output device for the live view image
EdsUInt32 device;
err = EdsGetPropertyData(camera, kEdsPropID_Evf_OutputDevice, 0 , sizeof(device), &device );
// PC live view starts by setting the PC as the output device for the live view image.
if(err == EDS_ERR_OK)
{
device |= kEdsEvfOutputDevice_PC;
err = EdsSetPropertyData(camera, kEdsPropID_Evf_OutputDevice, 0 , sizeof(device), &device);
}
return err;
// A property change event notification is issued from the camera if property settings are made successfully.
// Start downloading of the live view image once the property change notification arrives.
}
EdsError endLiveview(EdsCameraRef camera)
{
EdsError err = EDS_ERR_OK;
// Get the output device for the live view image
EdsUInt32 device;
err = EdsGetPropertyData(camera, kEdsPropID_Evf_OutputDevice, 0 , sizeof(device), &device );
// PC live view ends if the PC is disconnected from the live view image output device.
if(err == EDS_ERR_OK)
{
device &= ~kEdsEvfOutputDevice_PC;
err = EdsSetPropertyData(camera, kEdsPropID_Evf_OutputDevice, 0 , sizeof(device), &device);
}
return err;
}
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
EdsError err = EDS_ERR_OK;
EdsCameraRef camera = NULL;
EdsCameraListRef cameraList = NULL;
bool isSDKLoaded = false;
EdsUInt32 count = 0;
err = EdsInitializeSDK();
if(err == EDS_ERR_OK)
{
isSDKLoaded=true ;
}
err = EdsGetCameraList(&cameraList);
// Get number of cameras
if(err== EDS_ERR_OK)
{
err = EdsGetChildCount(cameraList, &count);
if(count == 0)
{
err = EDS_ERR_DEVICE_NOT_FOUND;
}
}
// Get first camera retrieved
if(err == EDS_ERR_OK)
{
err = EdsGetChildAtIndex(cameraList , 0 , &camera);
}
if(err == EDS_ERR_OK)
{
err = EdsOpenSession(camera);
}
EdsUInt32 saveTo = kEdsSaveTo_Camera;
err = EdsSetPropertyData(camera, kEdsPropID_SaveTo, 0, sizeof(saveTo) , &saveTo);
startLiveview(camera);
Sleep(1000);
EdsUInt32 record_start = 4; // Begin movie shooting
err = EdsSetPropertyData(camera, kEdsPropID_Record, 0, sizeof(record_start), &record_start);
qDebug() << err;
Sleep(3000);
EdsUInt32 record_stop = 0; // End movie shooting
err = EdsSetPropertyData(camera, kEdsPropID_Record, 0, sizeof(record_stop), &record_stop);
qDebug() << err;
endLiveview(camera);
Sleep(1000);
// Close session with camera
if(err == EDS_ERR_OK)
{
err = EdsCloseSession(camera);
}
// Release camera
if(camera != NULL)
{
EdsRelease(camera);
}
// Terminate SDK
if(isSDKLoaded)
{
EdsTerminateSDK();
}
return a.exec();
}