[Libav-user] Can't Open MJPEG Encoder
Tom Distler
tom.distler at gmail.com
Tue Jun 7 22:04:57 CEST 2011
Hello,
avcodec_open() is returning -1 when I try to open the MJPEG encoder.
However, avcodec_open() succeeds when creating the MPEG-4 encoder with the
same context settings.
Here's the code that *fails* with MJPEG and *succeeds* with MPEG-4:
Thx!
-----
AVCodec* _codec;
AVCodecContext* _codecContext;
-----
avcodec_register_all();
avcodec_get_context_defaults2( _codecContext, CODEC_TYPE_VIDEO );
_codecContext->codec_id = CODEC_ID_MJPEG; //MPEG4
_codecContext->codec_type = CODEC_TYPE_VIDEO;
_codecContext->time_base.num = 1;
_codecContext->time_base.den = 30;
_codecContext->pix_fmt = PIX_FMT_YUV420P;
_codecContext->bit_rate = 1024 * 1024;
_codecContext->width = 704;
_codecContext->height = 480;
_codec = avcodec_find_encoder(CODEC_ID_MJPEG); // MPEG4
int res = avcodec_open( _codecContext, _codec );
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20110607/a29b6f51/attachment.html>
More information about the Libav-user
mailing list