[Libav-user] quicktime doesn't play my mpeg4 video stream which encoded by libav

Xian Yan Yang myladyyang at gmail.com
Wed May 15 12:47:53 CEST 2013


Hi all:

I've been stucked with this problem for quite a long time, and finally I
decide to ask for help here.

I encode my camera video to MPEG4 ES stream with libav. I could use VLC to
play the video, but it doesn't work for quicktime or realplayer.

There must be something wrong with my encoding code. see below:

avcodec_register_all();
AVCodec *codec = NULL;
 codec = avcodec_find_encoder(CODEC_ID_MPEG4);
if (!codec)
{
return false;
}
c = avcodec_alloc_context3(codec);
if (NULL == c)
{
return false;
}
AVDictionary *d = NULL;

c->codec_id = CODEC_ID_MPEG4;
c->codec_type = AVMEDIA_TYPE_VIDEO;
c->width = dwDstWidth;
c->height = dwDstHeight;
AVRational atemp = {1,dwFps__};
c->time_base = atemp;
c->gop_size = 10;
c->max_b_frames=1;

c->pix_fmt = PIX_FMT_YUV420P;
c->bit_rate = 400000;
c->level = 1;//profile-level-id
if (avcodec_open2(c, codec,&d) < 0)
{
avcodec_close(c);
av_free(c);
c = NULL;
return false;
}
av_dict_free(&d);
picture= avcodec_alloc_frame();
...
----------------------------------------------------------------------------------
I wonder if my set of parameraters for encoding mpeg4 video is right? Or
some special parameters are needed for quicktime?

Thanks
Br.Luffy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130515/1da3086b/attachment.html>


More information about the Libav-user mailing list