bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.54k stars 1.58k forks source link

Question/Issue : FrameGrabber$Exception: Error: Could not create camera capture. #154

Closed arvind-das closed 9 years ago

arvind-das commented 9 years ago

Hi Samuel

I had a good play with JavaCV and its cool almost finished building my video recording tool with this. Now, I created a recoding jar to place it on some commodity hardware and then execute this runnable jar. Machine is running ubuntu 14.04_x64 and on 1Gig of RAM.

Problem is: until i start cheese on that machine, I will get this error

com.rrdtech.recorder.javacv.FrameGrabber$Exception: cvCreateCameraCapture() Error: Could not create camera capture.
    at com.rrdtech.recorder.javacv.OpenCVFrameGrabber.start(OpenCVFrameGrabber.java:177)
    at com.rrdtech.recorder.javacv.CustomFFmpegFileSystemRecorder.startRecord(CustomFFmpegFileSystemRecorder.java:46)
    at com.rrdtech.api.reordingapp.App.main(App.java:17)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)

But Once cheese is started and closed, my jar will start working fine. Is there anything that is triggered that recording starts happening. I am making my head on the wall for this reason . Can you help me out ?

saudet commented 9 years ago

FFmpeg usually works better than OpenCV to grab from a webcam under Linux. Something like this should work:

FrameGrabber grabber = new FFmpegFrameGrabber("/dev/video0"); // for the first camera
grabber.setFormat("video4linux2");
grabber.start();

Let me know if you're still having issues though! Thanks

arvind-das commented 9 years ago

Sorry for late reply, Actually Still facing issues. Audio is not recorded now. One strange thing I came up with is, the machine I am recording on , does not list capturing devices with arecord -l until I start cheese (ubuntu recording app) and close it, then it lists my attached usb camera. don't know why is that happening.

saudet commented 9 years ago

Doesn't sound like an issue related to JavaCV...

arvind-das commented 9 years ago

exactly, so following askubuntu and other sites

MuthuEphron commented 8 years ago

Please give the sample code for supporting live streaming mp4 videos using javaCV. I use code from the below url

http://www.walking-productions.com/notslop/2013/01/16/android-live-streaming-courtesy-of-javacv-and-ffmpeg/

saudet commented 8 years ago

@MuthuEphron Try out this sample: https://github.com/bytedeco/javacv/blob/master/samples/RecordActivity.java

MuthuEphron commented 8 years ago

i don't need to store images on sdcard.. I gave rtmp url to record the video format mp4 videos. i use javaCV 0.8 jar . but i got fatal signal 8 error in android mobile.. thanks for help .

saudet commented 8 years ago

@MuthuEphron Try again with JavaCV 1.1

MuthuEphron commented 8 years ago

@saudet You have to record frame are convert to video.mp4 files. i need rtmp url live streaming videos in mp4 format. but i work in java CV 1.1 . the mp4 and flv video is working. and it can't display(any video format) in wowza streaming engine software. thanks.

Also I use rtsp url but i got the exception in org.bytedeco.javacv.FrameRecorder$Exception: avio_open error() error -1330794744: Could not open 'rtsp://10.0.0.136:1935/live/myStream'

saudet commented 8 years ago

@MuthuEphron If you want to grab frames, use FFmpegFrameGrabber. Anyway, this has nothing to do with this issue, so please post your questions on the mailing list. Thanks

MuthuEphron commented 8 years ago

@saudet i record the video in format of mp4 and flv. but not streaming in wowza media streaming engine software

kaleemTorres commented 8 years ago

Hi @MuthuEphron did you get any solution for this issue. I am facing the same issue.Unable to stream video