Hi all.
I am developing an application, capturing MPEG2 Transport Stream and
saving its parts to a file (for example, a video stream and one of
accompanying audio streams).

I use my own functions to parse the Transport Stream and FFmpeg's 
functions to store audio and video data to a file.

I could not find any documentation about using MpegTS parser from the
FFmpeg, and I also need to represent the data somehow to a user,
therefore, I preferred using my own data structures.

My understanding was that if av_parser_parse returns not zero
poutbuf_size, the buffer, passed to it contains a complete video or
audio frame.

Therefore, generally my code is

[accumulate data]

int r=av_parser_parse(parser,codec_ctx,&samples,&frame_size,
                       bitstream,bitstream_size,pts,dts)

if(frame_size>0) {  
int r;
AVPacket avpacket;

  if(!m_header_written) { 
    av_write_header(m_pFormatCtx);
    m_header_written=true;
  }
                                        
  avpacket.stream_index = index; 
  avpacket.pts=pts;
  avpacket.dts=dts;
  avpacket.duration =(int64_t)0;//TODO:I still don't know how
tocalculate
 
  avpacket.data=bitstream;
  avpacket.size=frame_size;

  int r = av_interleaved_write_frame(m_pFormatCtx, &avpacket); 
  bitstream_size=0;
}
 
However, during av_interleaved_write_frame I get several dozens of
messages like 

[dvd @ 6A8FC980]buffer underflow i=0 bufi=20227 size=46436
[dvd @ 6A8FC980]buffer underflow i=0 bufi=22251 size=46436
[dvd @ 6A8FC980]buffer underflow i=0 bufi=24275 size=46436
[dvd @ 6A8FC980]buffer underflow i=0 bufi=26299 size=46436
[dvd @ 6A8FC980]buffer underflow i=0 bufi=28323 size=46436

46436 is the frame_size value returned by av_parser_parse.

What's wrong??

Please, help me to resolve this, as I am going insane while struggling
with the libraries.
FFmpeg is a great software, but definitely, it lacks some up to date
documentation. I understand, that its developers simply don't have
enough time for it, as so as for reading mailing lists.

Thank you very much in advance, and very-very waiting for the answer.

Vladimir.



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

Reply via email to