I changed the code to this and it still produces a seg fault. I changed the avcodec_alloc_context and avcodec_open calls to the new versions of the functions as well. This is so strange to me.

  av_register_all();
  /* find the mpeg1 video encoder */
     codec = avcodec_find_encoder(CODEC_ID_MPEG1VIDEO);
     if (!codec) {
         fprintf(stderr, "codec not found\n");
         exit(1);
     }

     c= avcodec_alloc_context3(codec);
     picture= avcodec_alloc_frame();

     /* put sample parameters */
     c->bit_rate = 400000;
     /* resolution must be a multiple of two */
     c->width = 352;
     c->height = 288;
     /* frames per second */
     c->time_base= (AVRational){1,25};
     c->gop_size = 10; /* emit one intra frame every ten frames */
     c->max_b_frames=1;
     c->pix_fmt = PIX_FMT_YUV420P;
     c->codec_id   = codec->id;
     c->codec_type = AVMEDIA_TYPE_VIDEO ;

     /* open it */
     if (avcodec_open2(c, codec,NULL) < 0) {
         fprintf(stderr, "could not open codec\n");
         exit(1);
     }


On 04/09/2012 09:34 PM, Kalileo wrote:
On Apr 10, 2012, at 04:11 , Jeremy Graham wrote:

I did try using avcodec_open2 as well but I still got a seg fault out of it. I 
set the third parameter to NULL, however.  Is that what I am doing wrong?
No, NULL is ok there.

Try setting these 2 values before you open the codec:

c->codec_id   = codec->id;
c->codec_type = AVMEDIA_TYPE_VIDEO ;

_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to