I am following the output_example.c example to try to save encoded
mpeg2video data in a mpeg2 PS format. When I call av_write_frame() I
get integer division by 0 call stack > _av_guess_image2_codec() +
0x1c732 bytes. I must be missing some initialization.
This is the basics of my code:
AVFormatContext *format;
AVOutputFormat *mpeg2dvd_muxer;
AVCodecContext *c;
init(){
format->filename = someFileName;
mpeg2dvd_muxer = guess_format("dvd", NULL, "video/mpeg");
format->oformat = mpeg2dvd_muxer;
video_st = av_new_stream(format, 0);
url_fopen(&format->pb, format->filename, URL_WRONLY);
av_write_header(format);
video_st->codec = c;
}
...
len = avcodec_decode_video(c, frameYUV, &gotPicture, inbufPtr, size);
if(len > 0)
{
AVPacket pkt;
av_init_packet(&pkt);
if (c->coded_frame->pts != AV_NOPTS_VALUE)
pkt.pts= av_rescale_q(c->coded_frame->pts, c->time_base,
video_st->time_base);
if(c->coded_frame->key_frame)
pkt.flags |= PKT_FLAG_KEY;
pkt.stream_index = video_st->index;
pkt.data = inbufPtr;
pkt.size = size;
av_write_frame(format, &pkt); //crashes integer division by 0 in
av_guess_image2_codec
}
...
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user