Problem with IContainer.open()

941 views
Skip to first unread message

Pame Clunes

unread,
Apr 15, 2012, 1:59:47 AM4/15/12
to xuggler-users
Hello, I am presenting a problem with the open() method in the
IContainer class. I wonder if you could give me some light to find out
what the problem is.

When I do this:

1 FileInputStream fs = new FileInputStream("/home/pame/Desktop/
video.MOV");
2 BufferedInputStream bs = new BufferedInputStream(fs);
3 DataInputStream in = new DataInputStream(bs);

4 IContainer container = IContainer.make();
5 IContainerFormat format = IContainerFormat.make();
6 format.setInputFormat("mp4");

7 container.setInputBufferLength(in.available());
8 container.open(in, format);


The program gets stuck at line 8, using 100% cpu. I've tried catching
possible exceptions, looking for errors and nothing happens, it just
gets stuck.

When I use the open method like this:
container.open("/home/pame/Desktop/video.MOV", IContainer.Type.READ,
null, true, false)

or in any way that doesn't involve inputstreams o datastreams, etc.
(i.e. just using the path to the file) it works perfectly.

The problem is that the application I need to program requires me to
open the container from a ByteArrayInputStream and not from the file
path.

Any help that you could give me to find out the problem would be
greatly appreciated.

Pamela.

PD: In case it helps, I checked out the xuggler version I'm using on
february 20 2012.

Teddy Yueh

unread,
Apr 16, 2012, 12:22:22 PM4/16/12
to xuggle...@googlegroups.com
I am successfully opening reading containers with InputStream's using IContainer.open(InputStream input, IContainerFormat format, boolean streamsCanBeAddedDynamically, boolean queryStreamMetaData). However, I pass in null for format and true for the boolean args. I see that your format is not null. In Xuggler 5.4, there is a bug that doesn't allow writing to OutputStream's. A fix for this is scheduled for Xuggler 5.5 and perhaps will fix your issue as well. For now, try not providing a format and letting Xuggler/FFMPEG figure out what it is.

Teddy

Pame Clunes

unread,
Apr 16, 2012, 10:12:46 PM4/16/12
to xuggler-users
Hello, thank you very much for your reply...
Unfortunatelly that didn't help :( The program still hungs when
trying to open the container. My code snippet follows in case you can
find something weird in it. And thanks again!

1 File file = new File("home/pame/Desktop/test.MOV");
2 FileInputStream fs = new FileInputStream(file);
3 BufferedInputStream bs = new BufferedInputStream(fs);
4 DataInputStream in = new DataInputStream(bs);
5
6 IContainer container = IContainer.make();
7
8 container.setInputBufferLength(in.available());
9 int ret = container.open(in, null, true, true);

Pamela.

Michael

unread,
Apr 17, 2012, 12:53:06 PM4/17/12
to xuggle...@googlegroups.com
In some of my implementations when setting "queryStreamMetaData" to true, the stream waits almost indefinitely. As the doc says: "aQueryStreamMetaData - If true, open() will call queryStreamMetaData() on this container, which will potentially block until it has ready enough data to find all streams in a container. If false, it will only block to read a minimal header for this container format." I would experiment with setting that to false, and see what happens.

int ret = container.open(in, null, true, false);

I also do not know if you need/want to consider streams being added dynamically. If not you can set this option to false also. "aStreamsCanBeAddedDynamically - If true, open() will expect that new streams can be added at any time, even after the format header has been read."

int ret = container.open(in, null, false, false);

-Mike

Pame Clunes

unread,
Apr 17, 2012, 10:11:12 PM4/17/12
to xuggler-users
Hi Mike, thank you for your reply. Unfortunately I tested that too,
right after I posted my last reply... and it didn't work either...
Could this be a problem with my videos?
I am using videos generated by a Kodak digital camera, so I would
expect them to be OK... Besides, I can open them without problem when
it's not with InputStream..

Do you guys have any other ideas? I've been testing different ways of
generating the InputStream too (i.e int ret = container.open(fs, null,
true, true) from my code snippet before), and passing false to all
booleans as you suggested... Nothing seems to work :(

Thanks again!

Pamela.



On Apr 17, 12:53 pm, Michael <itala...@gmail.com> wrote:
> In some of my implementations when setting "queryStreamMetaData" to true,
> the stream waits almost indefinitely. As the doc says: "aQueryStreamMetaData- If true, open() will call

Teddy Yueh

unread,
Apr 18, 2012, 5:04:16 PM4/18/12
to xuggle...@googlegroups.com
If you look at my previous post to your thread, I noted a bug with OutputStream and said perhaps it's the same with InputStream. If it works when it's not an InputStream, then perhaps I am correct. The thing to do is either wait for Xuggler 5.5 or build it yourself. I have the necessary change in another thread in this group.

Teddy

Pame Clunes

unread,
Apr 19, 2012, 9:57:00 PM4/19/12
to xuggler-users
Oh! Ok, thank you so much for your help... I'll try that hoping it
fixes my problem too :)
I'll let you know, thank you for your help. If you happen to have any
other ideas I could try I would be very grateful, of course!

Bye

Pame Clunes

unread,
Apr 19, 2012, 10:20:38 PM4/19/12
to xuggler-users
Hello again... Unfortunately, the fix didn't help me :(
I'll keep trying but if you have more ideas, please let me know!
Thank you!

Pamela.

Guilherme Vieira

unread,
Apr 24, 2012, 10:03:00 AM4/24/12
to xuggle...@googlegroups.com
Em quinta-feira, 19 de abril de 2012 23h20min38s UTC-3, Pame Clunes escreveu:
> Hello again... Unfortunately, the fix didn't help me :(
> I'll keep trying but if you have more ideas, please let me know!
> Thank you!
>
> Pamela.
>
> On Apr 19, 9:57 pm, Pame Clunes
Em quinta-feira, 19 de abril de 2012 23h20min38s UTC-3, Pame Clunes escreveu:
> Hello again... Unfortunately, the fix didn't help me :(
> I'll keep trying but if you have more ideas, please let me know!
> Thank you!
>
> Pamela.
>
> On Apr 19, 9:57 pm, Pame Clunes
Hello,

i actually have the same problem! it get stuck on IContainer.open()
to be more exactly, it got stucket on the native method public static final native int IContainer_open__SWIG_1(long l, com.xuggle.xuggler.IContainer iContainer, java.lang.String s, int i, long l1, com.xuggle.xuggler.IContainerFormat iContainerFormat, boolean b, boolean b1); on XugglerJNI.

i also tried all the ideas above and just like pame i got nothing. i didn't install anything, just put on my pom.xml this:
<dependency>
<groupId>xuggle</groupId>
<artifactId>xuggle-xuggler</artifactId>
<version>5.4</version>
</dependency>
<dependency>
<groupId>xuggle</groupId>
<artifactId>xuggle-utils</artifactId>
<version>1.22</version>
</dependency>

is that all? that could be a version problem? will wait for version 5.5

thanks,

Guilherme
Reply all
Reply to author
Forward
0 new messages