[Libav-user] [libav-user] avcodec_open2 cannot open h264 codec
Bakhtiyarov Dmitriy
bakhtiyarov.dima at gmail.com
Fri Oct 11 21:42:53 CEST 2013
Hello, Marika.
I think you should set some additional parameters. For example, you should
select profile of h264(High, Baseline or any another). And you can use some
preset options and modify it.
I use libx264 for encoding and I use this code for set options:
m_params = new x264_param_t;
x264_param_default_preset(m_params, "ultrafast",
"fastdecode,zerolatency"); //you should select options neededfor you
m_params->i_width = m_out_width;
m_params->i_height = m_out_height;
m_params->i_threads = 2;
m_params->i_fps_num = m_fps;
m_params->i_fps_den = 1;
m_params->i_keyint_max = 45;
m_params->b_intra_refresh = 0;
m_params->rc.i_rc_method = X264_RC_CRF;
m_params->rc.f_rf_constant = 25;
m_params->rc.f_rf_constant_max = 35;//??
m_params->b_repeat_headers = 1;
m_params->b_annexb = 1;
x264_param_apply_profile(m_params, "baseline"); //I think you MUST
select profile
m_encoder = x264_encoder_open(m_params);
With best regards,
Bakhtiyarov Dmitriy
2013/10/11 Marika Marszalkowski <marikaner at gmail.com>
> Hello everyone,
>
> I am trying to encode an .mkv file from jpeg images. Opening the codec
> with avcodec_open2 fails with the following error:
>
> [libx264 @ 0x7fffb8003200] broken ffmpeg default settings detected
>
> [libx264 @ 0x7fffb8003200] use an encoding preset (e.g. -vpre medium)
>
> [libx264 @ 0x7fffb8003200] preset usage: -vpre <speed> -vpre <profile>
>
> [libx264 @ 0x7fffb8003200] speed presets are listed in x264 --help
>
> [libx264 @ 0x7fffb8003200] profile is optional; x264 defaults to high
>
>
> Those are the settings I am using:
>
>
> pCodecCtx = pVideoStream->codec;
>
> pCodecCtx->codec_id = pOutputFormat->video_codec;
>
> pCodecCtx->codec_type = AVMEDIA_TYPE_VIDEO;
>
>
> pCodecCtx->bit_rate = Bitrate;
>
> pCodecCtx->width = getWidth();
>
> pCodecCtx->height = getHeight();
>
> pCodecCtx->time_base.den = fps;
>
> pCodecCtx->time_base.num = 1;
>
> pCodecCtx->gop_size = Gop;
>
> pCodecCtx->pix_fmt = PIX_FMT_YUV420P;
>
> pCodecCtx->thread_count = 10;
>
>
> And this is what av_dump_format gives me:
>
>
> Output #0, matroska, to '/home/marika/test.mkv':
>
> Stream #0:0: Video: h264, yuv420p, 1920x1080, q=2-31, 50 kb/s, 90k tbn, 30 tbc
>
>
> Any ideas?
>
>
> Thanks
>
> Marika
>
>
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20131011/40f209f0/attachment.html>
More information about the Libav-user
mailing list