tags:

views:

49

answers:

1

Hello.

I want to run ffmpeg from java as external process. After several minutes I want to stop it. It asks me to click 'q', and it works in console, but when I try to write 'q' to its stdin (process.getOutputStream() using java -- it does not work.

I just take "c", convert it to byte using ASCII charset, write it to the stream, flush it and close it. Ffmpeg does not stop.

I briefly looked in its sources, and found that it uses getch() function which is (according to manual) "reads character from associated terminal".

ffmpeg could also stop by signal, but it does not work in windows too.

Does anybody know how to solve my issue?

And yes: I do really want to run ffmpeg as external program. I know about xuggle, but it does not work for me, I need bare ffmpeg, and I do not want to write JNI myself now.

Thank you!

A: 

See, readch() reads one character from terminal keyboard, not input stream! In *nix it uses ioctl, in windows (I believe) some kind of Console API.

Looks like I can't stop ffmpeg from java with out of JNI:(

Ilya Kazakevich