I've implemented a new URLProtocol for libavformat, and it is
working perfectly except when seeking in the file.
What happens is that av_read_frame() returns a corrupted frame after
the seek. You can hear this very easily as the sound this corrupted
frame produces is really painful to listen to (an incredibly load
high pitched sound, lasting 2.4 seconds (1152 samples at 48 kHz).
Since this artifact always occurs immediately after a seek, I assume
the problem is that av_read_frame() returns a bogus frame
consisting of compressed data from two different access units.
(I haved calculated CRCs, and I verified that the CRC fails for the
frame that produces noise.)
Is there a simple solution to this? I have been trying everything I
can think of for 15-20 hours, without getting anywhere.
Here's some more information on what I'm doing, in case that helps:
- trying to stream a segmented MPEG2-TS stream where audio is
encoded as MP2 and video as MPEG2.
- every segment spans a single GOP, and should be self-contained,
as the video is encoded with fixed GOP size (24 frames) and
closed GOPs
- when I seek, I always do
urlcontext->priv_data = <index of the segment number I want>
av_seek_frame(fcx, 0, 0, AVSEEK_FLAG_BYTE)
(I set the "pos" argument to zero always, since the segment
number placed in the private data indicates which segment to seek
to)
As I said, the seek operation works, but painful bursts of sound
occur. :-(
Any help in getting further would be appreciated. If no one can
help, I can think of no other solution than dropping libavformat and
MPEG2-TS altogether, and creating an extremely simple container
format for my purposes (it is for research purposes, so it doesn't
*have* to be a standardized format, but I'd prefer it if possible)
--
Haakon
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user