Ask Your Question
0

videowriter using ffmpeg h264 codec on windows with opencv 248

asked 2014-03-28 11:07:05 -0600

aroy gravatar image

Can anyone explain how does one actually go about creating a video with the h264 codec using opencv on windows machine. when i try to open a videowriter with

video->open("video.avi", CV_FOURCC('h','2','6','4'), 30., Size(640, 480), true);

i always get the error

Could not find encoder for codec id 28: Encoder not found Video not opened

i have tried it with the pre-compiled libraries as well as compiling opencv myself with ffmpeg on. I tried using it on x86 as well as x64. i even tried it with opencv246 and opencv248.

edit retag flag offensive close merge delete

Comments

you have to install the codec for this . it does not come bundled with opencv

berak gravatar imageberak ( 2014-03-28 11:17:14 -0600 )edit

does that mean that ffmpeg does not provide the codec? is it supposed to have libx264 support?

aroy gravatar imagearoy ( 2014-03-28 11:58:18 -0600 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2014-04-19 19:47:39 -0600

crackwitz gravatar image

updated 2014-04-19 20:03:56 -0600

I haven't gotten it to work properly either. I say "fourcc = -1" and then use the system codec picker to choose x264vfw. if I give "X264" as the codec, it complains about "codec ID 28" but still produces a video (provided I ignore isOpened() being false). when I give a completely random fourcc, it doesn't complain about "codec id 28" and doesn't produce a video.

if you give a fourcc, it's passed to avcodec_find_encoder() in sources\modules\highgui\src\cap_ffmpeg_impl.hpp line 1591 (in v2.4.8), so somewhere there is the bug.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-03-28 11:07:05 -0600

Seen: 9,156 times

Last updated: Apr 19 '14