[Ffmpeg-devel] Strange problem with H.264 video in MPEG2 TS...

Luca Abeni lucabe72
Fri Jan 20 15:17:01 CET 2006

Hi all,

On Fri, 2006-01-20 at 11:48 +0100, Luca Abeni wrote:
> I am analysing the problem with the help of strace, and it seems that
> the problem is due to the fact that sometimes read() from pipe returns
> less bytes than the requested amount.
> In other words, strace produces lines like
> read(3, "\4oP\33\372\230\311#\30\26\243\207\340\2064\10\21\r\340"..., 8192) = 6660
> I do not know why, but it seems that the mpeg1,2,4 decoders in ffmpeg
> can correctly cope with this situation, but the h264 decoder cannot...
After some investigation, I think that this is the problem: when read()
returns less than the requested amount of bytes, libavformat cannot
properly parse a TS containing H.264 video (it can properly parse a raw
H.264 stream, or a TS containing MPEG1,2,4 video).

If, instead, file_read() returns the requested amount of bytes (as when
reading from a file) then libavformat can properly parse a TS containing
H.264 video. As a proof, I developed the attached patch. It is not
intented for inclusion (since I think that it just hides the real), but
it is only a workarond... With the patch applied, ffmpeg can properly
parse a TS containg H.264 video even if it is read from a named pipe.

Now, I am trying to understand where the real bug is, but I am
completely lost... I tried to look at libavformat internals, to
understand how the fps is computed, but I still have no clue.
Does anyone have any hint about how to identify the real bug? I do not
know the libavformat internals very much, so a short summary about how
the pts and dts fields are computed/assigned (with maybe a description
of the codepath involved) would help a lot...

Copy this in your signature, if you think it is important:
                               N O    W A R ! ! !

 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 Telefonare all'estero risparmiando fino all'80%? Con Email.it Phone Card puoi, clicca e scopri tutti i vantaggi
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=2683&d=20-1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pipe-workaround.diff
Type: text/x-patch
Size: 848 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060120/c08c6f96/attachment.bin>

More information about the ffmpeg-devel mailing list