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

Luca Abeni lucabe72
Fri Jan 20 15:44:06 CET 2006


Hi M?ns,

On Fri, 2006-01-20 at 14:08 +0000, M?ns Rullg?rd wrote:
[...]
> Seeking capability should be irrelevant.  The TS demuxer doesn't use it, and
> the h264 decoder certainly doesn't need it.
Yes, you are right. I just discovered (see my last mail) that the
problem is triggered by the fact that read returns less than the
requested amount of bytes.

> I can't reprocduce the problem.  Do you get the error if you encode to a file
> and run "cat test.ts | ffmpeg -i -" ?
I just tried, and in this case the problem does not happen. By running 
"cat test.ts | strace ffmpeg -i -"
I can see that all the read()s return the requested amount of bytes:
read(0, "G@\21\21\0B\260%\0\1\301\0\0\0\1\377\0\1\374\200\24H\22"..., 32768) = 32768
read(0, "\305\23\212\'\24O\324|~(\236\30\250\370\374Q8\242q\304"..., 32768) = 32768
read(0, "\4\2P\376\16\0\4\200\0@\24\3108\0\22\0\1\0S?\t-\33\350"..., 32768) = 32768
...
I think this happens because "cat" is writing in the pipe big amounts of
data very fast (it does not have to transcode anything :), so when
ffmpeg tried to read 32768 bytes they are already in the pipe buffer.


If you, instead, run
./output_example source.avi
./ffmpeg -i source.avi -vcodec h264 -f mpegts - | ./ffmpeg -i -
I'm pretty sure you'll see the problem too: I just did a cvs checkout
from scratch, so I certainly use the latest version :)
(if needed, I can publish "source.avi" somewhere, but it's easier to
generate it with output_example... There is no .ts file to post, because
the problem only occours when the TS is created "on the fly"). 

If you apply something similar to the workaround I sent in my last email
(modifying libavformat/file.c:pipe_read() instead of
libavformat/file.c:file_read()), you will see that it "hides" the bug,
confirming my analisys (I think): with such patch applied, 
./ffmpeg -i source.avi -vcodec h264 -f mpegts - | ./ffmpeg -i -
works ok.
If you apply the workaround I sent in the last mail without modifying
it, you will need to do
./ffmpeg -y -i source.avi -vcodec h264 -f mpegts pipe.ts | ./ffmpeg -i pipe.ts
to use it.


			Thanks,
				Luca
-- 
_____________________________________________________________________________
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
 
 Sponsor:
 Prestiti e Finanziamenti con un semplice click, scopri subito se sei finanziabile cliccando qui
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=2910&d=20-1





More information about the ffmpeg-devel mailing list