bytedeco / javacv-examples

Examples of using JavaCV / OpenCV library on Java Virtual Machine
340 stars 155 forks source link

opencv2_cookbook chapter11 example can't run #12

Closed xray1111 closed 7 years ago

xray1111 commented 7 years ago

Examples in chapter11 can not run properly under ubuntu 16.04 or windows7, just showing the errror "failed to open input video", any suggestion? Thanks!


[info] Running opencv2_cookbook.chapter11.Ex1ReadVideoSequence 
[error] Exception in thread "main" java.lang.IllegalArgumentException: requirement failed: Failed to open input video
[error]     at scala.Predef$.require(Predef.scala:277)
[error]     at opencv2_cookbook.chapter11.Ex1ReadVideoSequence$.delayedEndpoint$opencv2_cookbook$chapter11$Ex1ReadVideoSequence$1(Ex1ReadVideoSequence.scala:29)
[error]     at opencv2_cookbook.chapter11.Ex1ReadVideoSequence$delayedInit$body.apply(Ex1ReadVideoSequence.scala:23)
[error]     at scala.Function0.apply$mcV$sp(Function0.scala:34)
[error]     at scala.Function0.apply$mcV$sp$(Function0.scala:34)
[error]     at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
[error]     at scala.App.$anonfun$main$1$adapted(App.scala:76)
[error]     at scala.collection.immutable.List.foreach(List.scala:378)
[error]     at scala.App.main(App.scala:76)
[error]     at scala.App.main$(App.scala:74)
[error]     at opencv2_cookbook.chapter11.Ex1ReadVideoSequence$.main(Ex1ReadVideoSequence.scala:23)
[error]     at opencv2_cookbook.chapter11.Ex1ReadVideoSequence.main(Ex1ReadVideoSequence.scala)
java.lang.RuntimeException: Nonzero exit code returned from runner: 1
    at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) Nonzero exit code returned from runner: 1
[error] Total time: 11 s, completed 2017-2-10 14:32:44
sbt:opencv2_cookbook> 
jpsacha commented 7 years ago

The issue is most likely caused by missing video support in standard javacpp-presets opencv binaries. See the javacpp-presets opencv cppbuild.sh line 93:

-DWITH_FFMPEG=OFF -DWITH_GSTREAMER=OFF

Can you rise the question about the lack of video support with the javacpp-presets project?

saudet commented 7 years ago

Actually, Jarek, the idea is to use FFmpegFrameGrabber...

jpsacha commented 7 years ago

@saudet OK. I will rework examples to use 'FFmpegFrameGrabber', so they work with standard binaries.

jpsacha commented 7 years ago

@xray1111 The video examples are now rewritten to use FFmpegFrameGrabber instead of VideoCapture to make them work again.

xray1111 commented 7 years ago

Thanks a lot, I'll try it soon. @jpsacha