GeorgeW
unread,Jul 22, 2010, 2:13:42 PM7/22/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to xuggler-users
I'm new to xuggler, and running into a small problem.
First off, a tiny bit of background. I'm attempting to decode H264
video in an .mkv container. The "video" in this case is not actual
video, but rather 40 separate (but similiar) 2048 x 2048 images from
an instrument that have been encoded as H264 using the x264 library.
The instrument generates a lot of these. (Sorry, I can't give more
information on the instrument, due to proprietary concerns...trust me,
the details are boring) The important thing here is that I need to
get all 40 frames out of the encoded "clips".
The data in the stream is structured as follows (Frame number/Frame
Type): 1/I, 4/P, 3/B, 2/b, 7/P, 6/B, 5/b.... which doesn't appears to
be the normal way streams containing b-frames are ordered.
Here's the problem I'm encountering. I get the packets out of the
IStream in the order shown above, as expected (1,4,3,2,7,6,5,...).
Then, I decode each of the packets, in order, calling decodeVideo()
repeatedly until IVideoPicture.isComplete() is true, which works fine
on the first packet.
Not surprisingly, I don't get the actual second decoded frame until
I've sent the 4th IPacket from the container (which is really frame
2). Until then, each call to decodeVideo() fills the IVideoPicture in
with a repeat of the first frame. Luckily, I can detect that using
getPts() on the decoded picture. So far, so good. The H264 decoder
is apparently buffering IPackets, and then returning the decoded
frames in order (1,2,3,4, etc.) as soon as it has enough packets
buffered to start reconstructing the stream properly.
I pull the IPackets out of the IStream from the IContainer, pass them
to the IStreamCoder (invoking decodeVideo()), and decoded frames
returned are in the follwoing order 1,1,1,2,3,4...37,38. I can detect
the repeats of frame 1 using getPts().
If I try a stream that's encoded with only single B-frames (1/I, 3/P,
2/B, 5/P, 4/B....), decoded frames are returned are 1,1,2,3,4,5..39.
If I get a stream encoded strictly as I and P frames, everything works
fine. (1,2,3...40).
My problem is that there doesn't seem to be a way to get the last two
frames out of the decoder using xuggler. If I use ffmpeg at the
command line, I can convert all of the images in the container to
jpegs (or any other format that ffmpeg supports) without any problem.
So, ffmpeg is clearly capable of flusing those last frames out.
Is there any way to get those last frames out using xuggler? I need
to do some frame by frame processing on these images, and there's
already a huge set of these clips generated. They were encoded using
the b-frames to save space (as I said, there are a *lot* of them), so
re-encoding them to a stream without b-frames is (sadly) not really an
option.
Any thoughts as to how to get xuggler to do what I need it to do?
Namely, decode an H264 stream containing B-frames, and get all of the
frames from the decoder.