I found a discrepancy in output_example.c and my version below.  I am 
trying to call av_write_frame() after a avcodec_decode_video(),  
output_example.c does this after an encode.  So I tried to mux to a 
file on the encode side and at least it works without crashing. Is it 
not possible to mux after a decode?  What is it that is different.  All 
I need is the encoded data and size right?  There is obviously 
something different in AVCodecContext after a decode and after an 
encode.  Does anyone know what needs to be set in order to call 
av_write_frame?

-Jordan

Quoting Jordan Dressman <[EMAIL PROTECTED]>:

> 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.
>
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to