Page Contents
Introduction
In the video below I look at how you can get started with video capture and image processing on the Beaglebone. It is an introductory video that should give people who are new to this topic a starting point to work from. I look at three different distinct challenges:
- How do you capture video from a USB webcam under Linux – I do this using the capture.c source code that uses Video4Linux to capture a raw stream from the USB camera. This raw stream is then wrapped with a H264 header using FFMPEG.
- How do you capture image frames from a USB webcam under Linux – I do this using the grabber.c source code that again uses Video4Linux to capture raw video frames in the uncompressed PPM format.
- How do you use OpenCV to capture and image process frames so that you can build computer vision applications under Linux on the Beaglebone – I do this using the boneCV.cpp program as described below. This code uses the OpenCV library which is available on the Angstrom distribution of the Beaglebone. Finally, I write a small program boneCVtiming.cpp to test the performance of the Beaglebone black for capturing and processing image data.
In this video I use a Logitech C920 and the Beaglebone Black. I would highly recommend both of these devices because of the processing power of the Beaglebone black and the high resolution capability of the C920. However, you should be able to adapt the code to any specific camera.
The Video
If you use this code or the content of the associated video in your research, please cite:
Molloy, D. [DerekMolloyDCU]. (2013, May, 25). Beaglebone: Video Capture and Image Processing on Embedded Linux using OpenCV [Video file]. Retrieved from http://www.youtube.com/watch?v=8QouvYMfmQo
Example OpenCV Images
Here are the two images that were captured during the course of the video:
The image on the left is the original image captured on the Beaglebone black using OpenCV, which has been encoded in PNG format. The image on the right is the edge detected version that was processed on the Beaglebone black using the OpenCV Sobel edge detector. Please press on these images for higher resolution versions.
Source Code
The code for this video is available at: github.com/derekmolloy/boneCV/ but the important code is presented below:
The OpenCV Code is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | /* boneCV.cpp * * Copyright Derek Molloy, School of Electronic Engineering, Dublin City University * www.derekmolloy.ie * * Redistribution and use in source and binary forms, with or without modification, are permitted * provided that source code redistributions retain this notice. * * This software is provided AS IS and it comes with no warranties of any type. */ #include<iostream> #include<opencv2/opencv.hpp> using namespace std; using namespace cv; int main() { VideoCapture capture(0); capture.set(CV_CAP_PROP_FRAME_WIDTH,1920); capture.set(CV_CAP_PROP_FRAME_HEIGHT,1080); if(!capture.isOpened()){ cout << "Failed to connect to the camera." << endl; } Mat frame, edges; capture >> frame; if(frame.empty()){ cout << "Failed to capture an image" << endl; return -1; } cvtColor(frame, edges, CV_BGR2GRAY); Canny(edges, edges, 0, 30, 3); imwrite("edges.png", edges); imwrite("capture.png", frame); return 0; } |
This is the main program discussed in the video. There is also a program to test the performance of the OpenCV Application:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | /* boneCVtiming.cpp * * Copyright Derek Molloy, School of Electronic Engineering, Dublin City University * www.derekmolloy.ie * * Redistribution and use in source and binary forms, with or without modification, are permitted * provided that source code redistributions retain this notice. * * This software is provided AS IS and it comes with no warranties of any type. */ #include<iostream> #include<opencv2/opencv.hpp> #include<time.h> using namespace std; using namespace cv; int main() { VideoCapture capture(0); capture.set(CV_CAP_PROP_FRAME_WIDTH,640); capture.set(CV_CAP_PROP_FRAME_HEIGHT,480); if(!capture.isOpened()){ cout << "Failed to connect to the camera." << endl; } Mat frame, edges; struct timespec start, end; clock_gettime( CLOCK_REALTIME, &start ); int frames=10; for(int i=0; i<frames; i++){ capture >> frame; if(frame.empty()){ cout << "Failed to capture an image" << endl; return -1; } cvtColor(frame, edges, CV_BGR2GRAY); Canny(edges, edges, 0, 30, 3); } clock_gettime( CLOCK_REALTIME, &end ); double difference = (end.tv_sec - start.tv_sec) + (double)(end.tv_nsec - start.tv_nsec)/1000000000.0d; cout << "It took " << difference << " seconds to process " << frames << " frames" << endl; cout << "Capturing and processing " << frames/difference << " frames per second " << endl; imwrite("edges.png", edges); imwrite("capture.png", frame); return 0; } |
The build script for these files is given in build (note the -lrt for the timing example):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #!/bin/bash echo "Video for Beaglebone Video Applications - derekmolloy.ie" echo "Building the OpenCV example for the Beaglebone" g++ -O2 `pkg-config --cflags --libs opencv` boneCV.cpp -o boneCV echo "Building the OpenCV timing example for the Beaglebone" g++ -O2 `pkg-config --cflags --libs opencv` -lrt boneCVtiming.cpp -o boneCVtiming echo "Building the Video4Linux frame capture program" gcc -O2 -Wall `pkg-config --cflags --libs libv4l2` grabber.c -o grabber echo "Building the Video4Linux capture example program" gcc -O2 -Wall `pkg-config --cflags --libs libv4l2` capture.c -o capture echo "Finished" |
-O2 means optimize for code size and execution time -O3 would optimize even more for execution time (O for optimize)
-Wall enables all possible compiler warning messages – should always be used to give the best possible code.
Make sure that you set the build script to be executable.
Performance and GPU Support
At the end of the video I discussed the performance of OpenCV on the Beaglebone. This would be greatly improved if there was support for the GPU that is present on the Beaglebone; however, a quick check using the code below indicates that GPU support is not available, nor do I think it would be easy to achieve. If you try to perform an operation such as:
1 2 3 4 5 6 7 8 | try{ cv::gpu::GpuMat input, output; input.upload(edges); cv::gpu::threshold(input, output, 128.0, 255.0, CV_THRESH_BINARY); } catch(const cv::Exception& e){ cout << "GPU operation failed" << endl; } |
You will get the following output error:
1 2 | OpenCV Error: No GPU support (The library is compiled without CUDA support) in mallocPitch, file /build/v2012.12/build/tmp-angstrom_v2012_12-eglibc/work/armv7a-vfp-neon-angstrom-linux-gnueabi/opencv-2.4.2-r3/opencv/modules/core/src/gpumat.cpp, line 749 GPU operation failed |
Hi Derek,
I am still waiting for my beaglebone board, so I tried on PC,
capture.c works. but when I build grab.c got error:
/dev/boneCV# gcc -O2 -Wall
pkg-config --cflags --libs libv4l2
grabber.c -o grabber/tmp/ccjiUTmf.o: In function
xioctl':
v4l2_ioctl’grabber.c:(.text+0x1c): undefined reference to
/tmp/ccjiUTmf.o: In function
main':
v4l2_open’grabber.c:(.text.startup+0x36): undefined reference to
grabber.c:(.text.startup+0x1ff): undefined reference to
v4l2_mmap'
v4l2_munmap’grabber.c:(.text.startup+0x482): undefined reference to
grabber.c:(.text.startup+0x492): undefined reference to `v4l2_close’
collect2: ld returned 1 exit status
Can you tell me why?
Thanks
Hi Lisa, I’m not sure – It’s strange that you have capture.c working but not grabber.c as they are using the same libraries. The setup may be different on your PC and it may need you to explicitly add -lv4l2 (and maybe even -lv4l1) to your gcc call, Derek.
Hi, this is the corrected build file for Ubuntu 12.04 on Beaglebone Black. A few changes needed to be made (libs must be after cpp, -lrt for timing and -lv4l2). It took me a while to figure it out.
#!/bin/bash
echo “Video for Beaglebone Video Applications – derekmolloy.ie”
echo “Building the OpenCV example for the Beaglebone”
g++ -O2
pkg-config --cflags opencv
boneCV.cpppkg-config --libs opencv
-o boneCVecho “Building the OpenCV timing example for the Beaglebone”
g++ -O2
pkg-config --cflags opencv
-lrt boneCVtiming.cpp -lrtpkg-config --libs opencv
-o boneCVtimingecho “Building the Video4Linux frame capture program”
gcc -O2 -Wall
pkg-config --cflags --libs libv4l2
grabber.c -lv4l2 -o grabberecho “Building the Video4Linux capture example program”
gcc -O2 -Wall
pkg-config --cflags --libs libv4l2
capture.c -o captureecho “Finished”
Thanks for that, Derek
Thanks Derek for all your great work!!! Just as a note, I have Ubuntu 13.10. I had to slightly modify the build script from the 12.04 script that Andy listed. I too had to put the .CPP files up front… but I had to keep the single quotes around the pkg-config:
#!/bin/bash
echo “Video for Beaglebone Video Applications – derekmolloy.ie”
echo “Building the OpenCV example for the Beaglebone”
g++ -O2 boneCV.cpp
pkg-config --cflags --libs opencv
-o boneCVecho “Building the OpenCV timing example for the Beaglebone”
g++ -O2 boneCVtiming.cpp
pkg-config --cflags --libs opencv
-lrt -o boneCVtimi\ng
echo “Building the Video4Linux frame capture program”
gcc -O2 -Wall grabber.c
pkg-config --cflags --libs libv4l2
-o grabberecho “Building the Video4Linux capture example program”
gcc -O2 -Wall capture.c
pkg-config --cflags --libs libv4l2
-o captureecho “Finished”
Hello Derek:
I just took a look at my post… for some reason the single quotes disappeared. Here is the build script again:
#!/bin/bash
echo “Video for Beaglebone Video Applications – derekmolloy.ie”
echo “Building the OpenCV example for the Beaglebone”
g++ -O2 boneCV.cpp
pkg-config --cflags --libs opencv
-o boneCVecho “Building the OpenCV timing example for the Beaglebone”
g++ -O2 boneCVtiming.cpp
pkg-config --cflags --libs opencv
-lrt -o boneCVtimingecho “Building the Video4Linux frame capture program”
gcc -O2 -Wall grabber.c
pkg-config --cflags --libs libv4l2
-o grabberecho “Building the Video4Linux capture example program”
gcc -O2 -Wall capture.c
pkg-config --cflags --libs libv4l2
-o captureecho “Finished”
Hi Lisa
we are facing the same problem,How were you able to solve the problem in you PC
Thank You
I got everything plugged in correctly and when im in dev I type in v4l2-ctl it says command not found. Im using a Windows 7 32-bit operating system. Where am I going wrong. It worked fine when I was at school but not at my home computer
thanks for reply.
I tried , still now work, I think maybe caused by some environment configuration.
I had the same error on my Ubuntu deployment. Got it to compile by linking in the lv4l2 library like this:
gcc -O2 -Wall
pkg-config --cflags --libs libv4l2
grabber.c -lv4l2 -o grabberHello Jon,
we were able to solve the problem by using the commands,
sudo apt-get install libv4l-dev
gcc grabber. -lv4l2 -o grabber
Hi,
While installing libv4l-dev ( sudo apt-get install libv4l-dev ), It couldn’t locate package. I am getting the folowing logs there. Please help me to overcome this issue.
root@beaglebone:~# apt-get install libv4l-dev
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package libv4l-dev
Guys, the pkg-config is an external command that finds the right library params. Which means pkg-config –cflags –libs libv4l2 should be isolated… so you can find its value separately and substitute it yourself in the compile command or.. add it like this: gcc -O2 -Wall $(pkg-config –cflags –libs libv4l2) grabber.c -lv4l2 -o grabber
Note the $() around the pkg-config command. bash go run that and substitute its value.. otherwise gcc will think it meant by the –cflags and –libs flags.
Here is the build file that worked for me without errors under beaglebone black kernel 3.2.0 psp:
#!/bin/bash
echo “Video for Beaglebone Video Applications . derekmolloy.ie”
echo “Building the OpenCV example for the Beaglebone”
g++ -O2 $(pkg-config –cflags opencv) boneCV.cpp $(pkg-config –libs opencv) -o$
echo “Building the OpenCV timing example for the Beaglebone”
g++ -O2 $(pkg-config –cflags opencv) -lrt boneCVtiming.cpp -lrt $(pkg-config -$
echo “Building the Video4Linux frame capture program”
gcc -O2 -Wall $(pkg-config –cflags –libs libv4l2) grabber.c -lv4l2 -o grabber
echo “Building the Video4Linux capture example program”
gcc -O2 -Wall $(pkg-config –cflags –libs libv4l2) capture.c -o capture
echo “Finished”
Hi jack!Looks like the command is not cotlepme WordPress automatically hidden part of the command because I used . Here is the cotlepme command, you have to substitute my_example with output filename and my_example.cpp with example source filenameg++ -o my_example my_example.cpp -lopencv_core -lopencv_imgproc -lopencv_calib3d -lopencv_video -lopencv_features2d -lopencv_ml -lopencv_highgui -lopencv_objdetect -lopencv_contrib -lopencv_legacyHope this helps!L.
Hey Derek, great video!
This is my first time working with the BBB and I’ve learned a lot.
It just so happens that I have a Logitech C910 to test this out with…albeit not the C920 like yours.
Notable it supports the same formats YUYV and MJPG but not H264. How can I adapt your code to capture a high quality video?
I was able to get something working with the following code, though it was low quality and would crash a few seconds in if I increased it to say 1920×1080:
ffmpeg -f video4linux2 -input_format mjpeg -i /dev/video0 -vcodec copy output.mkv
Also, I was able to play this in my Ubunto VirtualBox but not on my Windows 8 PC.
Thanks!
Ryan R.
Hi Derek, congratulations on an excellent video. Do you have any plans to extend this work to encompass using a BBB and a webcam to stream video via http?
Hi Derek,
This is really a great video. I am confuse with the video frame being captured.
Is the video frame being captured is in YUV color space or BGR? If it is YUV, how to convert to BGR?
Mok
Hi Derek,
Video was very helpful.I just wanted to ask will I be able to stream video in my laptop through x11 forwarding of camera output in beaglebone.when I check in cheese i get following error
(cheese:794): cheese-CRITICAL **: cheese_camera_device_get_device_node: assertion
CHEESE_IS_CAMERA_DEVICE (device)' failed
(cheese:794): GLib-CRITICAL **: g_variant_new_string: assertion string != NULL’ failed
(cheese:794): GLib-GIO-CRITICAL **: g_settings_schema_key_type_check: assertion
value != NULL' failed
(cheese:794): GLib-CRITICAL **: g_variant_get_type_string: assertion value != NULL’ failed
(cheese:794): GLib-GIO-CRITICAL **: g_settings_set_value: key ‘camera’ in ‘org.gnome.Cheese’ expects type ‘s’, but a GVariant of type ‘(null)’ was given
** (cheese:794): CRITICAL **: cheese_preferences_dialog_setup_resolutions_for_device: assertion `device != NULL’ failed
(cheese:794): Gdk-ERROR **: The program ‘cheese’ received an X Window System error.
This probably reflects a bug in the program.
The error was ‘BadMatch (invalid parameter attributes)’.
(Details: serial 566 error_code 8 request_code 72 minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the GDK_SYNCHRONIZE environment
variable to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
Trace/breakpoint trap
Hi Mr. Derek
First of all i would want to thank you for your valuable shares
after 1.5 hour of searching i found your web page because i faced a “COMPİLİNG SCTRİP” error and i solved this problem with your help..
but now i faced another problem which i wanted to share with you
my basic codes are just
#include
#include
using namespace cv;
#define CVX_RED CV_RGB(0xff,0x00,0x00)
#define CVX_BLUE CV_RGB(0x00,0x00,0xff)
int main(int argc, char **argv)
{
int derece=19;
int sayi;
CvMemStorage* bellek=cvCreateMemStorage();
CvSeq* ilk_contour=NULL;
IplImage* img =cvLoadImage(“ball.jpg”,CV_LOAD_IMAGE_COLOR);
IplImage *gri=cvCreateImage(cvGetSize(img), IPL_DEPTH_8U, 1);
IplImage *resmim= cvCreateImage(cvGetSize(img),IPL_DEPTH_8U, 1);
IplImage *resmim2= cvCreateImage(cvGetSize(img),IPL_DEPTH_8U, 3);
printf(“\n\n******CIKISLAR******”);
printf(“\n\nOrigin===%d\n”,img->origin);
printf(“\n\nResim Yüksekliği==>%d\n”,img->height);
printf(“\n\nResim Genişliği==>%d\n\n\n\n”,img->width);
printf(“Basarılı Resim Alımı\n”);
cvCvtColor(img, gri, CV_BGR2GRAY);
cvSmooth(gri,gri,CV_GAUSSIAN,5);
while(( (cvWaitKey(10)&0xff) != 27 ))
{
cvShowImage(“img”,img);
};
printf(“End Of The Program”);
}
when i run this program i can not use ESC for closing the programs because windows seems not to normal
i really need your opinion
thank you again
With my sincerely..
One word, AWESOME!!!!
Hi Derek, I never realized that it was so simple to start with openCV. Thanks a lot for the great video. I managed to grab hold of an old webcam (non-hd, max 640×480). The camera cannot do any h.264 compression. Infact, it only supports pixelformat 0 (not 1 as you indicated in the video).
Thanks
Rajah
Hi Derek,
Could you explain to me how to install the library openCV on embedded linux?
Hi, the OpenCV libraries are part of the standard Angstrom distribution for the Beaglebone. The alternative is to download the source code for OpenCV and build it yourself. Derek.
Hi Derek, I really appreciate the tutorials. However, I’ve been having trouble with the example code. I read your comment that OpenCV is built into the Angstrom distribution by default but I couldn’t seem to get the program to compile without errors (highgui issues especially). I was contemplating whether or not to install the libraries from the OpenCV website instead, but I wanted to ask first to see if I’m missing something. Also I can’t seem to get my USB camera (Logitech C270) to be recognized by the BeagleBone, any suggestions?
Thanks,
Hi Vanessa,
The procedure to configure openCV has been automatised. Go to the following link:
https://github.com/jayrambhia/Install-OpenCV/blob/master/Ubuntu/opencv_latest.sh
Look around that. See if anything helps you.
HI Derek,
i have the same issue of Rajah, the output.raw video is captured but its doesnt convert to .mp4 format…! please could u please me on this issue???
Hi, the steps that I gave are only for the exact same camera with the Beaglebone – I tried a lot of different things with FFMPEG before it worked and I’m afraid that if it doesn’t work for your camera that I am at a loss. Derek.
Very cool stuff. cool website btw. Keep up the good work!
hi,
does anyone know how i would have to build dereks programs from the bonecv package on a raspberry pi?
what i installed so far:
apt-get install v4l-utils v4l-conf libav-tools
so avconv (ffmpeg) and v4l2 are working on my system.
the errors from the build state:
No package ‘opencv’ found
No package ‘libv4l2’ found
guess i have to set libv4l2 to the PKG_CONFIG_PATH (wasnt able to locate the ‘libv4l2.pc’ file yet)
what about opencv? do i have to install it by hand? (apt-get was unsuccessful)
thx, great work derek
Thanks!
Got all working on my Raspberry Pi with Archlinux and Logitech C910.
I needed to install much packages… over 200 MB ^^
unfortunately my webcam does not support H264, it supports only MJPG and YUYV so I set it to MJPG.
opencv works perfectly! but with capture.c i have some troubles..
i modified capture.c and got it also working
PS. Note that i am a Linux newbie and I read just one C++ book so its a wonder that i got all working 😀
sry for bad english, I’m from germany
I’d like to hear more about running this on the Raspberry Pi, and how it compares performance-wise with the Beaglebone. Please do share. Thanks!
Could you post the code of capture.c for the C910
Hi Mr Derek, thanks for all the videos you made, it help me a lot to get started with my beaglebone black. However i have a question, im trying to run the grabber.c code with a 640×480 camera and it doenst work, you know what i can do? or you know what is the problem?
Thanks a lot!
Great tutorial, all aspect covered.
nice work
Hi Derek,
I’m trying to run the frame grabber code from within Qt, cross compiling to the Beaglebone and I’m having problems – I wonder if you can suggest something to try?
The libaries are in /usr/include/opencv2 and /usr/include/opencv (I installed using sudo add-apt-repository ppa:gijzelaar/opencv2 and sudo apt-get install libopencv-dev). When I run make after running qmake I get lots of errors such as “/usr/include/opencv/cv.h:63:33: error: opencv2/core/core_c.h: No such file or directory”. I had previously run “export PKG_CONFIG_PATH=/usr/lib/pkgconfig” which corrected $ pkg-config –cflags opencv giving -I/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/include/opencv.
Hope you can help?
David
I hope you don’t mind, Derek, I will answer my own question incase it of use to anyone else. I was having problems using opencv within Qt-creator. Here’s how I get Qt routines to compile using the opencv libraries.
I installed opencv into /usr/local/include/opencv
by using the instructions found on a website that can be found by searching for “sebastian montebone install opencv”. He installs some Qt libs (particularly libqt4-dev libqt4-opengl-dev) which is probably where I was going wrong before.
I set up a new project, in mainwindow I added a label called label_display and a pushbutton called button_cv.
I added the following into the .PRO file:
INCLUDEPATH +=/usr/local/include/opencv
INCLUDEPATH +=/usr/local/include/opencv2/core
INCLUDEPATH +=/usr/local/include/opencv2/imgproc
INCLUDEPATH +=/usr/local/include/opencv2/ml
INCLUDEPATH +=/usr/local/include/opencv2/highgui
LIBS += -L/usr/local/lib \
-lopencv_core \
-lopencv_imgproc \
-lopencv_highgui \
-lopencv_ml \
-lopencv_video \
-lopencv_features2d \
-lopencv_calib3d \
-lopencv_objdetect \
-lopencv_contrib \
-lopencv_legacy \
-lopencv_flann
I added the following include into main:
#include
I rightclicked on the pushbutton->go to slot and then pasted most of the grabber.c code (given below), The following lines of code display the image by first converting the Mat to a QImage type and then displaying that in the label (scaled to 320×240 so as to only take up a small part of the screen).
QImage displayQimage;
displayQimage = QImage((const unsigned char*)frame.data,frame.cols,
frame.rows,frame.step,QImage::Format_RGB888);
ui->label_display->setPixmap(QPixmap::fromImage(displayQimage.scaled(320,240,Qt::IgnoreAspectRatio, Qt::FastTransformation)));
The code to be pasted into mainwindow, after right-click button, go-to-slot within the ui editor.
//===========================================================
void MainWindow::on_button_cv_clicked()
{
// cvCaptureFromCAM(1); //Set which camera if have more than 1 on system
VideoCapture capture(1);
capture.set(CV_CAP_PROP_FRAME_WIDTH,640);
capture.set(CV_CAP_PROP_FRAME_HEIGHT,480);
if(!capture.isOpened()){
ui->label->setText(“Failed to connect to the camera.”);
}
Mat frame, edges;
capture >> frame;
if(frame.empty()){
ui->label->setText(“Failed to capture an image”);
}
//cvtColor(frame, edges, CV_BGR2GRAY);
//Canny(edges, edges, 0, 30, 3);
//imwrite(“edges.png”, edges);
//imwrite(“capture.png”, frame);
QImage displayQimage;
displayQimage = QImage((const unsigned char*)frame.data,frame.cols,
frame.rows,frame.step,QImage::Format_RGB888);
ui->label_display->setPixmap(QPixmap::fromImage(displayQimage.scaled(320,240,Qt::IgnoreAspectRatio, Qt::FastTransformation)));
}
//===========================================================
The program seems to work, I do get a load of “VIDIOC_QUERYMENU: Invalid argument” errors on the “application output” window in Qt, when I compile to the local machine, but in Derek’s video he mentions something like this.
Also, instead of using cout, I set label text, the cout didn’t seem to do much in Qt-creator.
bro, i m also suffering from same problem ” VIDIOC_QUERYMENU: Invalid argument”, Are u able to solve that problem now.can u help me. my mail id is chandandreams2@gmail.com
Hi Derek,
I got this error:
OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or
Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or con
figure script) in cvNamedWindow, file /opt/opencv-master/modules/highgui/src/window.cpp, line 499
terminate called after throwing an instance of ‘cv::Exception’
what(): /opt/opencv-master/modules/highgui/src/window.cpp:499: error: (-2) The function is not implemented.
Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0
-dev and pkg-config, then re-run cmake or configure script in function cvNamedWindow
Can you help me?
Hello Derek,
Thank you for this great tutorial. I am new to Linux/Ubuntu/Angstrom, so step-by-step exercises like those are real gems!
I’m using a Creative LiveCam and I could go through all the steps (I had to tweak a bit with ffmpeg to get the video conversion to work, but that’s about it).
The main problem I have is with the camera detection. Sometimes it works, sometimes it doesn’t (/dev/video0/ doesn’t appear when I type [ ls -al ] ). When it doesn’t, I unplug the camera, play around, sometimes reboot the BBB and ‘poof!’ for some unknown reason, all of a sudden it appears… Is there a way to consistently detect the camera?
I just had the same problem with my Logitech C920 and I want to know how to reboot the device without rebooting the BBB. It has to be hands-off of course because I am using it in a remote application. It cannot be a power problem because I have the BBB and the hub on separate 3a supplies for now, plugged into a Tripp-Lite online UPS.
Fantastic tutorial Derek, thank you! I go to it so much, I have it bookmarked on my desktop!
Why result work but is too fast?
Hi Guru Derek,
After successfully following your tutorial I have one question which I hoped that you might help me with… I can set the camera’s auto focus from the command line by adapting your example for setting brightness, but I can’t figure out how to translate that into code when I’m trying to modify boneCV.cpp.
Do you know if this is possible?
I’m thinking it must be some kind of custom property which I can’t find or otherwise I might have to a shell script which isn’t so neat.
Hi – great work!
Just a quick question while I consider this setup. Do you see any issues with the following setup?
– BBB
– 2 USB C920 Cameras
– USB hub (probably powered I guess, to supply the cameras with enough current)
Would the BBB have enough grunt to purely record from both cameras simultaneously to SD card?
It would be nice if the BBB had two USB hosts, but it doesn’t – is a hub going to work?
Thanks!!
I think so. I haven’t tried it, but provided you can get enough current to the cameras the data rate should be fine for a good quality SD card or streamed over a network. It’s on the list of things I am going to try!
Hi Derek!
Thanks so much for such a great video and helpful code. You show that there’s an advantage to having the hardware H.264 encoding for capturing a stream of video to view, but when you start using openCV you say it’s better to use a raw image formate. Is the image not automatically converted to H.264 by the camera? Or if the H.264 isn’t being used for openCV, is there any real advantage to choosing this camera rather than one that does not have the hardware encoding?
Good point. Yes, the camera is great for streaming video video more so than for use with OpenCV for image processing; however, it is a good high-resolution camera.
I try to compile on my BBB after git command You were mention above.
./build
but I met many errors so could you open the steps you’ve done.
I’m using ubuntu 13.04 on the BBB.
The source is 13.04 form the http://rcn-ee.net/deb/flasher/raring/
Hi Derek
I’m trying to follow to your guide for capturing video.
but, I met a problem.
my camera frame rate is 15 fps.
Setting frame =5 and Compiling boneCVtiming.cpp, then I executed boneCVtiming file.
but, I get a about 6 second. It is very slow speed.
Do you know about this problem?
Hi, the code is only set up for a camera that encodes and streams H264. If your camera doesn’t do this then it will be slow. Derek.
Hi Derek,
Thank you for all the excellent tutorials. I am new to Linux so please pardon me if I am asking something that doesn’t make sense. I followed this video on openCV and it worked perfectly (like all of your other tutorials that I tried).
What I am trying to do now is to include openCV libraries in my Eclipse project so that I can integrate it with my robotic application and do step-by-step debugging. To do this, I cross-compiled the openCV libraries, integrated it with my project in Eclipse and included the boneCV.cpp (changed main() to openCV_main() and called it from a thread) to test it. The project compiled successfully and I am able to launch the executable in debug mode (using Eclipse). Unfortunately, the openCV_main() doesn’t work and I get the following errors:-
On executing statement “VideoCapture capture(0);” and “capture.set(CV_CAP_PROP_FRAME_HEIGHT,480);” I get error message “HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP “ but “capture.isOpened()” returned true.
When I call “Canny(edges, edges, 0, 30, 3);”, I get “select timeout” message twice at around 2 second intervals and then application terminates (quits debug mode).
Then, instead of getting the image from camera, I tried reading a stored image by calling “frame = imread(“/home/root/Bin/capture.png”, 1 );” but the next statement “frame.empty()” returned true meaning the imread failed (I did have the image file at the specified loacaion). This code works fine if I build and run it in BBB. So looks like none of my openCV library calls are working, not just the camera capture.
Is there any option that I might have missed when I cross-compiled the openCV library for BBB? I did see that “–O3” was used. I compiled my application with “–O2” (tried with –O0 as well).
Can you please help me solve this issue?
Thank you.
Sukesh
Problem solved to some extent after recompiling the library with some changes in the configuration (in ccmake). Now I am able to capture and process the images. Only problem now is capture resolution is always at 640×480 and I still get the error message “HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP” when trying to change resolution. I also changed my camera to C920 form C525. Not sure if this really fixed the “select timeout “ issue ; I don’t have the C525 to try it out.
Thank you very much for your series of tutorials, videos, and scripts to use with the Beaglebone Black. Inspired by your example, I have purchased two Beaglebones Black, and two Logitech C920 cameras. If I can bend them fully to my will, I will purchase even more of them. So far, I have successfully set up two IP cameras, and have them set up with boot scripts to begin sending video to a server, where ffmpeg listens for those incoming streams. From there, I would like to find a way to have the server write out videos 1 hour in length from the incoming live streams, and save those hour-long videos in a nested directory tree representing the month/day of the videos, which are themselves each named after the camera and hour of the day. Also, I am able to rebroadcast the video from the receiving server, which is mighty cool.
I have your boneCV folder inside of /home/root on the BBB. I wrote a script called ipcamera.sh, and saved it in my /home/root folder. Here are the contents of /home/root/ipcamera.sh:
#!/bin/bash
sleep 15
v4l2-ctl –set-fmt-video=width=1024,height=576,pixelformat=1
v4l2-ctl –set-parm=10
/home/root/boneCV/capture -o -c0|avconv -re -i – -vcodec copy -f mpegts udp://192.168.1.6:8090
I added “sleep 15” to make sure the filesystem and network interface were up and running before launching the video stream. In order to have this run at boot time, I created a service description file called /lib/systemd/system/ipcamera.service :
[Unit]
Description=Setting Up the IP Camera
[Service]
ExecStart = /home/root/ipcamera.sh
[Install]
WantedBy=multi-user.target
So, after creating both the ipcamera.sh script and the ipcamera.service service descriptor file, I entered the following command into the terminal:
root@beaglebone:~# systemctl enable ipcamera.service
Now the script runs at boot time, every time. As an added bonus, I can use the systemctl command to stop, start, and restart the camera at will:
root@beaglebone:~# systemctl stop ipcamera.service
I hope this is useful to you and your readers. By the way, there are several features to this IP camera I would very much like to have, but am having a devil of a time getting them to work. If you or anyone else can help, I want to do two other things:
1.) I’d like to be able to broadcast an audio stream. The microphone is comparable to the optics in quality on this camera, and it seems a shame to not have the audio stream.
2.) I’d like to be able to draw text on the output stream, both naming the stream source (camera number) and the date and time. It looks like avconv on the Beaglebone does not recognize the drawtext filter, but maybe there is another way to do it.
Thanks for your contribution, and I’m looking forward to more good things from you.
Hi Richard,
am I right with the assumption that you simply relay the stream from the camera into the network without any image processing on the bone? This is exactly what i want to do (basically a ssimple IP camera).
Is it possible to get a decent framerate 1080p stream out of this configuration without stressing the bone too much?
I’d appreciate a response since i haven’t received my hardware yet and can’t test it myself
Cheers
Hi Richard, Indeed audio is also mandatory for me 2. Well I checked v4l2 docs and I couldn’t figure it out :/
Are you any closer on adding the audio stream to the video file?
Thanks for this excellent series of BBB tutorials, Derek.
Question on the frame rate. In the boneCVtiming demo you get about 4 fps, and I get a similar result with my setup. How can I increase the frame rate? It seems that selecting a lower capture resolution doesn’t immediately work– I get a series of “select timeout” errors and no improvement in frame rate.
Do you have any guidelines for parameters to adjust to try to increase fps at the cost of things like resolution?
Hi Derek.
Im doing on a project that involves with a blinking bulb.
When the bulb blinks, the camera detects it and translates the blinking into a message.
Well actually the bulb blinks according to morse code because i want to send a message using morse code via the bulbs. (it is a video streaming because in order to get the blinking it have to be video streaming right?)
Using your setup and guide can this be achieved ?
I mean I have to develop an application later so the message will appear on the screen.
But can you show me some step on what i have to do
Thank you in advance.
Hi
I have a problem in adapting the code to fit my camer. I am still new for Linux and Beaglebone.
I need to have an edge detection images for a video capture project.
I am having trouble running grabber.c. How do I get the libv4l2 package and add it to the PKG_CONFIG_PATH?
When using the follow command, my compilation fails:
gcc -02 -Wall ‘pkg-config –cflags –libs libv4l2″ grabber.c -o grabber
My Terminal:
ubuntu@ubuntu-armhf:~/boneCV$ gcc -O2 -Wall
pkg-config --cflags --libs libv4l2
grabber.c -o grabberPackage libv4l2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libv4l2.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘libv4l2’ found
grabber.c:27:21: fatal error: libv4l2.h: No such file or directory
compilation terminated.
How do I get the libv4l2 package and add it to the PKG_CONFIG_PATH?
Please help, Thank you.
I ran into the same problem with Debian and was able to solve it by installing libv4l-dev and libopencv-dev, and then re-running the build script. I found the solution here: http://www.probotix.com/wiki/index.php/BeagleBone. I’m not sure if this is the best way to solve the problem, I’m still pretty new to the BBB and Linux, but its working for me. Install the above with the following commands:
sudo apt-get install libv4l-dev
sudo apt-get install libopencv-dev
Derek,
I’m doing videos following your model.
I thought the file size in MB large, even reducing the resolution still fails.
Done something to treat it?
And congratulations for the post and video.
Hi, derek,
your video is very useful and helpful.
I follow your video (beaglebone: video capture and image processing on embedded linux using OpenCV) step by step to setup the video streaming in beaglebone black but I have meet a problem.
In beaglebone black, I type “#./streamVideoRTP”
Normal, It will start streaming until CTRL-C. then PC can use VLC to read the streaming data
but everytime it just one time. it will stop automatic.
It seems that full the buffer? or setting problem
Can you give me some hint to solve this problem?
thank you.
Jacky
How to change the bitrate of the video recording?
I looked for something in capture.c but not found.
Hello Derek Molloy,
Thanks for the lovely tutorial,
Problem 1:
While cloning from git clone git://github.com/derekmolloy/boneCV.git I got an error i.e.
Cloning into ‘boneCV’… fatal: unable to connect to github.com: github.com[0: 192.30.252.130]: errno=Connection timed out
Solution 1:
The solution to it was that github was blocked on my IP. but when I used an online proxy eg hotspot, spotflux shield it worked.
Problem 2:
I am using A4tech camera (Z-Star Microelectronics Corp. Venus USB2.0 Camera) the format it supports is YUYV.
Video input : 0 (Camera 1: ok)
Format Video Capture:
Width/Height : 640/480
Pixel Format : ‘YUYV’
Field : None
Bytes per Line: 1280
Size Image : 614400
Colorspace : SRGB
But when I execute the following command
root@beaglebone:/boneCV# ./capture -d /dev/video0 -f -c 6 -o > output.raw
Force Format 1
select timeout
This indicates that the program returns an EXIT FAILURE in main loop. What I see actually on the camera is that the frame capturing led (on camera) blinks then turns off as if it was trying to capture a snapshot. I wonder if there is problem with the driver.
@ engros: updates on this one?
Dear Mr. Molloy,
Thank you very mucho for your tutorials on Beaglebone and video capture.
I have the same problem as engros when running capture. I’m using a Logitech C270. It seems to exit and generates an empty video file:
debian@beaglebone:/boneCV# ./capture -f -c 600 -o > output.raw
Force Format 1
select timeout
debian@beaglebone:/boneCV#
Do you know where is this problem coming from?
Thanks
HI Mr.Derek
I am working same video streaming using raspberry pi I am use following python Opencv code for video capturing
import cv
cv.NamedWindow(“w1”, cv.CV_WINDOW_AUTOSIZE)
capture = cv.CaptureFromCAM(0)
def repeat():
frame = cv.QueryFrame(capture)
cv.ShowImage(“w1”, frame)
while True:
repeat()
it work very well.nut when i use this file and ffmpeg for video streaming there is no pipe line creating in fillowing code
python capture.py -F -o -C300000 | ffmpeg -re -i – -vcodec copy -f mpegts /var/www/a.avi
so what is the reason for this can you help me to solve this problem?… Thank you.
Hi Mr. Derek,
I’m interested in BBB. Since I intend to use it for stereoscopic video, but is it possible to combine 2 videos from 2 BBBs and 2 Cameras (as we know a BBB only has a USB port)?
Thanks
I’m working on that at the moment with one BBB and two cameras using a USB hub. I should have a post ready shortly. However, there are problems! I think it is mainly down to the USB bandwidth. I’m currently working to adapt the bitrate for a two camera setup.
Oh good dear.. I’ll be waiting for your trial report. Actually, for this moment I’m not thinking this device for professional use, so low bandwidth is still be ok to me.
Any progress on getting two C920s working on one BBB at 1080p? I think that the cameras request way more bandwidth than they need (lazy hardware makers) such that two can’t work at once. One way around this would be to hack the second USB port on the BBB to a host as others have demonstrated, but that seems a little overkill.
Do you think it can be done without modifying the USB host drivers such that they ignore the Logitech C920 bandwidth request?
Yes, I tried a few months ago. Unfortunately, even with the bandwidth request over-ridden I could not get full HD working. I have two cameras working at 640×480 and streaming reasonably okay; however, they are slightly out of sync. I’m afraid I was distracted by the correction of exam papers and didn’t get back to it!
Any idea whether this approach is going to work with an EM28xx based video grabber as well ?
I know that lots of other boards work with Logitech cameras but not with the Empia drivers
Thanks
Oskar
I am trying the video & frame capture program. Using windows on PC, Angstrom on BBB. Anyone tried with Logitech c525?
1. When I try this
./capture -F -c 600 -o > output.raw
Force Format 2
Selelct Timeout
2. When I try this
./grabber.c
Permission denied
Anyone can help me out?
Thankyou in advance
My problem is solved, and I can tell u all, Logitech c525 works fine
I am using Logitech c525. It supports yuyv, mjpg and not h.264. So I was unable to use ./capture correctly. I was able to resolve my problem by using
./capture -c 600 -o > output.raw
In this case, the default setting for output format was used. I set it too mjpg using
root@beaglebone:/dev# v4l2-ctl –set-fmt-video=pixelformat=1
To resolve my 2nd doubt, I compiled the code, which I forgot to do. Use –
gcc –O2 –Wall
pkg-config –cflags –libs libv4l2
grabber.c –o grabberThen I was able to execute with no problems. (Don’t forget to press Ctrl+C to end frame capturing process, else your directory will be full of grabber001.ppm, grabber002.ppm, etc)
Finally, a big thank you to Derek Molloy for his detailed steps
I am using c100 logitech camera..
however when i try to run a simple capture program i get VIDIOC_QUERYMENU : Invalid argument
as the output..the camera gets triggered momentarily without showing any output
could anybody suggest a possible solution for the same?
bro, i m also suffering from same problem ” VIDIOC_QUERYMENU: Invalid argument”, Are u able to solve that problem now.can u help me. my mail id is chandandreams2@gmail.com
hi derek can we use any other instead of open cv for image processing using beagelbone
Hello Derek.
I am currently using ubuntu saucy 13.10 on BBB. I am unable to install the V4L drivers on it. Please help me on this.
Hell Derek,
I followed your tutorial and got it to work up on my Begalbone (not black) with ubuntu and a Logitech C525 camera. I had to install v4l2 (via apt-get) and openCV (cross compiled on host and copied to the BB). With this I was able to run the CVtiming example and capturing individual frames. Now I want to capture whole videos. I could do this similar to the capture.c approach by just writing the raw captured frames intó a file, but i want ot utilize openCV for that. I modified your edge-capture example and want to use the VideoWrite to write the video file. I tried several settings with my camera and openCV, but I was not able to create the output video file so far. I don’t know if it is an issue with the codeec, the settings (fps, width, hight, etc.) or something else. I also installed the collection of codesc on the BB via “apt-get install ubuntu-restricted-extras”, but it didn’t help. Maybe you or others reading this have some experience on this and can provide some thoughts on how to solve this.
Thanks! I appreciate any feedback on this!
Here is the code I used:
/* boneCVtiming.cpp
*
* Copyright Derek Molloy, School of Electronic Engineering, Dublin City University
* http://www.derekmolloy.ie
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that source code redistributions retain this notice.
*
* This software is provided AS IS and it comes with no warranties of any type.
*
* Modified to capture video
*/
#include // for standard I/O
#include // for strings
#include
#include
#include
#include // Basic OpenCV structures (cv::Mat)
#include // Video write
using namespace std;
using namespace cv;
int main()
{
// open video capture device “/dev/video0” (0)
VideoCapture inputVideo(0);
VideoWriter outputVideo;
if(!inputVideo.isOpened())
{
cout << "ERROR: Failed to connect to the camera." << endl;
}
// size
// Size S = Size(640, 480);
Size S = Size((int) inputVideo.get(CAP_PROP_FRAME_WIDTH), // Acquire input size
(int) inputVideo.get(CAP_PROP_FRAME_HEIGHT));
// codec for output file
// int ex = CV_FOURCC('X','V','I','D'); //CV_FOURCC('H','F','Y','U'); //CV_FOURCC('M','J','P' ,'G');
int ex = CV_FOURCC('M','J','P' ,'G');
double fps = 25;
const string outName = "/home/ubuntu/BeagleWorld/myoutvideo.avi";
bool result = outputVideo.open(outName, ex, fps, S, true);
if ( !outputVideo.isOpened() )
{
cout << "ERROR: Failed to write the video" << endl;
return -1;
}
int cnt = 0;
while (cnt++ < 300)
{
Mat frame;
bool bSuccess = inputVideo.read(frame); // read a new frame from video
if (!bSuccess) //if not success, break loop
{
cout << "ERROR: Cannot read a frame from video file" << endl;
break;
}
outputVideo.write(frame); //writer the frame into the file
}
return 0;
}
I did not yet fix the issue mentioned above, because I was struggeling with “select timeout” and arm libraries for v4l2 for cross compiling on a Linux x86 host (which seems to work now), butI want to let you know an interesting item in regard to “select timeout” that I found when doing some research. This happens due to the not well working USB DMA mode in the Beaglebone. I disabled the DMA mode in the kernel (Cameras use USB ISO mode) and it worked well so far.
Kernel Config: CONFIG_MUSB_PIO_ONLY=y
Regards,
Thomas
Thomas, I am having a similar “select timeout” error. Could you elaborate on how you are disabling the DMA mode? Thanks
Hi Derek,
I’m learning a lot from your detailed explanations. Your tutorials are awesome!
I have a question for you:
Is there a way to grab the frames on a OpenCV program, processing each frames, and stream the result over the network?
What I’m trying to build is a machine vision IP camera by using my c920 and the BBB.
Could you point me up the direction to achieve that kind of live view processing?
Cheers,
Sandro
Hey Derek, thanks for your videos! You’re awesome.
I have a BeagleBoard-xM and I’m having an issue that I couldn’t find anywhere. When I try to do (for example)
double test = capture.get(CV_CAP_PROP_FRAME_WIDTH);
My program freezes, but when I change “double” to “int” it works. And another thing, if I do:
double test = 0; //it works!
Does anyone has any idea what’s going on?
Derek, Great tutorial. I had an error “select timeout” while running capture.
The command I entered was:
root@beaglebone:~/boneCV# ./capture -F -o -c 300 > output.raw
I think the code responsible is here:
if (frame_count == 0) loopIsInfinite = 1; //infinite loop
count = frame_count;
while ((count– > 0) || loopIsInfinite) {
for (;;) {
fd_set fds;
struct timeval tv;
int r;
FD_ZERO(&fds);
FD_SET(fd, &fds);
/* Timeout. */
tv.tv_sec = 2;
tv.tv_usec = 0;
r = select(fd + 1, &fds, NULL, NULL, &tv);
if (-1 == r) {
if (EINTR == errno)
continue;
errno_exit(“select”);
}
if (0 == r) {
fprintf(stderr, “select timeout\n”);
exit(EXIT_FAILURE);
}
if (read_frame())
break;
/* EAGAIN – continue select loop. */
}
}
}
The only other thing that stands out is when I ran the command:
root@beaglebone:~/boneCV# v4l2-ctl –set-fmt-video=width=1920,height=1080,pixelformat=1
Noticed that camera didn’t go to 1920×1080, but to 1280×720
root@beaglebone:~/boneCV# v4l2-ctl –all
Driver Info (not using libv4l2):
Driver name : uvcvideo
Card type : HD Pro Webcam C920
Bus info : usb-musb-hdrc.1.auto-1.1
Driver version: 3.8.13
Capabilities : 0x84000001
Video Capture
Streaming
Device Capabilities
Device Caps : 0x04000001
Video Capture
Streaming
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
Width/Height : 1280/720
Pixel Format : ‘H264’
Field : None
Bytes per Line: 2560
Size Image : 1843200
Colorspace : SRGB
Crop Capability Video Capture:
Bounds : Left 0, Top 0, Width 1280, Height 720
Default : Left 0, Top 0, Width 1280, Height 720
Pixel Aspect: 1/1
Streaming Parameters Video Capture:
Capabilities : timeperframe
Frames per second: 30.000 (30/1)
Read buffers : 0
brightness (int) : min=0 max=255 step=1 default=128 value=128
contrast (int) : min=0 max=255 step=1 default=128 value=128
saturation (int) : min=0 max=255 step=1 default=128 value=128
white_balance_temperature_auto (bool) : default=1 value=1
gain (int) : min=0 max=255 step=1 default=0 value=0
power_line_frequency (menu) : min=0 max=2 default=2 value=2
white_balance_temperature (int) : min=2000 max=6500 step=1 default=4000 value=3480 flags=inactive
sharpness (int) : min=0 max=255 step=1 default=128 value=128
…
Any suggestions?
Derek, I answered my own question. I changed from one USB hub to another, and the commands to change the height and width worked.
Hello Derek, my camera supports YUYV and MJPEG formats. But it doesn’t support H264. So how to record video? pls
For all of you with cheap webcams, I got this to work by cranking the resolution down to 160×120. See https://sites.google.com/site/mbbackus/robotics/beaglebotblack/computer-vision for details.
hey derek…. how do i use ur capture.c code for my laptop webcam?
Hi Derek,
Everything I run the capture program I get a set timeout error. How do I solve it
Thank you
Hi Derek,
First off all, thanks a lot for your tutorials on the beaglebone.
I previously followed these steps on a older beaglebone.
manually installed open cv using apt-get install libopencv-*.
everything was working fine and i made a solid working opencv program.
now I redid this whole operation on the black.
what happens when i try to build boneCV.cpp it gives a lot of errors saying undefined reference.
I’ve been checking my libraries which seem to be alright the only difference is I have more.
i found out somehow on my old beaglebone it installed opencv version 2.3.1 and on the black it has installed 2.4.5
I have searched the internet for quite a while now cant seem to find any solution.
do you have any sugestions on what could cause this to happen?
Thanks Louis
Think i fixed the problem by using: g++ -Wall -g -o boneCV boneCV.cpp
pkg-config --cflags --libs opencv
Hello all,
Thank you Derek for the very informative tutorials. I am trying to compile your programs on my Pandaboard running Ubuntu 12.04. When I run ./build I get these errors… it seems like a linking error.
/tmp/ccG88b7W.o: In function
cv::Mat::~Mat()':
cv::fastFree(void*)’boneCV.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x48): undefined reference to
boneCV.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x50): undefined reference to
cv::Mat::deallocate()'
main’:/tmp/ccG88b7W.o: In function
boneCV.cpp:(.text.startup+0x8): undefined reference to
cv::VideoCapture::VideoCapture(int)'
cv::VideoCapture::set(int, double)’boneCV.cpp:(.text.startup+0x14): undefined reference to
boneCV.cpp:(.text.startup+0x20): undefined reference to
cv::VideoCapture::set(int, double)'
cv::VideoCapture::isOpened() const’boneCV.cpp:(.text.startup+0x26): undefined reference to
boneCV.cpp:(.text.startup+0x7e): undefined reference to
cv::VideoCapture::operator>>(cv::Mat&)'
cv::_InputArray::_InputArray(cv::Mat const&)’boneCV.cpp:(.text.startup+0xb4): undefined reference to
boneCV.cpp:(.text.startup+0xbe): undefined reference to
cv::_OutputArray::_OutputArray(cv::Mat&)'
cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)’boneCV.cpp:(.text.startup+0xca): undefined reference to
boneCV.cpp:(.text.startup+0xd2): undefined reference to
cv::_InputArray::_InputArray(cv::Mat const&)'
cv::_OutputArray::_OutputArray(cv::Mat&)’boneCV.cpp:(.text.startup+0xda): undefined reference to
boneCV.cpp:(.text.startup+0xee): undefined reference to
cv::Canny(cv::_InputArray const&, cv::_OutputArray const&, double, double, int, bool)'
cv::_InputArray::_InputArray(cv::Mat const&)’boneCV.cpp:(.text.startup+0x100): undefined reference to
boneCV.cpp:(.text.startup+0x112): undefined reference to
cv::imwrite(std::basic_string<char, std::char_traits, std::allocator > const&, cv::_InputArray const&, std::vector<int, std::allocator > const&)'
cv::_InputArray::_InputArray(cv::Mat const&)’boneCV.cpp:(.text.startup+0x132): undefined reference to
boneCV.cpp:(.text.startup+0x144): undefined reference to
cv::imwrite(std::basic_string<char, std::char_traits, std::allocator > const&, cv::_InputArray const&, std::vector<int, std::allocator > const&)'
cv::VideoCapture::~VideoCapture()’boneCV.cpp:(.text.startup+0x166): undefined reference to
boneCV.cpp:(.text.startup+0x19e): undefined reference to
cv::VideoCapture::~VideoCapture()'
cv::Mat::~Mat()’:collect2: ld returned 1 exit status
Building the OpenCV timing example for the Beaglebone
/tmp/ccAOWDVD.o: In function
boneCVtiming.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x48): undefined reference to
cv::fastFree(void*)'
cv::Mat::deallocate()’boneCVtiming.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x50): undefined reference to
/tmp/ccAOWDVD.o: In function
main':
cv::VideoCapture::VideoCapture(int)’boneCVtiming.cpp:(.text.startup+0xc): undefined reference to
boneCVtiming.cpp:(.text.startup+0x18): undefined reference to
cv::VideoCapture::set(int, double)'
cv::VideoCapture::set(int, double)’boneCVtiming.cpp:(.text.startup+0x24): undefined reference to
boneCVtiming.cpp:(.text.startup+0x2a): undefined reference to
cv::VideoCapture::isOpened() const'
clock_gettime’boneCVtiming.cpp:(.text.startup+0x82): undefined reference to
boneCVtiming.cpp:(.text.startup+0xc2): undefined reference to
cv::VideoCapture::~VideoCapture()'
cv::_InputArray::_InputArray(cv::Mat const&)’boneCVtiming.cpp:(.text.startup+0xd4): undefined reference to
boneCVtiming.cpp:(.text.startup+0xdc): undefined reference to
cv::_OutputArray::_OutputArray(cv::Mat&)'
cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)’boneCVtiming.cpp:(.text.startup+0xe8): undefined reference to
boneCVtiming.cpp:(.text.startup+0xf0): undefined reference to
cv::_InputArray::_InputArray(cv::Mat const&)'
cv::_OutputArray::_OutputArray(cv::Mat&)’boneCVtiming.cpp:(.text.startup+0xf8): undefined reference to
boneCVtiming.cpp:(.text.startup+0x10c): undefined reference to
cv::Canny(cv::_InputArray const&, cv::_OutputArray const&, double, double, int, bool)'
clock_gettime’boneCVtiming.cpp:(.text.startup+0x118): undefined reference to
boneCVtiming.cpp:(.text.startup+0x196): undefined reference to
cv::_InputArray::_InputArray(cv::Mat const&)'
cv::imwrite(std::basic_string<char, std::char_traits, std::allocator > const&, cv::_InputArray const&, std::vector<int, std::allocator > const&)’boneCVtiming.cpp:(.text.startup+0x1a8): undefined reference to
boneCVtiming.cpp:(.text.startup+0x1c8): undefined reference to
cv::_InputArray::_InputArray(cv::Mat const&)'
cv::imwrite(std::basic_string<char, std::char_traits, std::allocator > const&, cv::_InputArray const&, std::vector<int, std::allocator > const&)’boneCVtiming.cpp:(.text.startup+0x1da): undefined reference to
boneCVtiming.cpp:(.text.startup+0x216): undefined reference to
cv::VideoCapture::~VideoCapture()'
cv::VideoCapture::operator>>(cv::Mat&)’boneCVtiming.cpp:(.text.startup+0x278): undefined reference to
collect2: ld returned 1 exit status
Building the Video4Linux frame capture program
Building the Video4Linux capture example program
Finished
I’m getting the exact same error, did you found a solution?
Hi i’m running Debian on BBB with the C920. I’m a little confused on how to view the parameters of the camera when Derek is doing v4l2-ctl ,etc… because debian doesnt recognize the -ctl command. Can somebody please help me!?
Hi sir,
You been doing a great work. I successfully follow several of your tutorials and it works great. For this capturing procedure, it works splendid, but for converting file from .raw to .mp4 , it works well until I tried to convert 1hour capture file (1.3gb .raw) to .mp4. It also does not with 15min or 1/2hour capture file. And I notice it will only work with up to 40sec capture file (14.7mb .raw). May I know why?
Thank You For Your Hard Work.
Jon, you must install package video4linux first.
Derek: I wonder what changes are needed to make this webcam work with Debian on BBB RevC? How does one write the changes and new software to the SSD so that they are retained when BBB is switched off? We built a mowbot that works well with RC control. Now we want to control it by remote laptop via onboard webcam and the BBB. But this is proving harder than I thought it would be.
Thanks for the great tutorials!
Hello,
I think I’ve followed the directions correctly here, but when I run the script I receive the error:
“pipe:: Invalid data found when processing input”
and I am returned to the command prompt. The error appears to happen as the capture command is executed. Any thoughts?
Please disregard mt last post – this is the wrong thread, and I re-posted in the correct one (on RTP streaming)
sir when i m trying this command /capture -F -c 600 -o > output.raw
It’s giving this error :
Force Format 2
VIDIOC_S_FMT error 5, Input/output error
thanks
hi sir,
I am working on project to calculate the speed of car using image processing. I want to make it as a separate unit with only a camera and an image processing board.
Is it possible that I use beagle bone for this purpose??
Hi, if you need to use this exceptional webcam with CS-type lens, take a look at my blog: http://lukse.lt/uzrasai/2013-07-modifying-logitech-c920-to-for-cs-lenses/
Hi Derek
I have a requirement to process still images from 4 HD cameras. The images don’t have to be taken simultaneously … in fast sequence is good enough. How can this be achieved with Beaglebone?
Also, the Logitech looks well suited for 2 of my 4 cameras but 2 cameras need to be small and light weight. Do you have a recommendation?
Thanks
Hi Derek,
It is a great work. I just followed each step but I dont have any luck to be succesfull
First of all could you please explain how to install v4l2. I searched internet but could nt find any clear explaination (sudo apt-get install libv4l2, or what?)
Secondly, when I try to run the compiled code, for example capture (as ./capture) I am receiving the error:
“error while loading shared libraries: libv4l2.so.0: cannot open shared object file: No such file or directory”
Beaglebone black is supposed to come as all the opencv libraries, depencies etc. included in the debian linux. But it seems like it does not
Could you please help?
Best regards
Hi Derek, congratulations for your work!!
I’ve built boneCV and capture examples and I get these errors and no images are captured:
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
select timeout
select timeout
NEVERTHELESS, After deep navigating through internet I’ve found a strange solution, using this configuration:
VideoCapture cam(0);
cam.set(CV_CAP_PROP_FRAME_WIDTH , 352);
cam.set(CV_CAP_PROP_FRAME_HEIGHT , 288);
And it works!!! Why?? I don’t know, neither the guy who posts it.
It seems as if opencv didn’t capture from webcam with standard frames 640×480 or 1024×768. But with that frame size (352×288) it works properly and now I can capture video and static images.
I was wondering if you could know the reason why this is so…
Best regards.
Hi Charles,
A lower resolution reduces the delay time. Here is a better solution:
molloyd@beaglebone:~$ sudo rmmod uvcvideo
molloyd@beaglebone:~$ sudo modprobe uvcvideo nodrop=1 timeout=5000
molloyd@beaglebone:~$ lsmod |grep uvcvideo
uvcvideo 57013 0
videobuf2_vmalloc 2490 1 uvcvideo
Kind regards,
Derek.
Hi Derek,
I tried this fix and instead of ‘select timeout’ now it says ‘VIDIOC_QBUF: Invalid argument’.
hi derek,
i am trying to implement what u have done…but my system fails to download video4linux everytime i try…can u give more details about how to proceed on installing video4linux..that would be of great help
thanks
Hi Derek,
I was wondering if there was a way to use either the GPIO or ADC pins to capture and save video onto an SD card which is located on the beaglebone black? I have a composite analog NTSC signal coming out of a FLIR camera while a visual camera is occupying the USB port (the FLIR camera does not have a video output signal in the form of a USB anyways).
Thanks!
-Andrew
PS-the visual camera is working so thanks for that!
Hello,
my bbb compile right:
./build
Video for Beaglebone Video Applications – derekmolloy.ie
Building the OpenCV example for the Beaglebone
Building the OpenCV timing example for the Beaglebone
Building the Video4Linux frame capture program
Building the Video4Linux capture example program
Finished
errors on running:
./capture
Force Format 0
select timeout
./boneCV
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
select timeout
./boneCVtiming
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
select timeout
select timeout
any ideas ?
hi Derek,
I’ve followed your steps, but i got this error
root@beaglebone:~/boneCV# ./capture
./capture: error while loading shared libraries: libv4l2.so.0: cannot open shared object file: No such file or directory
I’ve added the location of the library to the path but no success….
root@beaglebone:/# find -name “libv4l2.so.0”
./usr/lib/arm-linux-gnueabihf/libv4l2.so.0
./media/Angstrom/usr/lib/libv4l2.so.0
root@beaglebone:/# export PATH=$PATH:/usr/lib/arm-linux-gnueabihf
root@beaglebone:/# $PATH
-bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/arm-linux-gnueabihf: No such file or directory
what can i do to solve this problem?
thanks
Dear Mr. Derek,
Your efforts and guidelines are valuable… great work by you !!!
I am using USB webcam on beaglebone black.
I was getting a famous “select timeout error”
root@beaglebone:/home/debian# ./boneCV
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
select timeout
By making width x height equal to 352 x 288, select timeout is gone
and boneCV worked absolutely fine.
But I want an image to be captured at 640 x 480 resolution
For that I tried your suggestion of removing uvc driver and
re-inserting it with high timeout value
So I did,
# rmmod uvcvideo
# modprobe uvcvideo nodrop=1 timeout=5000
# lsmod
After this I don’t get timeout error from select, rather it takes
a long long time to execute following line,
capture >> frame;
After such a long patience test, I will have to end-up pressing CTRL-C
My conclusion is: we cannot capture high resolution frames with
BBB + USB webcam + v4l2 + opencv
1) What is a reason that it takes such a long time to capture 640 x 480 frame ?
2) How can we add/modify this program, so as to capture image frame with
any supported value of resolution ?
I will appreciate if you could flash some more light on this.
Thanks in anticipation.
Have you tried an IP camera (Axis) with the BBB?, Is there a way to run the video through a python code that is from a IP camera not a webcam.
regards.
Good day Sir. I am a graduate student from the Philippines. Currently, I am using system as your reference becuase I am trying to develop a people counting system in beaglebone black using openCV. I would like to inquire if you have a project similar to what I am doing. Thank you.
Derek, thanks for your work.
Ive watched your video numerous times in an effort to learn.
I bought a BBB just a week ago and was able to run your samples no problem with the default Debian installation and following your instructions.
To move forward i have researched how to increase the speed of openCV and in doing so it seems OpenCV3 is optimized for Arm.
So i have compiled OpenCV3 on the BBB and the operating system is Ubuntu.
I can run the two samples that use libv4l2 no problem but the other two with opencv i get some errors which i think are library location related.
specifically i receive these types of errors…
undefined reference to `cv::VideoCapture::~VideoCapture()’
Can someone smarter than me advise on how to point g++ to the libs ?
thanks
Hi Matthew, that is great to know — I haven’t tried that yet. You may have to modify the build script to account for OpenCV3. Unfortunately I don’t have the time at the moment to investigate this now but it is something that i will have to come back to. Sorry that I can’t be of more help, Derek.
Hi Derek,
First off thanks for the great tutorial! I’m at the step to run the camera for the first time but I get the following output:
root@beaglebone:/boneCV# ./capture -f –count 600
Force Format 1
select timeout
No dots appear, but the camera light goes on for a second and then goes off. I am not using the same camera, which doesn’t have H264 compression so that’s why I am using the -f mode.
I compiled the grabber by typing:
root@beaglebone:/boneCV# gcc grabber.c -lv4l2 -o grabber
which gave no errors. The grabber file appears now in my /boneCV directory.
Any ideas?
Thanks,
Alex
Sorry, I should also add that a new file ‘raw2mpg4’ does appear in the /boneCV directory, but it is quite small. So I do think a small video is recording, but there is a timing issue going on. But of course you would know better than me
Ok apologies, obviously I needed to compile the capture not the grabber. I did this and I still am getting the same issue.
Hey what could be causing the “select timeout” error? I am at a loss.
Feel free to delete all my comments but the last one. Apologies for so many sir!
Hi Derek, that’s ok i figured it out.
For you information though using OpenCV 3 with your unmodified boneCVtiming program.
Output is now 1.63446 seconds to process 10 frames with a CPU Freq of 300MHz (6 fps).
With a CPU freq of 1000MHz i get 1.45632 seconds to process 10 frames (6.8fps).
Quite a speed increase !
FYI…
Beaglebone Black rev C
Ubuntu 14.04.2 LTS installed on eMMC.
OpenCV3.0.0
Open CV built on BBB.
Derek, thank you for all the great work! I am successfully cross-compiling and debugging from Debian Jessie to my BBB.
I can successfully capture video and frames. But still being somewhat new to Linux, I’m wondering how I can cross-compile openCV with my source project. Do I need to download, make, and install opencv on Debian Jessie?
Hey I keep getting this error with Logitch C310 webcam: “select timeout”
I have followed all the steps very carefully. Is there known compatibility problems with other webcams?
Hey, after changing literally nothing the capture and grabber are both working now.
So I guess scratch all my comments, again sorry for flooding your comment thing.
Hey I’m not sure why all my ridiculous comments got posted, but I have cleared up all issues now.
Hi Alex,
I keep getting the “select timeout” error with LogitechC310, too.
You said you change literally nothing to get them work.
Then what do you do actually?
Thank you.
Hi Derek,
I have captured the video in yuyv format.
How can I now convert the .raw file to .mp4 by editing the existing raw2mp4 file.
Hi, I am wondering if you can set the camera focusing point and exposure value manually in grabber.c. I use the BBB and the camera taking pictures for trees in different time every day. Since trees always moving with wind, it better for me to make the focus fixed. Also it will be perfect if I can fix the exposure value.
Derek,
I’ve had great success with openCV on my BBB thus far doing simple operations (erode, dilate, threshold, HoughCircles, etc).
Now I’m trying background subtraction.
Have you tried background subtraction on BBB? In particular MOG or MOG2? If so, have you had success, or can you comment on the processing time? I’m seeing it take a long time to execute, and the results seem very strange…but I’m still somewhat new to openCV, so I don’t know if the problem is between the chair and the keyboard or something els
I purchased your book “Exploring Beaglebone” and a new BBB to follow examples.
Also have an old Angsrom BB-XM which I hardly used.
Have a few questions.
A.
Your chapter 12 video discusses using Angstrom and the book is written around Debian.
For OPENCV applications,should I change my BBB OS to Angstrom ?
B.
Getting this error when running a simple python program.
Xlib: extension RANDR missing on display :1.
import cv2
out=cv2.imread(‘Lenna.png’,0);
cv2.imshow(‘image’,out)
Using tightvncserver on BBB and VNC viewer on PC.
X-desktop working with LXterm, leafpad, Magick. Seems ok.
C.
No success running your ch12 demos with my camera. Using a cheapo VGA which works with python-opencv
on my PC, but not with BBB and the demos. ls -al shows device0. lsusb shows only the device ID #, not manufacturer.
D.
My Lenova laptop BIOS does not support Vt-X and therefore I skipped the cross-compile material.
Really interested in the BBB for the OPENCV and some embedded linux robot control.
Hi Gary, on A, no Debian is fine (the video was made before Debian was available). On B, I have never seen that before — strange. On C — no, unfortunately it needs the C920. Pity on D, I did not know that such an option is not available. Thanks, Derek.
Hi Derek, All you’re Beaglebone tutorials have been a huge help. Seriously, awesome job. A quick question for you though. I followed your tutorial and eventually got my grayscale, 16 bit camera working with the grabber.c code. This was with the Debian 7.8 firmware on the beaglebone site. I recently flashed my beaglebone to the updated debian firmware (8.2, Jessie) and I just can’t capture frames fast enough anymore. I’m using the same code, the same libraries, and same settings, but image capture takes about 2.5x as long (and data is being dropped in the process). Any ideas? Does Jessie just use more resources or something?
We have executed the grabber.c program with no errors. I want to store the pixel values of the captured image from the grabber.c code. Could you kindly guide me through it.
Hi !
i would like to do some image processing with beaglebone where the images (or video) are coming from a HDMI cable and use a PZ-HDMI to get the signal to the raspPI from the usb port.
Is this possible?
I mean beaglebone not raspPI
Hi dude, i have also find out one good example
Camera Video Capture And Save On SDCard – Android Example
Any idea if other webcams would work? I’ve been itching to get a 1080P Microsoft Lifecam Studio webcam
(Q2F-00014/X821857-003, Q2F-00015/Q2F-00003, Q2F-00013, 5WH-00002 1425 , Q2F-00001)
since they can be DIY lens upgraded to work as a nice SMT microscope!
Also, any thoughts on using Simulink’s computer vision with the BBB to do object recognition or motion detection? Is it comparable to using OpenCV?
Looks like the SMT lens hack can be done on the logitech camera as well!
http://lukse.lt/uzrasai/2013-07-modifying-logitech-c920-to-for-cs-lenses/
http://operationalsmoke.blogspot.com/2014/05/diy-usb-soldering-microscope.html
But how is it possible to use an (android) smartphone’s camera as the webcam for the Beaglebone Black? It’s shown here but no info!
https://www.youtube.com/watch?v=0I8-8STp7Mw
if we connect kinect camera, does beaglebone supports it well? will it not become slow?
Hey, I am new to BeagleBone Black.
I am trying to connect the beaglebone black to the internet using USB Adapter on windows 8.1. I am following all the steps mentioned in the tutorials given but not succeeded yet.
Actually i have a list of queries
1. Internet connectivity over beaglebone through Laptop?
tried many times but failed.
2. how to load GUI on windows for live streaming?
Thank you in advance for your help.
Hi Derek,
I’m getting so interest on Beaglebone black because of excellent features along with that.
I’m working on image and video processing using MATLAB. I’m so excited after saw your video for capturing and processing video in Beaglebone black. Really I have to appreciate that to give such a big support for all of doubts without any hesitation.
I tried the same in linux as per your guidelines of video, I got everything perfect upto configuration.
I worked upto stage of capture execution.
I’m using Logitech C270.
so I give the comment like: ./capture -f -c 600 -o > output.raw
The results is like:
Force Format 1
Select Timeout
So Hereafter I don’t know What i have to do…..
I’m using your source code from GitHub.
I dont know where I have to change for This Logitech Camera because I’m not aware of OpenCV.
If you look at this,please help me to solve out this problem by your valuable time. Thanks in advance Derek.
Bye Derek…..
I am too facing the same problem with logitech C270 camera.
If anyone has a solution to the above problem then please share it.
i have same problem of time out…help me
Hi Guys,
I am facing the same issue. I forced ‘-f’ as input since I am using a 640×480 YUV res cam. I get “select timeout”. For some reason, the select() returns a 0 due to which this is happening. I am going into the internals and through the code as well to figure out why this is happening. In the mean time, if any of have resolved this problem, please share the solution. Thanks
if ur issue is resolved help me.
How can I find what resources/versions opencv depends on?
OpenCV 2.4.9.1 came installed with my beaglebone black (debian 8.4), but when I try to compile I get errors about missing lame files!
http://pastebin.com/AuB8RwxT
I’ve tried to install lame, mplayer, and other libxxx-dev but nothing seems to work. Perhaps there’s something that’s installed that shouldn’t be, or at least is messing with opencv?
Hello Derek ,after I connected the USB camera it can detect the camera has been connected, but in the implementation of the relevant v4l2-ctl command prompt command does not exist, but needs V4L2 capture images you will need a Linux / videodev2.h this header file, my presence there, I do not know why, can you help me? I also direct the program prompts you to run a problem, how can I solve this problem?Thank you!
hi i got error in beagle board black processor while after deploying the program ” error setting audio hardware parameters for ‘default’ : invalid argument”.
I had to sudo apt-get install libopencv-dev, lib4l-dev and ffmpeg.
Otherwise, everything worked great. Thank you
Hi derek,
I’m using linux 4.1 kernel for beagleboneblack, unfortunately i’m not seeing the /dev/video0 entry in my kernel. How will i get that /dev/video0 entry for connecting webcam. So i tried to connect the webcam for my PC and i captured the raw format video for 600 frames, i got a raw video of 350 MB, but when i use “raw2mpg4” file from your github repository, i was getting some error messages i.e
venkatesh@venkyvenkatesh-Lenovo-G50-70:boneCV-master$ ./raw2mpg4
Video for Beaglebone Video Applications – derekmolloy.ie
Converting raw file to mpeg4 format
ffmpeg version 3.3.1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configuration: –extra-libs=-ldl –prefix=/opt/ffmpeg –mandir=/usr/share/man –enable-avresample –disable-debug –enable-nonfree –enable-gpl –enable-version3 –enable-libopencore-amrnb –enable-libopencore-amrwb –disable-decoder=amrnb –disable-decoder=amrwb –enable-libpulse –enable-libfreetype –enable-gnutls –enable-libx264 –enable-libx265 –enable-libfdk-aac –enable-libvorbis –enable-libmp3lame –enable-libopus –enable-libvpx –enable-libspeex –enable-libass –enable-avisynth –enable-libsoxr –enable-libxvid –enable-libvidstab –enable-libwavpack –enable-nvenc
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
[h264 @ 0x3823480] missing picture in access unit with size 368640000
[h264 @ 0x3823480] No start code is found.
[h264 @ 0x3823480] Error splitting the input into NAL units.
[h264 @ 0x3819d60] Stream #0: not enough frames to estimate rate; consider increasing probesize
[h264 @ 0x3819d60] decoding for stream 0 failed
[h264 @ 0x3819d60] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
Consider increasing the value for the ‘analyzeduration’ and ‘probesize’ options
Input #0, h264, from ‘output.raw’:
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264, none, 25 tbr, 1200k tbn, 50 tbc
[mp4 @ 0x3824040] dimensions not set
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Last message repeated 1 times
Finished
and i was unable to get mp4 format.
Regards,
Venkatesh.
Dear derek,
I had a issue of /dev/video0. I’m loading the linux-4.1 kernel for my beagle bone black, unfortunately i’m not finding the /dev/video0 as which is used for capturing the video streaming from webcams. How do i fix this problem ?? Help me out.
Because of this problem i tried to use this webcam with my PC and i captured the 600 frames of raw format video after that i had tried to convert that raw video to mp4 format using raw2mpg4 which i got it from your github source code. But here i end up with some problem, here it is
venkatesh@venkyvenkatesh-Lenovo-G50-70:boneCV-master$ ./raw2mpg4
Video for Beaglebone Video Applications – derekmolloy.ie
Converting raw file to mpeg4 format
ffmpeg version 3.3.1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configuration: –extra-libs=-ldl –prefix=/opt/ffmpeg –mandir=/usr/share/man –enable-avresample –disable-debug –enable-nonfree –enable-gpl –enable-version3 –enable-libopencore-amrnb –enable-libopencore-amrwb –disable-decoder=amrnb –disable-decoder=amrwb –enable-libpulse –enable-libfreetype –enable-gnutls –enable-libx264 –enable-libx265 –enable-libfdk-aac –enable-libvorbis –enable-libmp3lame –enable-libopus –enable-libvpx –enable-libspeex –enable-libass –enable-avisynth –enable-libsoxr –enable-libxvid –enable-libvidstab –enable-libwavpack –enable-nvenc
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
[h264 @ 0x33bc460] missing picture in access unit with size 368640000
[h264 @ 0x33bc460] No start code is found.
[h264 @ 0x33bc460] Error splitting the input into NAL units.
[h264 @ 0x33b2d40] Stream #0: not enough frames to estimate rate; consider increasing probesize
[h264 @ 0x33b2d40] decoding for stream 0 failed
[h264 @ 0x33b2d40] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
Consider increasing the value for the ‘analyzeduration’ and ‘probesize’ options
Input #0, h264, from ‘output.raw’:
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264, none, 25 tbr, 1200k tbn, 50 tbc
[mp4 @ 0x33bd020] dimensions not set
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Last message repeated 1 times
Finished
Thanks & Regards,
venkatesh
Hi dude, i have also find out one good example
Camera Video Capture And Save On SDCard
I implemented v4L2 driver in this set and get pixel format ioctl calls are not working
Any one know the answer means contact me mail id muralikrishnan3232@gmail. com
While installing libv4l-dev ( sudo apt-get install libv4l-dev ), It couldn’t locate package. I am getting the folowing logs there. Please help me to overcome this issue.
root@beaglebone:~# apt-get install libv4l-dev
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package libv4l-dev
I have initiated the process as explained here with Logitech c270, it supports mjpg. but I am getting this error.
kitchen@beaglebone:~/boneCV$ ./capture -f -c 600 -o > output.raw
Force Format 1
select timeout
if anyone can help it will be a great thanks, I have project submission.
Your comment is awaiting moderation.
I have initiated the process as explained here with Logitech c270, it supports mjpg. but I am getting this error.
kitchen@beaglebone:~/boneCV$ ./capture -f -c 600 -o > output.raw
Force Format 1
select timeout
if anyone can help it will be a great thanks, I have project submission. —– sarbjitsingh_m170049ec@nitc.ac.in
if ur issue is resolved ,help me.