Audio/Video streaming with ffmpeg and UDOO camera module

Discussion in 'Accessories' started by nonlinearmind, Sep 17, 2014.

  1. nonlinearmind

    nonlinearmind New Member

    Joined:
    Aug 9, 2014
    Messages:
    8
    Likes Received:
    0
    I've been trying for the last month to stream realtime video and audio from Udoo to a server running crtmpserver (or wowza streaming server). I struggled with Gstreamer for a while, and was unsuccessful. I have had success in the past with ffmpeg on Raspberry Pi, but that board didn't quite have the power to stream video and audio.

    I've managed to successfully put together a ffmpeg pipeline that works, and I thought I would post it here for anyone trying to do the same. If anyone knows any way that this could be optimized further, please let me know, as I'm little more than a newbie.

    I'm using the latest UDOObuntu image, which has the camera module loop through to /dev/video7
    I'm using the built-in microphone jack for audio.

    I compiled and installed ffmpeg and dependencies using this guide: http://www.raspberrypi.org/forums/viewt ... 43&t=53936

    The following are my own steps based on it ( again, there may be more optimal ways to do this):

    Install dependencies
    Code:
    sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev  libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libx11-dev  libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev libasound2-dev
    Install Yasm
    Code:
        cd /usr/src
        wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
        tar xzvf yasm-1.2.0.tar.gz
        cd yasm-1.2.0
        ./configure
        make
        make install
    Install h.264 video encoder
    Code:
        cd /usr/src
        git clone git://git.videolan.org/x264
        cd x264
        ./configure --disable-asm --enable-shared
        make
        make install
    Install mp3 audio encoder
    Code:
        cd /usr/src
        wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.tar.gz
        tar xzvf lame-3.99.tar.gz
        cd lame-3.99
        ./configure
        make
        make install
    Install aac encoder
    Code:
        cd /usr/src
        curl -#LO http://downloads.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.gz
        tar xzvf faac-1.28.tar.gz
        cd faac-1.28
        ./configure
        make
        make install
    If you get errors, edit common/mpeg4ip.h
    comment out line 126
    Install libfdk aac
    Code:
    wget -O fdk-aac.zip https://github.com/mstorsjo/fdk-aac/zipball/master
    unzip fdk-aac.zip
    cd mstorsjo-fdk-aac*
    autoreconf -fiv
    ./configure 
    make
    make install 
    
    Install libopus audio encoder
    Code:
        cd /usr/src
    wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz
    tar xzvf opus-1.1.tar.gz
    cd opus-1.1
    ./configure 
    make
    make install 
    Install ffmpeg ( 'make' will take a couple of hours)
    Code:
        cd /usr/src/
        git clone git://source.ffmpeg.org/ffmpeg.git
        cd ffmpeg     
        ./configure --enable-shared --enable-gpl --prefix=/usr --enable-nonfree --enable-libmp3lame --enable-libfaac --enable-libx264 --enable-version3 --disable-mmx --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libopus --enable-libtheora --enable-libvorbis
        make
        make install
    Set load library location
    Code:
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib ffmpeg 
    ldconfig
    That should do it as far as installing ffmpeg goes. You can double check by getting the version:
    Code:
    ffmpeg -version
    
    and checking the codecs installed:
    Code:
    ffmpeg -codecs
    If everything checks out, you should be able to run a ffmpeg pipeline.
    Here is the one that I've gotten to work to stream audio and video:
    Code:
    ffmpeg -f video4linux2 -video_size 640x480 -framerate 30 -input_format yuyv422 -i /dev/video7 -f alsa  -i hw:0,0 -map 0:0 -map 1:0  -vcodec libx264 -preset ultrafast -b:v 150k -bufsize 150k  -acodec aac -vbr 3 -strict -2  -f flv -metadata streamName=myStream tcp://192.168.1.20:6666
     
  2. mikelangeloz

    mikelangeloz Member

    Joined:
    Jul 9, 2013
    Messages:
    129
    Likes Received:
    1
    Great!!!! We'll integrate that into next UDOObuntu release!
     
  3. SvartaHajen

    SvartaHajen New Member

    Joined:
    Jan 12, 2015
    Messages:
    5
    Likes Received:
    0
    Was this finally included in the recent version?

    I am trying to replicate it (only video) but so far the stream runs, I can connect to it but I can't see anything (using vlc for Android as a client).

    Enric
     

Share This Page