Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Broken ffmpeg settings when writing video

I have an OpenCV (2.4.9) application written in C++, which takes a video as input, processes it, and records the results as video as well. It works for 3 out of 4 videos on mine, but with 1 video it does not record, which is weird.

I initialize the writer object like this:

// Load input video
VideoCapture captureIn(videoPathRGB);

// Setup output video according to the input video
VideoWriter output_cap(videoPathResult, captureIn.get(CV_CAP_PROP_FOURCC), captureIn.get(CV_CAP_PROP_FPS), cv::Size(captureIn.get(CV_CAP_PROP_FRAME_WIDTH), captureIn.get(CV_CAP_PROP_FRAME_HEIGHT)));

and then after the processing step, I write it with:

// record the stream by passing the modified frame at each step
 output_cap.write(linedFrame);

and of course, at the end I finish with:

// do the cleaning
captureIn.release();
output_cap.release();

The videos I process are all mp4 files with around 1-2 minutes. Normally this works, but with 1 specific video I get the following error:

[libx264 @ 0xa64b20] broken ffmpeg default settings detected
[libx264 @ 0xa64b20] use an encoding preset (e.g. -vpre medium)
[libx264 @ 0xa64b20] preset usage: -vpre <speed> -vpre <profile>
[libx264 @ 0xa64b20] speed presets are listed in x264 --help
[libx264 @ 0xa64b20] profile is optional; x264 defaults to high
Could not open codec 'libx264': Unspecified error

And obviously it does not record.

Any thoughts?