[FFmpeg-devel] [PATCH] PES Packet Length to 0 for video in TS

Graham Booker gbooker at cod3r.com
Tue Apr 15 01:37:31 CEST 2014


On Sat, Apr 12, 2014 at 7:51 AM, Kieran Kunhya <kierank at obe.tv> wrote:

> On 12 April 2014 05:43, Graham Booker <gbooker at cod3r.com> wrote:
> > I propose that PES packet lengths in TS should be set to 0 for video
> > streams.  Patch attached as reference.
> >
> > The rational for this is another issue that plex has exposed.  When it is
> > conducting a transcode of video to HLS for streaming, my father noticed
> > artifacts when played on his GoogleTV (NSZ-GT1).  He sent me a test file
> > and I reproduced it on my device of the same model.  It is important to
> > note that the artifacts were not present when streaming to VLC or
> QuickTime
> > Player.  I copied the command-line that plex used, and conducted all of
> the
> > following tests using FFmpeg git.
> >
> > Transcode to HLS: artifacts on playback
> > Transcode to TS: playback is fine
> > Cat HLS segments into a single TS: playback is fine
> > Segment single TS file to segments: artifacts on playback
> > Segment single TS file to segments using Apple's HLS segmenter: playback
> is
> > fine
> >
> > At this point I carefully examined the differences between Apple's HLS
> > segmenter output and FFmpeg's.  Among the considerable differences, I
> > noticed that the video PES packets always had a 0 length.  So I
> continued:
> >
> > Transcode to HLS using FFmpeg with 0 length PES packets: playback is
> fine.
> > Segment single TS to segments with 0 length PES packets: playback is
> fine.
> >
> > All failures mentioned are only on the GTV since it is the only player on
> > which I could reproduce artifacts.  I only tested the GTV, VLC, and
> > QuickTime Player though, so my test case is limited.  I do not know if
> > other players exhibit this issue.
> >
> > Since it was useful last time, I have uploaded the test file as
> > hls_pes_packet_length.m4v along with its associated txt file which
> contains
> > the transcode command-line that was used.
> >
> > Thank you for taking the time to look into this.
> >
>
> Should be OK. I'm not sure if this should be restricted to MPEG-2 and
> MPEG-4 though.
>

That could be.  The spec only states that it may be 0 only for video
elementary streams.  There could also be others in the list, perhaps maybe
VC1 or VP8.  I don't know enough about the TS/PES streams to say one way or
the other.


More information about the ffmpeg-devel mailing list