Hi all.
Sorry for posting again, but I really need help, and afraid that my mails are
lost.
I am writing an application capturing the MPEG2 Transport Stream from a DVB-S
device and saving its parts to a file.
The application is working on Windows and using the specific API, provided by
the device manufacturers, therefore I cannot use ffmpeg command line utility
directly.
I have defined the ByteIOContext and set it in the input AVFormatContext.
The problem is that after about 1 hour of work the program eats all available
memory, and the system kills it.
Here is the minimum case, which causes failures.
AVFormatContext *input;
AVPacket pkt;
AVFormatParameters ap;
input=av_alloc_format_context();
input->iformat=av_find_input_format("mpegts");
bio_buffer=(unsigned char *)malloc(bio_buffer_size); //=188
input->pb=av_alloc_put_byte(bio_buffer,bio_buffer_size,
0,this,linsys_read,NULL,NULL);
input->pb->is_streamed=1;
input->pb->max_packet_size=188;
input->flags|=AVFMT_NOFILE|AVFMT_FLAG_IGNIDX;
input->max_index_size=1024*50;
input->max_picture_buffer=1024*100;
memset(&ap, 0, sizeof(ap));
ap.prealloced_context=1;
int r=av_open_input_stream(&input,input->pb,"linsys",input->iformat,&ap);
r=av_find_stream_info(input);
while(!is_exiting()){
av_read_frame(input,&pkt);
av_free_packet(&pkt);
}
This code references the function linsys_read.
If I call it directly, the memory consumption doesn't grow.
The code below doesn't cause failures.
uint8_t buf[10340]; // arbitrary value, even number of
// transport packets, close to 10Kb
int readed;
while(!is_exiting()){
readed=linsys_read(this,buf,10340);
}
I have also experimented with redirecting the data to the FFmpeg.exe:
Added fwrite to the cycle above, getting that below
uint8_t buf[10340]; // arbitrary value, even number of
// transport packets, close to 10Kb
int readed;
while(!is_exiting()){
readed=linsys_read(this,buf,10340);
fwrite(buf,readed,1,stdout);
}
and issued the command
D:\>main.exe| ffmpeg.exe -f mpegts -i - a.mpg
The output of FFmpeg.exe is given here http://pastebin.com/m4ce318e2
The task manager has shown, that the memory consumption of both programs
quickly grows.
But
D:\>main.exe > nul
did not occupy more than about 5-6 Mb.
FFmpeg's messages about mpeg1video are very strange, as I know for sure that
the stream doesn't contain mpeg1video, only MPEG2.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user