11 Replies Latest reply on Apr 29, 2016 2:14 PM by PabloM_Intel

    Issue with video streaming using ffmpeg

    Wavics

      Hi

      I have a USB Webcam (Logitech C270) connected to a Edison board.
      I would like to stream the video and access it from an internet browser
      The edison-image-ww18-15 image is installed on the Edison

      Here is an extraction of the shell window

      ------------------------------------------------------------------
      <code>
      root@edison:~# node edi-cam/web/server/server.js &
      [1] 356
      root@edison:~# WebSocket server listening on port 8084
      HTTP server listening on port 8080
      Listening for video stream on port 8082
      edi-cam/bin/do_ffmpeg.sh
      ffmpeg version 2.6.3-   http://johnvansickle.com/ffmpeg/    Copyright (c) 2000-2015 the FFmpeg developers
        built with gcc 4.9.2 (Debian 4.9.2-16)
        configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --cc=gcc-4.9
        libavutil      54. 20.100 / 54. 20.100
        libavcodec     56. 26.100 / 56. 26.100
        libavformat    56. 25.101 / 56. 25.101
        libavdevice    56.  4.100 / 56.  4.100
        libavfilter     5. 11.102 /  5. 11.102
        libswscale      3.  1.101 /  3.  1.101
        libswresample   1.  1.100 /  1.  1.100
        libpostproc    53.  3.100 / 53.  3.100
      Input #0, video4linux2,v4l2, from '/dev/video0':
        Duration: N/A, start: 51.807801, bitrate: 36864 kb/s
          Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 320x240, 36864 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
      Please use -b:a or -b:v, -b is ambiguous
      Stream Connected: 127.0.0.1:35276 size: 320x240
      Output #0, mpeg1video, to 'http://127.0.0.1:8082':
        Metadata:
          encoder         : Lavf56.25.101
          Stream #0:0: Video: mpeg1video, yuv420p, 320x240, q=2-31, 800 kb/s, 30 fps, 30 tbn, 30 tbc
          Metadata:
            encoder         : Lavc56.26.100 mpeg1video
      Stream mapping:
        Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg1video (native))
      Press [q] to stop, [?] for help
      frame=   18 fps=0.0 q=2.0 size=      66kB time=00:00:00.53 bitrate=1013.0kbits/s
      frame=   33 fps= 33 q=2.0 size=     123kB time=00:00:01.03 bitrate= 972.2kbits/s
      frame=   48 fps= 32 q=2.0 size=     176kB time=00:00:01.53 bitrate= 940.6kbits/s
      frame=   63 fps= 31 q=2.0 size=     238kB time=00:00:02.03 bitrate= 958.5kbits/s
      frame=   79 fps= 31 q=2.0 size=     295kB time=00:00:02.56 bitrate= 941.0kbits/s
      frame=   94 fps= 31 q=2.0 size=     349kB time=00:00:03.06 bitrate= 931.3kbits/s
      frame=  109 fps= 31 q=2.0 size=     401kB time=00:00:03.56 bitrate= 921.4kbits/s
      frame=  124 fps= 31 q=2.1 size=     464kB time=00:00:04.06 bitrate= 934.4kbits/s
      frame=  139 fps= 31 q=2.0 size=     517kB time=00:00:04.56 bitrate= 926.7kbits/s
      frame=  154 fps= 31 q=2.0 size=     571kB time=00:00:05.06 bitrate= 922.6kbits/s
      frame=  169 fps= 30 q=2.0 size=     626kB time=00:00:05.56 bitrate= 921.8kbits/s
      </code>
      -----------------------------------------------------------------------------------------------------------------


      In shell, everything looks ok and Webcam LED turn ON after sending these commands
      But in the internet browser, I don't see anything except a white rectangular (empty)

      Any idea why I don't see anythin on the browser ?

       

      Thanks

        • 1. Re: Issue with video streaming using ffmpeg
          PabloM_Intel

          Hi Wavics,

           

          Are you using the Arduino Breakout board or the Mini Breakout board?

           

          Regarding the process, what steps are you following to make the webcam work?

           

          Regards,

          PabloM_Intel

          • 2. Re: Issue with video streaming using ffmpeg
            Wavics

            Hi Pablo,

             

            I use the Arduino Breakout board.

            I have node.js running on the platform and try to stream the video using ffmpeg.

             

            Here is the status :

            - I manage to save the video in an output file using ffmpeg

            - I do not manage to stream it on my PC internet browser using ffmpeg. The PC is connected to the Edison through a router

            Regards,

            Wavics

            • 3. Re: Issue with video streaming using ffmpeg
              Intel_Jesus

              Hi Wavics,

               

              Are you using the edi-cam from drejkim/edi-cam · Github?

              I also had a similar issue, the node.js would be running and the webcam LED was on. When i loaded the nodejs server in a web browser using the IP address it would say loading or simply a blank screen. How are you addressing the server in the browser? Depending on your network configuration your address should be something like http://192.168.1.2:8080

               

              Also, did you update the websocket address in the web/client/index.html?

              Mine was something like var wsUrl = 'ws://192.168.1.2:8084/';

               

              If that does not work, i suggest you to re-flash your Edison.

               

              Regards,

              Jesus

              • 4. Re: Issue with video streaming using ffmpeg
                Malay_soni

                hey Wavics,

                I am also following the same tutorial. I got my camera configured and get live streaming through websocket.

                I also want to capture image and store that on edison. can you help me with this.?

                 

                Thanks,

                Malay

                • 5. Re: Issue with video streaming using ffmpeg
                  PabloM_Intel

                  Hi Malay_soni,

                   

                  I saw that you already have an opened case discussing the same issue that you asked here. So we will continue providing you support in that thread https://communities.intel.com/thread/87420.

                   

                  Regards,

                  PabloM_Intel

                  • 6. Re: Issue with video streaming using ffmpeg
                    mr_crocodile556

                    Hi, I am also unable to show the image on the webserver following this tutorial: Edison monitoring system with motion detection, cloud connection and video streaming - All

                     

                    My web server is able to run with a blank image.

                     

                    Following Step 3: Configure web server for streaming the video across the network


                    I've created directories as followed using groupadd and useradd

                    Next, i did not fully understood "Copy the web server autostart script into /etc/init.d to have it started on OS boot."

                    I skipped this step since the motion-webserver script is already in it after i git clone this repo, am i doing it right?

                    Next, i cp 'scripts' from edison-mon-sys/home/motion over to /home/motion/

                    Next, i did a npm install in home/motion/scripts

                    However there is a warning line displayed: npm WARN package.json motion-edison-demo-webserver@0.1.0 No repository field.

                    Lastly, i change the IP address in index.html to http://(board/ IP):10080 as followed and did a node server.js however its a blank image.


                    Can anyone guide me what did i do wrong?

                    • 7. Re: Issue with video streaming using ffmpeg
                      PabloM_Intel

                      Hi mr_crocodile556,

                       

                      I haven’t tried the process that you mention, but I’ve been able to implement this one https://github.com/drejkim/edi-cam. Have you tried with this one? Node.js is used in both processes so I believe you won’t have any issues with that.

                       

                      Regards,

                      Pablo

                      • 8. Re: Issue with video streaming using ffmpeg
                        mr_crocodile556

                        Thank you, yes i am able to implement the one on edi-cam as well, however i would like to add in a motion detecting function for my project.

                        Since, the one on edi-cam did not have motion detecting function,i tried to follow through Edison monitoring system with motion detection, cloud connection and video streaming - All

                        and re created a new web server with that tutorial.

                         

                        Do you have any idea how do i add in motion detecting function to my camera?

                        • 9. Re: Issue with video streaming using ffmpeg
                          PabloM_Intel

                          Hi mr_crocodile556,

                           

                          Have you checked this guide before? http://www.instructables.com/id/Motion-Activated-Security-Camera-using-Intel-Ediso/. You could even try to implement the motion section of the first tutorial you mentioned, but using the webserver from the one I shared with you. It should be possible to mix them both.

                           

                          Regards,

                          Pablo

                          • 10. Re: Issue with video streaming using ffmpeg
                            mr_crocodile556

                            Thank you for the useful link,

                             

                            I tried implementing Edison monitoring system with motion detection, cloud connection and video streaming - All and i faced a problem here

                             

                            Under Step 2:Configure Motion,

                            I followed the instruction and pasted motion.conf file download from his repo into /etc

                            Next, i put the init.d directory into /etc.

                             

                            That should be all for Step 2 right?

                            However when i run the command of "motion" to test it out i received the following error

                             

                             

                            [0] Processing thread 0 - config file /etc/motion.conf
                            [0] Unknown config option "ffmpeg_cap_new"
                            [0] Unknown config option "ffmpeg_cap_motion"
                            [0] Unknown config option "ffmpeg_timelapse"
                            [0] Unknown config option "ffmpeg_timelapse_mode"
                            [0] Unknown config option "ffmpeg_bps"
                            [0] Unknown config option "ffmpeg_variable_bitrate"
                            [0] Unknown config option "ffmpeg_video_codec"
                            [0] Unknown config option "ffmpeg_deinterlace"
                            [0] Unknown config option "movie_filename"
                            [0] Unknown config option "timelapse_filename"
                            [0] Motion 8.4.0 Started
                            [0] Thread 1 is from /etc/motion.conf
                            [0] motion-httpd/8.4.0 running, accepting connections
                            [1] Thread 1 started
                            [0] motion-httpd: waiting for data on port TCP 8080
                            [1] cap.driver: "uvcvideo"
                            [1] cap.card: "UVC Camera (046d:0825)"
                            [1] cap.bus_info: "usb-dwc3-host.2-1"
                            [1] cap.capabilities=0x84000001
                            [1] - VIDEO_CAPTURE
                            [1] - STREAMING
                            [1] Test palette MJPG (640x480)
                            [1] Using palette MJPG (640x480) bytesperlines 0 sizeimage 341333 colorspace 00000008
                            [1] found control 0x00980900, "Brightness", range 0,255
                            [1] "Brightness", default 128, current 128
                            [1] found control 0x00980901, "Contrast", range 0,255
                            [1] "Contrast", default 32, current 32
                            [1] found control 0x00980902, "Saturation", range 0,255
                            [1] "Saturation", default 32, current 32
                            [1] found control 0x00980913, "Gain", range 0,255
                            [1] "Gain", default 64, current 64
                            [1] mmap information:
                            [1] frames=4
                            [1] 0 length=341333
                            [1] 1 length=341333
                            [1] 2 length=341333
                            [1] 3 length=341333
                            [1] Using V4L2
                            [1] Resizing pre_capture buffer to 1 items
                            Corrupt JPEG data: 1 extraneous bytes before marker 0xd1
                            Corrupt JPEG data: 5 extraneous bytes before marker 0xd7
                            Corrupt JPEG data: 1 extraneous bytes before marker 0xd2
                            Corrupt JPEG data: 1 extraneous bytes before marker 0xd5
                            Corrupt JPEG data: 3 extraneous bytes before marker 0xd0

                             

                             

                            It is a continuous script that runs unless i Ctrl+C which outputs this error eventually

                             

                             

                            module.js:340
                              throw err;
                              ^
                            Error: Cannot find module 'temboo/core/temboosession'
                              at Function.Module._resolveFilename (module.js:338:15)
                              at Function.Module._load (module.js:280:25)
                              at Module.require (module.js:364:17)
                              at require (module.js:380:17)
                              at Object.<anonymous> (/home/motion/scripts/xively_post.js:37:16)
                              at Module._compile (module.js:456:26)
                              at Object.Module._extensions..js (module.js:474:10)
                              at Module.load (module.js:356:32)
                              at Function.Module._load (module.js:312:12)
                              at Function.Module.runMain (module.js:497:10)
                            [0] httpd - Finishing
                            [0] httpd Closing
                            [0] httpd thread exit
                            [0] Motion terminating

                             

                             

                            Are you able to help me look through the tutorial for me under Step 2 in the link provided above?

                             

                            Thank you.

                            • 11. Re: Issue with video streaming using ffmpeg
                              PabloM_Intel

                              Hi mr_crocodile556,

                               

                              I see that you’re trying to create an init script, but according to the tutorial creating a system service is also a possibility, have you tried this? As it is mentioned in the tutorial, it would be better to use system as Edison uses it as its primary system control. I would suggest you to check this thread, https://communities.intel.com/thread/60537. You can also take a look at the other services to see how it should be written and the instructions it should have.

                               

                              Regards,

                              Pablo