Vladimir Eremeev wrote:
> I seem to be missing some basics about what is 'time base' in FFmpeg
> terminology.
http://cekirdek.pardus.org.tr/~ismail/ffmpeg-docs/structAVStream.html#9db755451f14e2bf590d4b85d82b32e6
[...]
> 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??
Maybe the error is just the one described by the above message: you set
a wrong pts or dts?
> 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).
Why cannot you just dump the PAT, the PMT, and the audio and video PIDs
in the output file, without using libavformat? That would be much simpler.
> 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.
You can call av_open_input_file() on the DVB device. I did it in the
past, and it worked quite well...
[...]
> 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)
I do not think av_write_frame() accepts PES packets. I think it wants
audio or video frames.
> 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;
Without knowing how you compute m_PTS and m_DTS, it is not possible to
say if this is correct. But judging from the error message you get, you
are probably setting wrong values here.
Luca
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user