[Libav-user] h264 Encoding problems

Zac Shenker zac at zacshenker.com
Fri Nov 4 07:40:15 CET 2011


I have started working on some code based on the decoding_encoding.c sample
file to encode the test pattern as h.264 video.

The settings I am using on my AVCodecContext is as follows:
c->width = 352;
c->height = 288;
c->time_base.num = 1;
c->time_base.den = 25;
c->pix_fmt = PIX_FMT_YUV420P;

c->gop_size = 1;

if(codec_id == CODEC_ID_H264)

av_opt_set(c->priv_data, "preset", "slow", 0);

I am having a number of issues:
1) Even when I set the AVFrame->pts to AVS_NOPTS_VALUE, I still get
"non-strictly-monotonic PTS" warning messages. How should I be setting the
PTS value?
2) For the first 13 frames my call to avcodec_encode_video returns a size
of 0, should this be happening?
3) The output file that gets written does not seem to have a duration(using
ffprobe or VLC to check)

So far to figure out how things work I have been searching through the
ffmpeg & x264 source, is there any up-to-date examples of doing h264 video
encoding (no audio) anywhere?

Zac Shenker
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20111104/02d772a6/attachment.html>

More information about the Libav-user mailing list