<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Thank you for responding, Michael. 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? Should
I also be making a call to avcodec_init? I am not doing that
currently.<br>
<br>
Actually, I will go ahead and try to post what I think is the
relevant code. This comes almost directly from the api_example
found at this URL:
<a class="moz-txt-link-freetext" href="http://cekirdek.pardus.org.tr/~ismail/ffmpeg-docs/api-example_8c-source.html">http://cekirdek.pardus.org.tr/~ismail/ffmpeg-docs/api-example_8c-source.html</a><br>
<br>
----------------------------------------------------------------------------------------------<br>
//These were declared globally<br>
static uint8_t* pixbuf_data = NULL;<br>
static vp_os_mutex_t video_update_lock = PTHREAD_MUTEX_INITIALIZER;<br>
static AVCodec *codec;<br>
static AVCodecContext *c= NULL;<br>
int out_size, size, outbuf_size;<br>
static FILE *f;<br>
static AVFrame *picture;<br>
static uint8_t *outbuf;<br>
.<br>
.<br>
.<br>
.<br>
.<br>
av_register_all();<br>
/* find the mpeg1 video encoder */<br>
codec = avcodec_find_encoder(CODEC_ID_MPEG1VIDEO);<br>
if (!codec) {<br>
fprintf(stderr, "codec not found\n");<br>
exit(1);<br>
}<br>
<br>
c= avcodec_alloc_context();<br>
picture= avcodec_alloc_frame();<br>
<br>
/* put sample parameters */<br>
c->bit_rate = 400000;<br>
/* resolution must be a multiple of two */<br>
c->width = 352;<br>
c->height = 288;<br>
/* frames per second */<br>
c->time_base= (AVRational){1,25};<br>
c->gop_size = 10; /* emit one intra frame every ten frames
*/<br>
c->max_b_frames=1;<br>
c->pix_fmt = PIX_FMT_YUV420P;<br>
<br>
/* open it */<br>
if (avcodec_open(c, codec) < 0) {<br>
fprintf(stderr, "could not open codec\n");<br>
exit(1);<br>
}<br>
---------------------------------------------------------------------------------------------------<br>
<br>
Jeremy<br>
<br>
On 04/09/2012 05:01 PM, Michael Bradshaw wrote:
<blockquote
cite="mid:CAJ29FNZYB07Sifo9CvfrUdNuc5tsaQHb89iFdf98hcb-GEt_GQ@mail.gmail.com"
type="cite">
<div class="gmail_quote">On Mon, Apr 9, 2012 at 2:56 PM, Jeremy
Graham <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:jgraham@cs.unc.edu">jgraham@cs.unc.edu</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello, everyone:<br>
<br>
I just thought that I'd start out by asking a general
question. Can anyone tell me the possible reasons why
avcodec_open might generate a segementation fault?</blockquote>
<div>Just out of curiosity, are you using avcodec_open or
avcodec_open2? avcodec_open is deprecated and should be
avoided if possible.</div>
<div><br>
</div>
<div>--Michael </div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Libav-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a>
<a class="moz-txt-link-freetext" href="http://ffmpeg.org/mailman/listinfo/libav-user">http://ffmpeg.org/mailman/listinfo/libav-user</a>
</pre>
</blockquote>
<br>
</body>
</html>