Hi all.
Please, help me.
I seem to be missing some basics about what is 'time base' in FFmpeg
terminology.
This is my second question about time bases in media streams, first was
left without the answer.
I really need help and would VERY VERY appreciate it.
The main problem:
When I call av_write_frame() or av_interleaved_write_frame(), these functions
complain:
"error, non monotonic time stamps <very-very long negative number> >= <the same
number>"
or
"error, pts < dts"
What was not set??
Now details.
I am developing an application, capturing the MPEG2 Transport Stream
from a DVB-S card and saving its parts to a MPEG Program Stream file
according to user defined schedule (for example, a video stream from a
program and one from accompanying audio streams from that program during
the time interval set by a user).
I have developed a code, parsing the system information, contained in
the Transport stream.
FFmpeg functions are used to save elementary streams to a file.
Since I have no input file and have only parts of the stream in a
function, I cannot call av_open_input_file() and av_find_stream_info()
and have to create and fill all necessary data structures from scratch.
Looks like I have some success in this, since FFmpeg functions don't
cause the application crashes.
Output format context was created with the following code:
m_pFormatCtx = av_alloc_format_context();
snprintf(urlname, sizeof(urlname), "file:%s",
m_filename); //m_filename == "p8201.mpg"
m_outfmt = guess_format("svcd", (const char *)m_filename, NULL);
m_pFormatCtx->oformat = m_outfmt;
Then I call
av_new_stream(m_pFormatCtx,m_pFormatCtx->nb_streams);
in a cycle (for each desired stream)
Then I accumulate PES packets, set their PES_packet_size if it is 0 and
call av_write_frame() (I also tried av_interleaved_write_frame)
The code (C++) follows.
AVPacket avpacket;
avpacket.stream_index = avstream->index;
avpacket.pts=el_pkt.m_PTS; //el_pkt is a class, storing a PES packet
avpacket.dts=el_pkt.m_DTS;
avpacket.duration = (int64_t)0;
avpacket.data=avstream->buffer; //pointer to PES packet
avpacket.size=avstream->buffer_size; //its size
int r = av_write_frame(m_pFormatCtx, &avpacket);
However, when I call av_write_frame() or av_interleaved_write_frame()
these functions complain:
"error, non monotonic time stamps <very-very long negative number> >= <the same
number>"
or
"error, pts < dts"
Please, tell me what am I missed to do??
Please, help me! This is my 3rd or 4th question to this list, which has left
without answer.
I will be happy to supply any additional details about my application, but I
don't know what exactly could need.
Thank you very much for so long reading.
Vladimir
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user