4 Replies Latest reply on Oct 28, 2015 6:27 PM by CMata_Intel

    How can you record Audio and Video with USB webcam on Intel Edison?

    ECEngineer

      Hi,

       

      I want to create a simple application which includes recording video files (WITH AUDIO) on Intel Edison. I simply want to take the input from a USB webcam and save it on my Edison. I don't believe this functionality is in the Edison to begin with and am very open to different solutions.

       

      I've had my Edison (and Arduino breakout board) for a few weeks now and I have installed the latest image, setup Wi-Fi and all of the features supplied by the "maker garage" video series. Other than that, I have no idea why my device isn't being detected (under /dev/video0, it is seen under lsusb) since it is listed as UVC compatible.

       

      Thanks!

        • 1. Re: How can you recording Audio and Video with USB webcam on Intel Edison?
          CMata_Intel

          Hi ECEngineer,

           

          What is the output of running configure_edison –version?

          Which camera are you using?

          What is the output of running lsmod | grep uvc ?

          Have you tried with modprobe uvcvideo?

           

          Connect the webcam to the board (the board must be powered with a power supply) and then run lsusb, you should see something like:

          Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

          Bus 001 Device 002: ID 046d:0825 Logitech, Inc. Webcam C270

          Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

          Check if the Device ID of your camera (in the case above, the Device ID is 046d:0825) is listed in: http://www.ideasonboard.org/uvc/

           

          Regards,

          Charlie

          • 2. Re: How can you recording Audio and Video with USB webcam on Intel Edison?
            ECEngineer

            Hi Charlie!

             

            Just before receiving your post I re-flashed my second Edison module and did not install anything other than git so far and somehow when I plugged in my webcam, (Logitech c270, same as yours actually) it was recognized and created the /dev/video0 folder! Now that I have it "up and running", I am trying to get it to work with ffmpeg since it seems to have audio and video functionality with a single built in command. I can get video playback without any audio by running:

             

            $ ./ffmpeg -f alsa -ac 1 -i hw:0 -f video4linux2 -i /dev/video0 /tmp/out.mpg

             

            Also it is defaulting to a very low image quality, but I assume that is simply another flag that needs to be set. Do you know if the Edison is capable of using this ffmpeg command to record video with audio and/or any other libraries that capture video with audio?

             

            I'm running version 159 according to the configure_edison -- version.

             

            I will also try your modprobe on the first module which still has this issue to see if it resolves it.

             

            Thanks for your help!

            • 3. Re: How can you recording Audio and Video with USB webcam on Intel Edison?
              ECEngineer

              I found that the audio card for my USB webcam was listed as card 2 and could be accessed by using:

               

              $ ./ffmpeg -f alsa -ac 1 -i hw:2 -f video4linux2 -i /dev/video0 /media/sdcard/outwithsoundHD.mpg -s 1280x720 -video_size hd720 -framerate 30

               

              For those attempting to record audio with video, start by going through the example found at: https://github.com/drejkim/edi-cam

              Follow the instructions through "installing ffmpeg" and then:

               

              $ cd /home/root/bin/ffmpeg

               

              Then use the ./ffmpeg command shown above to capture video.

              Make sure to change the number (ie, hw:2 <- or -1 or 0 or 1) depending on your where your sound card is located.

              To find your sound card type:

               

              $ arecord -l <-- lowercase L

                        OR

              $ alsamixer

               

              Alsamixer will show you all of the audio capture and playback devices and allows you to actively change the gains (in dB) for each.

               

              CMata_Intel This line above records audio and video in a single .mpg file, although the video quality on the output is clearly not 720p and seems more like 240p.

              Do you have any idea as to what could be causing this. I used 2 separate video size commands, although it doesn't seem to be working.

               

              Thanks!

              • 4. Re: How can you record Audio and Video with USB webcam on Intel Edison?
                CMata_Intel

                Hi ECEngineer

                 

                Have you tried to use different frame sizes like -s 320x240 ?

                You can also try with -acodec libmp3lame instead of –f alsa to see if there are improvements

                 

                Regards,

                Charlie