[vlc-devel] Re: How VLC deal with TS Packet Loss?
jpsaman at wxs.nl
Tue Feb 11 21:21:09 CET 2003
Junfeng Bai wrote:
> Dear Jean-Paul Saman,
> I am using VLC to play back a MPEG-2 file. I intently deleted some Video
> TS packets in the file (the video packets are from B frames) and played it
> with VLC. I found that VLC dropped the whole frames with packet loss and
> showed lots of discontinuity in play-back. While I used Media Play from
> Microsoft, it can continuously play the file although with some error
> blocks in the pictures.
You cannot drop packets from the TS Stream and expect every media player
to work well with it. It needs server side support. At least you need to
set the discontinuity bit on the first PCR-packet after the *hole*.
Further more you need to recreate the PCR's on the TS level, DTS and PTS
at the PES level from the *hole* onwards. Read the MPEG 1/2
specification. In addition to that you probably have to set the
trickplay mode fields in the PES to. (according to the MPEG 1/2
How does VLC handle that? If you do not adapt PCR's, DTS and PTS VLC
will correctly look at the timestamps and play the video at it
designated time. Which results in dropping the missing/incomplete
frames. VLC also logs every violation of the MPEG specification, that is
why you get all the errors.
It seams that Windows Media Player does not follow the official MPEG 1/2
specification if it just plays the file without support from the server end.
> So I wonder how VLC is designed to deal with Packet loss. I wish I could
> improve it, but I don't know where should I begin.
You cannot really recover from the packet loss. The only thing that can
be done is hoping the decoder has enough time left to fill in the blanks
with adjecent macro blocks or blocks from the previous frame. Ask this
question on the vlc-devel at videolan.org list. There are more people with
knowledge of MPEG 1/2 specifications.
Hopefully this gives you some more insight in the *problem* of dropping
packets from a stream.
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html
If you are in trouble, please contact <postmaster at videolan.org>
More information about the vlc-devel