opencv videoWriter를 사용하여 비디오 파일을 가져 오려고합니다. 하지만 다음과 같은 문제가 얻을 :OpenCV VideoWriter가 작동하지 않습니다.
>[libx264 @ 0x132b680] broken ffmpeg default settings detected
>[libx264 @ 0x132b680] use an encoding preset (e.g. -vpre medium)
>[libx264 @ 0x132b680] preset usage: -vpre <speed> -vpre <profile>
>[libx264 @ 0x132b680] speed presets are listed in x264 --help
>[libx264 @ 0x132b680] profile is optional; x264 defaults to high
>Could not open codec 'libx264': Unspecified error!!! Output video could not be opened
내 시스템에 libx264을 수행하십시오, 그래서이 마지막 줄에 그냥 부작용
내가 실행하는 데 노력하고있어 코드를 추측하는 것은 How to write video file in OpenCV 2.4.3에서 가져온 예입니다 .
int main (int argc, char *argv[]){
// Load input video
VideoCapture input_cap("testi.mp4");
if (!input_cap.isOpened())
{
std::cout << "!!! Input video could not be opened" << std::endl;
return -1;
}
// Setup output video
cv::VideoWriter output_cap("testo.mp4",
input_cap.get(CV_CAP_PROP_FOURCC),
input_cap.get(CV_CAP_PROP_FPS),
cv::Size(input_cap.get(CV_CAP_PROP_FRAME_WIDTH),
input_cap.get(CV_CAP_PROP_FRAME_HEIGHT)));
if (!output_cap.isOpened())
{
std::cout << "!!! Output video could not be opened" << std::endl;
return -1;
}
// Loop to read from input and write to output
cv::Mat frame;
while (true)
{
if (!input_cap.read(frame))
break;
output_cap.write(frame);
}
input_cap.release();
output_cap.release();
return 0;
}
비슷한 문제가있는 게시물을 발견했습니다. 아무도 아직 제대로 답변하지 않았습니다.
opencv가 libav 대신 old fmmpeg를 사용하고 있는지 확인하라는 메시지가 나타났습니다. libb는 신선한 빌드이고 우분투에는 ffmpeg가 없기 때문에 아닙니다.