For my USB Logitech C920 MPEG4 webcam I decided that I would try to build ffmpeg from source and see if it improved the streaming capability of the camera. Currently, the stream is halting after about 30 seconds and the data stream becomes frozen.
So, based on the steps at this link I downloaded the x264 source and built it. I had to add in the /usr prefix in order that it is picked up correctly as a library; however, the step that I did at the end (through editing ld.so.conf) would have negated this.
1 2 3 4 5 |
git clone git://git.videolan.org/x264.git cd x264 ./configure --enable-shared --prefix=/usr make make install |
Then to build ffmpeg:
1 2 3 4 5 |
git clone git://git.videolan.org/ffmpeg.git ./configure --enable-shared --enable-libx264 --enable-gpl git remote set-url origin git://source.ffmpeg.org/ffmpeg make make install |
I had tried to download the source directly from source.ffmpeg.org for the first step but for some reason it was not working at the time. Anyway, this worked well.
However, I had problems when I tried to execute ffmpeg as the linked libraries had not loaded. To fix the ffmpeg relocation error on “/usr/local/lib/libavformat.so.52”
1 |
vi /etc/ld.so.conf |
add “/usr/local/lib” to the file and then type:
1 |
ldconfig |
Now, ffmpeg works! and:
1 |
ffmpeg -version |
gives the output:
1 2 3 4 5 6 7 8 9 10 11 12 |
root@beaglebone:~# ffmpeg -version ffmpeg version N-52079-g458d956 built on Apr 11 2013 23:44:35 with gcc 4.5.4 (GCC) 20120305 (prerelease) configuration: --enable-libx264 --enable-gpl --enable-shared libavutil 52. 26.100 / 52. 26.100 libavcodec 55. 2.100 / 55. 2.100 libavformat 55. 2.100 / 55. 2.100 libavdevice 55. 0.100 / 55. 0.100 libavfilter 3. 56.100 / 3. 56.100 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 3.100 / 52. 3.100 |
Ffmpeg is working very well and I can capture a longer stream through transcoding; however, I still cannot capture the stream directly to the drive without transcoding, despite the stream being in H264 format.
To capture the video stream for the Angstrom distribution from the usb camera through the use of video4linux2, the video can be captured using:
1 |
ffmpeg -f video4linux2 -i /dev/video0 out.avi |
To configure the mode of the camera, first check available options:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
root@beaglebone:~# v4l2-ctl --list-formats ioctl: VIDIOC_ENUM_FMT Index : 0 Type : Video Capture Pixel Format: 'YUYV' Name : YUV 4:2:2 (YUYV) Index : 1 Type : Video Capture Pixel Format: 'H264' (compressed) Name : H.264 Index : 2 Type : Video Capture Pixel Format: 'MJPG' (compressed) Name : MJPEG |
or to specify the actual parameters through v4l2-ctl and then using the actual values passed to ffmpeg, where we select the H264 pixel format with a resolution of 800×600 at 15 frames per second:
1 2 3 |
v4l2-ctl --set-fmt-video=width=800,height=600,pixelformat=1 v4l2-ctl --set-parm=15 ffmpeg -f video4linux2 -s 800x600 -r 15 -i /dev/video0 test.mp4 |
This captures a stream that works fine, but still seems to freeze after some time.
just wondering how long did that take you to finish the compilation?
Dear Derek,
first of all,
your web site is most valuable and precious for people which fond of and START working with BBB.
Could you please post a procedure which outlines (or details)
a way to build BBB application with an additional library
(e.g. libcurl.a which is not an integral or standard package)
i.e. download the correct libcurl binary and *.h files (with debug), to Ubuntu desktop,
setting Eclipse ‘include’ & ‘libraries’,
(within Ubuntu desktop) cross compiling for armhf architecture
then copy App1 binary to BBB and remote debug it [that, you already post about]
etc.
it seems to be very basic development process
but I keep failing to perform it successfully
regards
Haggai
When running make for ffmpeg i ran make and it took about 45 minutes til it stopped it said error 1, then attempted make install and said insufficient space and then kicked me off the shell terminal. Now ssh 192.168.7.2 -l root for my beaglebone isnt working. Connection is timing out. what can i do plz help
Hi there,
I’m trying to stream to ustream using a raspberry pi and a logitech c920. Unfortunately I can’t set a resolution lower than 1080p and that’s too much (either for ustream or for my bandwidth), since the picture on ustreams stays black.
v4l2-ctl –set-fmt-video=width=800,height=600,pixelformat=1 doesn’t work for me. It seems avconv is overwriting these values (see also https://trac.ffmpeg.org/ticket/2305).
Do you have any advice on how I could capture the h264 stream from the camera and pipe it to avconv?
Thanks for answering,
With kind regards,
Leo
u have done a great work the blog was very much help full i liked ur blog a lot …
i was trying to install ffmpeg but i am not able to install…. m getting error log as memory is full…
can u help me please
Thank you for the post. You can add here some additional libs and codecs for ffmpeg support all kind of audio and video formats like listed here – http://sysadm.pp.ua/linux/video-streaming/ffmpeg-build.html .
dear Derek,
thank u for this information of building ffmpeg on beaglebone. i just have a question that if i want to play only an audio file without any video processing using beaglebone then how do i use ffmpeg? or is there any other way to do so?
I am new with beaglebone and I am trying to connect a webcam to do image processing. I do all the spets of yoru website but when I do:
root@beaglebone:~# ffmpeg -f video4linux2 -i /dev/video0 out.avi
there is not somethign wrong in the process. but It appears:
WARNING: gnome-keyring:: couldn’t connect to: /run/user/daniel/keyring-37jbja/pkcs11: No such file or directory
ffmpeg version 0.8.16-6:0.8.16-1, Copyright (c) 2000-2014 the Libav developers
built on Sep 17 2014 13:57:48 with gcc 4.6.3
The ffmpeg program is only provided for script compatibility and will be removed
in a future release. It has been deprecated in the Libav project to allow for
incompatible command line syntax improvements in its replacement called avconv
(see Changelog for details). Please use avconv instead.
so I can`t access or see the webcam. what can I fixed??
I appreciate your support.
The make command for ffmpeg can take several hours, that should be pointed out I think.
those who are finding no more space, you need to increase the file system size on your SD card.
http://elinux.org/Beagleboard:Expanding_File_System_Partition_On_A_microSD
Thanks for posting the instructions for building ffmpeg. Your tutorials are greatly appreciated. As others noticed, it takes a long time to make. As others noticed it takes more room than there is available in the onboard storage. I had to put a non-booting SD card formatted ext4 to use as a workspace for building ffmpeg. Regarding the shared libraries, I added a new file ffmpeg.conf to ld.so.conf.d containing /usr/local/lib entry vs adding that to ld.so.conf itself.