Closed GoogleCodeExporter closed 9 years ago
We'll see what we can do for 3.1
Original comment by art.cla...@gmail.com
on 7 Jul 2009 at 3:53
Should be fixed in r798.
Nitty gritty detail:
When you set the time base of an IStreamCoder to 1/frame-rate, you have the
advantage
of working in a time base that most codecs (e.g. WM2) that support that frame
rate
can work with.
The downside is you need to convert between stream timebases (for example, in
your
input file the FLV stream has a resolution of 1/1000, but when re-encoding as
FLV
Converter.java, the frame-rate of the output and hence the encoder's timebase is
1/(29.92)) and rounding can occur.
This resulted in Xuggler eventually getting rounding errors when converting
timestamps, which would eventually lead to Xuggler trying to encode two
pictures with
the same timestamp -- which MPEG2 encoders generally can't handle.
There are two solutions to the problem:
One, if Xuggler detects that timestamps are going to overlap after conversion,
it
will drop the second picture. The change I committed does that. You can use
IStreamCoder.getNumDroppedFrames() to see how many frames have been dropped
since the
last call to IStreamCoder.open()
The other work around (to ensure Xuggler-based programs don't drop pictures) is
to
set your IStreamCoder timebase to the highest resolution timebase your codec can
support (so for FLV, you could set it to 1/1000). In this case the rescaling
is a
no-op an no precision is lost. Converter.java doesn't do this because it has to
encode ANY format to ANY format and so must choose the
lowest-common-denominator, but
if you know you're always converting to FLV containers with the Screen FLV
encoder,
you can safely set your IStreamCoder timebase to 1/1000.
I'm sure that didn't make sense, but the result is your test file now
re-encodes with
Converter.java, although at the expense of having to drop a few frames here and
there
due to rounding problems (in your test file, about 1 out of 100 frames randomly
interspersed). See if you notice :)
See here for timebase concepts:
http://wiki.xuggle.com/Concepts
Original comment by art.cla...@gmail.com
on 9 Jul 2009 at 12:18
Hi Art
Your explanation makes a lot of sense, I read the Wiki you guys put up that
helped to
explain what time bases are and how the effect video, it was very helpful.
I will do both of the things you suggest. I will sync down and build the latest
"tip
of the tree" subversion source tree. I will also explicitly set the timbase for
my
output flv files to be 1/1000. My output in this case will always be flv so it
should work well for me.
Thanks
Declan
Original comment by harrison...@gmail.com
on 9 Jul 2009 at 8:47
Original issue reported on code.google.com by
harrison...@gmail.com
on 7 Jul 2009 at 3:39