Joe
I'm just starting to dig into the details but like you I'm interested in
all the frames. I can get around it by adding a couple of blank frames
at the end of encoding process but that seems just wrong and I've cussed
and sworn at people who leave me code like that.
The only clue I have right now is that the position and size of the last
packet read do not add up to the full length of the file. The call to
container.readNextPacket(packet) is returning a negative value. I
wonder if there might be some partial buffer with data that's not
getting processed.
The fact that you're missing 2 frames is changing my theories. Are you
sure both frames are in the stream and readable? I'm just trying to
understand how the reading terminates.
Joe
private static void updateJavaWindow(BufferedImage javaImage)The main problem is that the last frame is never marked complete.
{
mScreen.setImage(javaImage);
mScreen.paint(mScreen.getGraphics());
}
while(container.readNextPacket(packet) >= 0)
{
offset = 0;
while(offset < packet.getSize())
{
bytesDecoded = videoCoder.decodeVideo(picture,packet,offset);
offset += bytesDecoded;
if (picture.isComplete())
{
...
}
}
}
--
You received this message because you are subscribed to the Google Groups "xuggler-users" group.
To post to this group, send email to xuggle...@googlegroups.com.
To unsubscribe from this group, send email to xuggler-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/xuggler-users?hl=en.
Joe
Joe
What language are you using? Looks like JavaScript (which I didn't know
was supported).
Perhaps that's why you're missing 2 frames and I'm missing one while
ffmpeg gets them all.
I tried that and I get an error with the IVideoPicture containing the
next to last image.
I will now see if I can understand the source code of ffmpeg enough to
figure out what it's doing differently.
Joe
I am using IMediaWriter to create the output file. If I call
encodeVideo with a null IVideoPicture parameter it throws an
IllegalArgument exception. Also IMediaWriter.encodeVideo has a void
return type and nothing comes back.
I do call IContainer.flushPackets() and IMediaWriter.close().
The output file displays all frames in MoviePlayer(ubuntu), Pitivi,
ffmpeg and Windows Media Player so I have a hard time believing the
problem is in the writer, but I've been wrong about stuff like this more
times than I can count so I am open to suggestions.
Joe
I still can't get the hack you suggest to have any effect.
We can figure out the amount of data unprocessed by the position and
size of the last packet processed and the size of the file.
Every thing I've tried seems to suggest the packet that returns the
error (for me) is empty or not valid.
The error code returned by container.readNextPacket(packet) is not a
valid error number for me, it's -541478725 which is type and description
unknown.
Joe
I think AV_PKT_FLAG_KEY is the Key Frame flag we can set.
I tried creating a new IPacket and setting it as a key frame, complete
with size 0 and trying to decode it several times without luck.
When we figure this out, I don't think the "fix" belongs in top level
code. I hope we can come up with a flushInput call some where lower
level, either in the Java interface or native library if necessary.
Joe
thank you for your perseverance.
Joe
Would you please add it as an attachment if this allows them or post it
somewhere?
Joe
On 05/30/2011 10:26 AM, DavidP wrote:
--
You received this message because you are subscribed to the Google Groups "xuggler-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/xuggler-users/-/80bDbXbmQk4J.
To post to this group, send email to xuggle...@googlegroups.com.
To unsubscribe from this group, send email to xuggler-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/xuggler-users?hl=en.
I think I figured it out. It seems that the decoder somewhere is maintaining a buffer of frames and so when you read packets, it's always behind except that when it gets to the end of the stream, it just stops without returning those final frames (a bug in Xuggler?). However to get at them, all you have to do is execute a seek operation because all the frames that are decoded immediately following a seek are actually the buffered frames that had been decoded previously (which means that doing a seek, doesn't immediately put you where you expect).As an example, if we assume a video with 500 frames (0-499) and an offset/buffer of 10 frames, the last frame that will be read before the reader stops is 489. If you want frame 490, you have to seek to frame 489 (seek to the nearest keyframe and then read up and including 489). Then just seek to frame 0. The very next frame decoded from the next packet will be frame 490 and 491 after that, etc. Of course if you actually wanted frame 0 from that seek, you'll have to read and throw away frames 490 through 499 before you'll get to frame 0 from the seek.
--
You received this message because you are subscribed to the Google Groups "xuggler-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xuggler-user...@googlegroups.com.
Visit this group at http://groups.google.com/group/xuggler-users.
For more options, visit https://groups.google.com/d/optout.
Hi all,
Im having a problem decoding an entire h264 video. I decode all
IVideoPictures, EXCEPT the last two. Below is the code (scala) I use
to count the number of complete IVideoPictures. (Im using Xuggler 3.4)
The sample.mp4 is created by:
wget http://www.fastvdo.com/264codec/streams/qcif/FVDO_Freeway_qcif.264
ffmpeg -i FVDO_Freeway_qcif.264 -vcodec libx264 -vpre slower
sample.mp4
If you print out the information (MP4Box -info sample.mp4) about the
clip, I can confirm that the clip has 232 frames...
* Movie Info *
Timescale 1000 - Duration 00:00:09.220
Fragmented File no - 1 track(s)
File Brand isom - version 512
Created: GMT Fri Jan 2 00:00:00 1970
Track # 1 Info - TrackID 1 - TimeScale 50 - Duration 00:00:09.220
Media Info: Language "Undetermined" - Type "vide:avc1" - *******232
samples*******
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 176 x 144 - Profile High @ Level 1.2
The below program prints out 230! Where are the last two frames???
(I can confirm its the last two that are missing because I made JPG of
each IVideoPicture) What am I doing stupid??
import _root_.com.xuggle.xuggler._
import _root_.com.xuggle.xuggler.video._
object VideoDecoder2 extends Application with Loggable {
var count = 0
val container = IContainer.make();
container.open("sample.mp4", IContainer.Type.READ, null)
val stream = container.getStream(0)
val videoCoder = stream.getStreamCoder()
videoCoder.open()
val packet = IPacket.make();
while (container.readNextPacket(packet) >= 0) {
val picture = IVideoPicture.make(videoCoder.getPixelType(),
videoCoder.getWidth(), videoCoder.getHeight());
var offset = 0;
while (offset < packet.getSize()) {
val bytesDecoded = videoCoder.decodeVideo(picture, packet,
offset);
offset += bytesDecoded;
if (picture.isComplete()) {
count += 1
}
}
}
logger.info("" + count)
}