Vicente Soriano <[EMAIL PROTECTED]> writes:

> If I debug the program, I can see the error is in the function 
av_write_frame, but I
> don´t know what I´m doing wrong...

You forgot av_write_header(output) before calling av_write_frame.
 
> This is a part of my code:
> <code>
> AVFormatContext *pFormatCtx;
[skip]
> uint8_t                 *buffer;
int header_written=0;
> ...
> 
> pCodec=avcodec_find_decoder(pCodecCtx->codec_id);

  [skip] 

> while(av_read_frame(pFormatCtx, &packet)>=0)
>     {
>         if(packet.stream_index==videoStream)
>         {
>             avcodec_decode_video(pCodecCtx, pFrame, &frameFinished, 
>                 packet.data, packet.size);
> 
>             if(frameFinished)
>             {
>                 img_convert((AVPicture *)pFrameRGB, PIX_FMT_RGB24, 
>                     (AVPicture*)pFrame, pCodecCtx->pix_fmt, pCodecCtx->width, 
>                     pCodecCtx->height);
> 
>                 for(i=0; i<pFrameRGB->linesize[0]; i++){
>                     if ((i%3)==0){
>                         pFrameRGB->data[0][i] = 50;
>                     }
>                 }
>                 img_convert((AVPicture *)pFrame, pCodecCtx->pix_fmt, 
>                     (AVPicture*)pFrameRGB, PIX_FMT_RGB24, pCodecCtx->width, 
>                     pCodecCtx->height);
> 
>                 
avcodec_encode_video(pCodecCtx,packet.data,packet.size,pFrame);
>             }
              if(!header_written) {
                  av_write_header(pFormatCtxOut);
                  header_written=1;
              }

>             if(av_write_frame(pFormatCtxOut,&packet) < 0){
>                 printf("Error\n");
>                 return -1;
>             }
>         }

if(header_written)
  av_write_trailer(pFormatCtxOut);

> </code>
> 
> The message "Error" doesn´t appear in the standard output...
> 
> Can you tell me what  is wrong?
> Sorry for my english and thanks!!! 

For mpegts, call to write_header initializes neede structures


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

Reply via email to