ERROR org.ffmpeg - [mpeg4 @ 0x7fc22385d600] rc buffer underflow

355 views
Skip to first unread message

Ivan Markovic

unread,
Apr 12, 2012, 7:37:40 PM4/12/12
to xuggler-users
I have searched the lists and found no answer to this issue, so hoping
someone out there has seen this problem...

I am creating a .mov file from a series of BufferedImage frames; the
output is MPEG compressed and I always see this error; having said
that the output it generates is fine... it views perfectly in
QuickTime and uploads to YouTube, however it fails to play inside
Xuggler and also causes problem with VLC. I am really stuck now as I
need to be able to play these movies locally now.

I have included my container initialization settings below:


outContainer = IContainer.make();
outContainer.open("/Products/YouTube/properties/" + propertyRef + "/
Property.mov", IContainer.Type.WRITE, null);

outStream = outContainer.addNewStream(0);
outStreamCoder = outStream.getStreamCoder();

ICodec codec = ICodec.findEncodingCodec(ICodec.ID.CODEC_ID_MPEG4);

outStreamCoder.setFlag(IStreamCoder.Flags.FLAG_QSCALE, false);
outStreamCoder.setNumPicturesInGroupOfPictures(YTUtil.FRAME_RATE);
outStreamCoder.setCodec(codec);

outStreamCoder.setPixelType(IPixelFormat.Type.YUV420P);
outStreamCoder.setHeight(height);
outStreamCoder.setWidth(width);
outStreamCoder.setGlobalQuality(0);
IRational frameRate = IRational.make(1, YTUtil.FRAME_RATE);
outStreamCoder.setFrameRate(frameRate);
outStreamCoder.setTimeBase(frameRate);
outStreamCoder.setProperty("threads", "16");
outStreamCoder.setProperty("b", "7000k");
outStreamCoder.setProperty("minrate", "7000k");
outStreamCoder.setProperty("maxrate", "7000k");
outStreamCoder.setProperty("bufsize", "7000k");

outStreamCoder.open();
outContainer.writeHeader();

Teddy Yueh

unread,
Apr 17, 2012, 3:56:09 PM4/17/12
to xuggle...@googlegroups.com
Which version of Xuggler are you using?  If you're using the newest one, you probably want something like this:

outContainer = IContainer.make(); 
outContainer.open("/Products/YouTube/properties/" + propertyRef + "/Property.mov", IContainer.Type.WRITE, null); 
ICodec codec = ICodec.findEncodingCodec(ICodec.ID.CODEC_ID_MPEG4);
outStream = outContainer.addNewStream(codec);
outStreamCoder = outStream.getStreamCoder(); 

Adding a stream with addNewStream(int) is deprecated and setting the codec will remove previously set properties (in your post, I'd assume the flag and num pics are lost).

It looks like you're trying to force the output bitrate to be 7000k. Unfortunately, I don't beleve those props do what you think they do. The output will vary as necessary since one frame can be larger than another frame. Have you tried setting the bitrate and bitrate tolerance using the IStreamCoder directly?

Teddy

Ivan Markovic

unread,
Apr 17, 2012, 5:49:43 PM4/17/12
to xuggle...@googlegroups.com
Teddy,

I am using 3.4 at the moment.

I have tried to use 5.2 and 5.4 but I am just seeing blank video files; the file is the correct size but all the frames are black. I have tried everything but I can't work out what's going on with v 5.x. I tried changing the code and removing all the flags and just using

writer = ToolFactory.makeWriter("/Products/YouTube/properties/Testing/" + propertyRef + ".mov");
writer.addVideoStream(0, 0, ICodec.ID.CODEC_ID_MPEG4, WIDTH, HEIGHT);

but that too generated exactly the same 'blank' output. All I have done is change the ,jar files and nothing else! I have tried all the variations of the various 5.x jars and had no joy whatsoever. I am on OX 1.7.3 and Java 1.6.x and am using NetBeans. I am a Java programmer of 16 years experience so I'm not a novice… I have posted a note with regard to my 5.x issues but so far no luck resolving that either!

Anyway back to the buffer issue and your reply. I have moved the

outStreamCoder.setCodec(codec);

line but that makes no difference. I have been playing with the flags and I have managed to control the file size; it does seem to be setting the compression for the video.

With regard to IStreamCoder, I do not know how to set the bit rate and tolerance within that class. Is there an example anywhere?

You mentioned that some code has been deprecated (although I can't get 5.x to function) is there any documentation on this? Again I have looked and looked and seen nothing. Checked all the examples and tutorials; they appear all to be unchanged.

Thanks.

I v a n ...
---------------------------------------------------------------------
Ivan Markovic
SculptLight
http://www.sculptlight.com
Mobile (+44) (0)751 3053944
Office (+44) (0)20 7243 3696

> --
> 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/-/oYCE5lg-js8J.
> 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.

Reply all
Reply to author
Forward
0 new messages