Recherche avancée

Médias (91)

Autres articles (76)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Menus personnalisés

    14 novembre 2010, par

    MediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
    Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
    Menus créés à l’initialisation du site
    Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...)

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

Sur d’autres sites (5453)

  • AForge.Video.FFMPEG used in C#

    30 décembre 2018, par cuong nguyen

    I use Visual C# 2008 and want to write AVI file from bmp sequences.

    I found AForge.Video.VWF but it’s just for "vmw3" or "DIB " codecs and I want to use AForge.Video.FFMPEG but it got error.

    For example I just code :

    using System;
    using System.Collections.Generic;

    using System.Linq;
    using System.Text;
    using AForge.Video.FFMPEG;

    namespace ConsoleApplication4
    {
       class Program
       {
           static void Main(string[] args)
           {
               VideoFileWriter vfw = new VideoFileWriter();
           }
       }
    }

    But I got this filenotfoundexception

    {"The specified module could not be found. (Exception from HRESULT: 0x8007007E)":null}
  • ffmpeg and pulse audio creating buzzy speech

    17 juin 2017, par flashape

    I’m attempting to record video and audio from an ec2 instance (Ubuntu 16.04), using xvfb and pulse audio. Everything works fine, except that the output file contains "buzzy" speech (not sure if this is what "clipping" is ?). This happens using either aac or mp3 audio codecs.

    Sample audio file : http://s000.tinyupload.com/index.php?file_id=86237391396073526211

    ffmpeg command :

    ffmpeg \
    -f x11grab -framerate 30 -video_size ${SCREEN_WIDTH}x${SCREEN_HEIGHT} -i :1.0 \
    -f pulse -i default \
    -c:v libx264 -preset veryfast -maxrate 2500k -bufsize 2500k -vf "format=yuv420p" -g 60 \
    -c:a aac -strict -2 -channel_layout stereo  -ab 256k -ar 48000 -bufsize 512k -ac 2  \
    -flags +global_header -f flv "test.mp4"

    The output from ffmpeg when I run the command :

    Input #0, x11grab, from ':1.0':
     Duration: N/A, start: 1497567394.762052, bitrate: N/A
       Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1360x764, 30 fps, 30 tbr, 1000k tbn, 30 tbc
    Guessed Channel Layout for  Input Stream #1.0 : stereo
    Input #1, pulse, from 'default':
     Duration: N/A, start: 1497567396.743667, bitrate: 1536 kb/s
       Stream #1:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
    [libx264 @ 0x1977d20] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 0x1977d20] profile High, level 3.2
    [libx264 @ 0x1977d20] 264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=60 keyint_min=6 scenecut=40 intra_refresh=0 rc_lookahead=10 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=2500 vbv_bufsize=512 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
    Output #0, flv, to 'test.mp4':
     Metadata:
       encoder         : Lavf56.40.101
       Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 1360x764, q=-1--1, max. 2500 kb/s, 30 fps, 1k tbn, 30 tbc
       Metadata:
         encoder         : Lavc56.60.100 libx264
       Stream #0:1: Audio: aac ([10][0][0][0] / 0x000A), 48000 Hz, stereo, fltp, 256 kb/s
       Metadata:
         encoder         : Lavc56.60.100 aac
    Stream mapping:
     Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
     Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))

    Based on various posts, I thought it might be something in the pulse config, particularly the "resample-method" setting, but that doesn’t appear to do anything. Here is how the /etc/pulse/daemon.conf config file currently stands :

    ; daemonize = no
    ; fail = yes
    ; allow-module-loading = yes
    ; allow-exit = yes
    ; use-pid-file = yes
    ; system-instance = no
    ; local-server-type = user
    ; enable-shm = yes
    ; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB
    ; lock-memory = no
    ; cpu-limit = no

    ; high-priority = yes
    ; nice-level = -11

    ; realtime-scheduling = yes
    ; realtime-priority = 5

    ; exit-idle-time = 20
    ; scache-idle-time = 20

    ; dl-search-path = (depends on architecture)

    ; load-default-script-file = yes
    ; default-script-file = /etc/pulse/default.pa

    ; log-target = auto
    ; log-level = notice
    ; log-meta = no
    ; log-time = no
    ; log-backtrace = 0

    ; resample-method = speex-float-1
    ; resample-method = speex-float-10
    resample-method = speex-fixed-10
    ; enable-remixing = yes
    enable-lfe-remixing = yes
    ; lfe-crossover-freq = 120

    flat-volumes = no

    ; rlimit-fsize = -1
    ; rlimit-data = -1
    ; rlimit-stack = -1
    ; rlimit-core = -1
    ; rlimit-as = -1
    ; rlimit-rss = -1
    ; rlimit-nproc = -1
    ; rlimit-nofile = 256
    ; rlimit-memlock = -1
    ; rlimit-locks = -1
    ; rlimit-sigpending = -1
    ; rlimit-msgqueue = -1
    ; rlimit-nice = 31
    ; rlimit-rtprio = 9
    ; rlimit-rttime = 200000

    ; default-sample-format = s16le
    default-sample-format = s32le
    default-sample-rate = 44100
    ; default-sample-rate = 48000
    ; alternate-sample-rate = 48000
    alternate-sample-rate = 44100
    ; default-sample-channels = 2
    ; default-channel-map = front-left,front-right

    ; default-fragments = 4
    ; default-fragment-size-msec = 25
    ; default-fragments = 4
    ; default-fragment-size-msec = 25


    ; enable-deferred-volume = yes
    deferred-volume-safety-margin-usec = 1
    ; deferred-volume-extra-delay-usec = 0

    Edit :

    Ok, updated the ffmpeg command to capture only the audio, but still have the same issue :

    ffmpeg \
    -f pulse -i default \
    -c:a aac -strict -2 -channel_layout stereo  -ab 256k -ar 48000 -bufsize 512k -ac 2  \
    test.aac

    I do get some interesting messages in the output about timestamps being off :

    [aac @ 0x12a4900] Queue input is backward in timeits/s
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 182857 >= 175924
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 182857 >= 176948
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 182857 >= 177972
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 182857 >= 178996
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 182857 >= 180020
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 182857 >= 181044
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 182857 >= 182068
    [aac @ 0x12a4900] Queue input is backward in time
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 183406
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 184430
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 185454
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 186478
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 187502
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 188526
    [aac @ 0x12a4900] Queue input is backward in time
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 189550
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 190574
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 169622
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 170646
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 171670
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 172694
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 173718
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 174742
    [aac @ 0x12a4900] Queue input is backward in time
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 175766
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 176790
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 157020
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 158083
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 159107
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 160131
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 161155
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 162179
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 163203
    [aac @ 0x12a4900] Queue input is backward in time
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 164227
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 165251
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 154697
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 159400
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 160424
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 161448
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 162472
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 163496
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 164520
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 165544
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 166568
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 171795
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 172819
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 173843
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 174867
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 175891
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 176915
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 177939
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 178963
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 187279
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 189829
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 190853
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 191877
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 193354 >= 192901
    [aac @ 0x12a4900] Queue input is backward in time
       Last message repeated 2 times
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 216609 >= 216172
    [aac @ 0x12a4900] Queue input is backward in time
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 216609 >= 214950
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 216609 >= 214933
    [adts @ 0x12a35a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 216609 >= 214836
  • Opencv crosscompile with ffmpeg and other 3rdparty for arm board

    16 juin 2017, par Little Tooth

    After buliding Qt5.5.1 for my arm board sucessfully, I am taking up to crosscompile opencv. Here are the steps :

    First, I crosscompile 3rdparty :

    a.libz

    lmk@lmk-virtual-machine:/home/newdisk$ sudo tar -zvxf zlib-1.2.8.tar.gz
    lmk@lmk-virtual-machine:/home/newdisk$ cd zlib-1.2.8
    lmk@lmk-virtual-machine:/home/newdisk/zlib-1.2.8$ sudo ./configure --prefix=/home/newdisk/optnew/opencv-rely -shared
    lmk@lmk-virtual-machine:/home/newdisk/zlib-1.2.8$ sudo vi Makefile

    and etit Makefile in some details :

    #Makefile
    CC=/home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-gcc
    LDSHARED= /home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map
    AR=/home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-ar
    RANLIB=arm-linux-ranlib

    the last step is run make and make install :

    lmk@lmk-virtual-machine:/home/newdisk/zlib-1.2.8$ sudo make
    lmk@lmk-virtual-machine:/home/newdisk/zlib-1.2.8$ sudo make install

    b.libjpeg

    lmk@lmk-virtual-machine:/home/newdisk$ sudo tar -zvxf jpegsrc.v9.tar.gz
    lmk@lmk-virtual-machine:/home/newdisk$ cd jpeg-9
    lmk@lmk-virtual-machine:/home/newdisk/jpeg-9$ sudo CC=/home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-gcc ./configure --host=arm-linux --prefix=/home/newdisk/optnew/opencv-rely --enable-shared --enable-static
    lmk@lmk-virtual-machine:/home/newdisk/jpeg-9$ sudo make
    lmk@lmk-virtual-machine:/home/newdisk/jpeg-9$ sudo make install

    c.libpng

    lmk@lmk-virtual-machine:/home/newdisk$ sudo xz -d libpng-1.6.29.tar.xz
    lmk@lmk-virtual-machine:/home/newdisk$ sudo tar -xvf libpng-1.6.29.tar
    lmk@lmk-virtual-machine:/home/newdisk$ cd libpng-1.6.29
    lmk@lmk-virtual-machine:/home/newdisk/libpng-1.6.29$ sudo CC=/home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-gcc ./configure --host=arm-linux --prefix=/home/newdisk/optnew/opencv-rely --enable-shared --enable-static
    lmk@lmk-virtual-machine:/home/newdisk/libpng-1.6.29$ sudo make
    lmk@lmk-virtual-machine:/home/newdisk/libpng-1.6.29$ sudo make install

    d.yasm

    lmk@lmk-virtual-machine:/home/newdisk$ sudo tar -zvxf yasm-1.3.0.tar.gz
    lmk@lmk-virtual-machine:/home/newdisk$ cd yasm-1.3.0
    lmk@lmk-virtual-machine:/home/newdisk/yasm-1.3.0$ sudo CC=/home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-gcc ./configure --prefix=/home/newdisk/optnew/opencv-rely --host=arm-linux
    lmk@lmk-virtual-machine:/home/newdisk/yasm-1.3.0$ sudo make
    lmk@lmk-virtual-machine:/home/newdisk/yasm-1.3.0$ sudo make install

    e.libx264

    lmk@lmk-virtual-machine:/home/newdisk$ sudo tar -jxvf last_x264.tar.bz2
    lmk@lmk-virtual-machine:/home/newdisk$ cd x264-snapshot-20170612-2245
    lmk@lmk-virtual-machine:/home/newdisk/x264-snapshot-20170612-2245$ sudo CC=/home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-gcc ./configure --enable-shared --host=arm-linux --disable-asm --prefix=/home/newdisk/optnew/opencv-rely
    lmk@lmk-virtual-machine:/home/newdisk/x264-snapshot-20170612-2245$ sudo make
    lmk@lmk-virtual-machine:/home/newdisk/x264-snapshot-20170612-2245$ sudo make install

    f.libxvid

    lmk@lmk-virtual-machine:/home/newdisk$ cd xvidcore-1.3.3
    lmk@lmk-virtual-machine:/home/newdisk/xvidcore-1.3.3$ cd build/generic
    lmk@lmk-virtual-machine:/home/newdisk/xvidcore-1.3.3/build/generic$ sudo CC=/home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-gcc ./configure --prefix=/home/newdisk/optnew/opencv-rely --host=arm-linux  --disable-assembly
    lmk@lmk-virtual-machine:/home/newdisk/xvidcore-1.3.3/build/generic$ sudo make
    lmk@lmk-virtual-machine:/home/newdisk/xvidcore-1.3.3/build/generic$ sudo make install

    g.ffmpeg

    lmk@lmk-virtual-machine:/home/newdisk$ sudo tar -jvxf ffmpeg-3.3.2.tar.bz2
    lmk@lmk-virtual-machine:/home/newdisk$ cd ffmpeg-3.3.2
    lmk@lmk-virtual-machine:/home/newdisk/ffmpeg-3.3.2$
    sudo ./configure --prefix=/home/newdisk/optnew/opencv-rely --enable-shared --disable-static --enable-gpl --enable-cross-compile  --arch=arm --disable-stripping --target-os=linux --enable-libx264 --enable-libxvid --cc=/home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-gcc --enable-swscale --extra-ldflags=-L/home/newdisk/optnew/opencv-rely/lib --extra-cflags=-I/home/newdisk/optnew/opencv-rely/include
    lmk@lmk-virtual-machine:/home/newdisk/ffmpeg-3.3.2$ sudo make
    lmk@lmk-virtual-machine:/home/newdisk/ffmpeg-3.3.2$ sudo make install

    There is no problem in 3rdparty crosscompile.
    Next, opencv crosscompile :

    lmk@lmk-virtual-machine:/home/newdisk$ sudo unzip opencv-3.1.0.zip
    lmk@lmk-virtual-machine:/home/newdisk$ cd opencv-3.1.0
    lmk@lmk-virtual-machine:/home/newdisk/opencv-3.1.0$ sudo mkdir BuildOpencv
    lmk@lmk-virtual-machine:/home/newdisk/opencv-3.1.0$ cd BuildOpencv
    lmk@lmk-virtual-machine:/home/newdisk/opencv-3.1.0/BuildOpencv$ sudo vim toolchain.cmake
    #toolchain.cmake
    ###########user defined#############
    set( CMAKE_SYSTEM_NAME Linux )
    set( CMAKE_SYSTEM_PROCESSOR arm )
    set( CMAKE_C_COMPILER /home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-gcc )
    set( CMAKE_CXX_COMPILER /home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-g++ )
    ###########user defined#############
    set( CMAKE_FIND_ROOT_PATH /home/newdisk/optnew/opencv-rely)
    set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
    set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
    set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
    ######################################

    Then I run cmake :

    lmk@lmk-virtual-machine:/home/newdisk/opencv-3.1.0/BuildOpencv$ sudo cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake ../

    Here is the result:

    -- Detected version of GNU GCC: 45 (405)
    -- Found ZLIB: /home/newdisk/optnew/opencv-rely/lib/libz.so (found suitable version "1.2.8", minimum required is "1.2.3")
    -- Could NOT find TIFF (missing:  TIFF_LIBRARY TIFF_INCLUDE_DIR)
    -- Could NOT find Jasper (missing:  JASPER_LIBRARIES) (found version "1.900.1")
    -- Found ZLIB: /home/newdisk/optnew/opencv-rely/lib/libz.so (found version "1.2.8")
    -- checking for module 'gtk+-3.0'
    --   package 'gtk+-3.0' not found
    -- checking for module 'gstreamer-base-1.0'
    --   package 'gstreamer-base-1.0' not found
    -- checking for module 'gstreamer-video-1.0'
    --   package 'gstreamer-video-1.0' not found
    -- checking for module 'gstreamer-app-1.0'
    --   package 'gstreamer-app-1.0' not found
    -- checking for module 'gstreamer-riff-1.0'
    --   package 'gstreamer-riff-1.0' not found
    -- checking for module 'gstreamer-pbutils-1.0'
    --   package 'gstreamer-pbutils-1.0' not found
    -- checking for module 'gstreamer-base-0.10'
    --   package 'gstreamer-base-0.10' not found
    -- checking for module 'gstreamer-video-0.10'
    --   package 'gstreamer-video-0.10' not found
    -- checking for module 'gstreamer-app-0.10'
    --   package 'gstreamer-app-0.10' not found
    -- checking for module 'gstreamer-riff-0.10'
    --   package 'gstreamer-riff-0.10' not found
    -- checking for module 'gstreamer-pbutils-0.10'
    --   package 'gstreamer-pbutils-0.10' not found
    -- Looking for linux/videodev.h
    -- Looking for linux/videodev.h - found
    -- Looking for linux/videodev2.h
    -- Looking for linux/videodev2.h - found
    -- Looking for sys/videoio.h
    -- Looking for sys/videoio.h - not found
    -- checking for module 'libavresample'
    --   package 'libavresample' not found
    -- Looking for libavformat/avformat.h
    -- Looking for libavformat/avformat.h - not found
    -- Looking for ffmpeg/avformat.h
    -- Looking for ffmpeg/avformat.h - not found
    -- checking for module 'libgphoto2'
    --   package 'libgphoto2' not found
    -- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE)
    -- To enable PlantUML support, set PLANTUML_JAR environment variable or pass -DPLANTUML_JAR=<filepath> option to cmake
    -- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.6", minimum required is "2.7")
    -- Could NOT find PythonLibs (missing:  PYTHON_LIBRARIES) (found suitable version "2.7.6", minimum required is "2.7")
    -- Cannot probe for Python/Numpy support (because we are cross-compiling OpenCV)
    -- If you want to enable Python/Numpy support, set the following variables:
    --   PYTHON2_INCLUDE_PATH
    --   PYTHON2_LIBRARIES
    --   PYTHON2_NUMPY_INCLUDE_DIRS
    --   PYTHON3_INCLUDE_PATH
    --   PYTHON3_LIBRARIES
    --   PYTHON3_NUMPY_INCLUDE_DIRS
    -- Found PythonInterp: /usr/bin/python3.4 (found suitable version "3.4.3", minimum required is "3.4")
    -- Could NOT find PythonLibs (missing:  PYTHON_LIBRARIES) (Required is at least version "3.4")
    -- Cannot probe for Python/Numpy support (because we are cross-compiling OpenCV)
    -- If you want to enable Python/Numpy support, set the following variables:
    --   PYTHON2_INCLUDE_PATH
    --   PYTHON2_LIBRARIES
    --   PYTHON2_NUMPY_INCLUDE_DIRS
    --   PYTHON3_INCLUDE_PATH
    --   PYTHON3_LIBRARIES
    --   PYTHON3_NUMPY_INCLUDE_DIRS
    -- Could NOT find JNI (missing:  JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
    -- Could NOT find Matlab (missing:  MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN)
    --
    -- General configuration for OpenCV 3.1.0
    =====================================
    --   Version control:               unknown
    --
    --   Platform:
    --     Host:                        Linux 3.16.0-77-generic i686
    --     Target:                      Linux arm
    --     CMake:                       2.8.12.2
    --     CMake generator:             Unix Makefiles
    --     CMake build tool:            /usr/bin/make
    --     Configuration:               Release
    --
    --   C/C++:
    --     Built as dynamic libs?:      YES
    --     C++ Compiler:                /home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-g++  (ver 4.5.1)
    --     C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
    --     C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
    --     C Compiler:                  /home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-gcc
    --     C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
    --     C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
    --     Linker flags (Release):      
    --     Linker flags (Debug):        
    --     Precompiled headers:         YES
    --     Extra dependencies:          /home/newdisk/optnew/opencv-rely/lib/libjpeg.so /home/newdisk/optnew/opencv-rely/lib/libpng.so /home/newdisk/optnew/opencv-rely/lib/libz.so gtk-x11-2.0 gdk-x11-2.0 atk-1.0 gio-2.0 pangoft2-1.0 pangocairo-1.0 gdk_pixbuf-2.0 cairo pango-1.0 fontconfig gobject-2.0 freetype gthread-2.0 glib-2.0 dc1394 v4l1 v4l2 avcodec avformat avutil swscale dl m pthread rt
    --     3rdparty dependencies:       libwebp libtiff libjasper IlmImf
    --
    --   OpenCV modules:
    --     To be built:                 core flann imgproc ml photo video imgcodecs shape videoio highgui objdetect superres ts features2d calib3d stitching videostab
    --     Disabled:                    world
    --     Disabled by dependency:      -
    --     Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 python3 viz
    --
    --   GUI:
    --     QT:                          NO
    --     GTK+ 2.x:                    YES (ver 2.24.23)
    --     GThread :                    YES (ver 2.40.2)
    --     GtkGlExt:                    NO
    --     OpenGL support:              NO
    --     VTK support:                 NO
    --
    --   Media I/O:
    --     ZLib:                        /home/newdisk/optnew/opencv-rely/lib/libz.so (ver 1.2.8)
    --     JPEG:                        /home/newdisk/optnew/opencv-rely/lib/libjpeg.so (ver 90)
    --     WEBP:                        build (ver 0.3.1)
    --     PNG:                         /home/newdisk/optnew/opencv-rely/lib/libpng.so (ver 1.6.29)
    --     TIFF:                        build (ver 42 - 4.0.2)
    --     JPEG 2000:                   build (ver 1.900.1)
    --     OpenEXR:                     build (ver 1.7.1)
    --     GDAL:                        NO
    --
    --   Video I/O:
    --     DC1394 1.x:                  NO
    --     DC1394 2.x:                  YES (ver 2.2.1)
    --     FFMPEG:                      YES
    --       codec:                     YES (ver 54.35.1)
    --       format:                    YES (ver 54.20.4)
    --       util:                      YES (ver 52.3.0)
    --       swscale:                   YES (ver 2.1.1)
    --       resample:                  NO
    --       gentoo-style:              YES
    --     GStreamer:                   NO
    --     OpenNI:                      NO
    --     OpenNI PrimeSensor Modules:  NO
    --     OpenNI2:                     NO
    --     PvAPI:                       NO
    --     GigEVisionSDK:               NO
    --     UniCap:                      NO
    --     UniCap ucil:                 NO
    --     V4L/V4L2:                    Using libv4l1 (ver 0.8.8) / libv4l2 (ver 0.8.8)
    --     XIMEA:                       NO
    --     Xine:                        NO
    --     gPhoto2:                     NO
    --
    --   Parallel framework:            pthreads
    --
    --   Other third-party libraries:
    --     Use IPP:                     NO
    --     Use VA:                      NO
    --     Use Intel VA-API/OpenCL:     NO
    --     Use Eigen:                   NO
    --     Use Cuda:                    NO
    --     Use OpenCL:                  YES
    --     Use custom HAL:              NO
    --
    --   OpenCL:
    --     Version:                     dynamic
    --     Include path:                /home/newdisk/opencv-3.1.0/3rdparty/include/opencl/1.2
    --     Use AMDFFT:                  NO
    --      Use AMDBLAS:                 NO
    --
    --   Python 2:
    --     Interpreter:                 /usr/bin/python2.7 (ver 2.7.6)
    --
    --   Python 3:
    --     Interpreter:                 /usr/bin/python3.4 (ver 3.4.3)
    --
    --   Python (for build):            /usr/bin/python2.7
    --
    --   Java:
    --     ant:                         NO
    --     JNI:                         NO
    --     Java wrappers:               NO
    --     Java tests:                  NO
    --
    --   Matlab:                        Matlab not found or implicitly disabled
    --
    --   Documentation:
    --     Doxygen:                     NO
    --     PlantUML:                    NO
    --
    --   Tests and samples:
    --     Tests:                       YES
    --     Performance tests:           YES
    --     C/C++ Examples:              NO
    --
    --   Install path:                  /home/newdisk/opencv-3.1.0/BuildOpencv/install
    --
    --   cvconfig.h is in:              /home/newdisk/opencv-3.1.0/BuildOpencv
    -- -----------------------------------------------------------------
    --
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/newdisk/opencv-3.1.0/BuildOpencv
    </filepath>

    After configuring and generating, run cmake-gui :

    lmk@lmk-virtual-machine:/home/newdisk/opencv-3.1.0/BuildOpencv$ sudo cmake-gui

    Src:/home/newdisk/opencv-3.1.0
    Build:/home/newdisk/opencv-3.1.0/BuildOpencv

    CMAKE_INSTALL_PREFIX:/home/newdisk/optnew/opencv-arm

    Don't choose these items:
    WITH_CUDA
    WITH_GTK
    WITH_1394
    WITH_GSTREAMER
    WITH_LIBV4L
    WITH_TIFF
    BUILD_OPENEXR
    WITH_OPENEXR
    WITH_OPENCL

    Configure and generate.

    lmk@lmk-virtual-machine:/home/newdisk/opencv-3.1.0/BuildOpencv$ sudo vi CMakeCache.txt
    #CMakeCache.txt
    //Flags used by the linker.
    CMAKE_EXE_LINKER_FLAGS:STRING=-lpthread -lrt

    lmk@lmk-virtual-machine:/home/newdisk/opencv-3.1.0/BuildOpencv$ sudo make

    Fianlly,I got these errors :

    [ 27%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_mjpeg_decoder.cpp.o
    [ 27%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_v4l.cpp.o
    [ 27%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_ffmpeg.cpp.o
    In file included from /home/newdisk/opencv-3.1.0/modules/videoio/src/cap_ffmpeg_impl.hpp:65:0,
                from /home/newdisk/opencv-3.1.0/modules/videoio/src/cap_ffmpeg.cpp:45:
    /home/newdisk/opencv-3.1.0/modules/videoio/src/ffmpeg_codecs.hpp:77:36: fatal error: libavformat/avformat.h: No such file or directory
    compilation terminated.
    make[2]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_ffmpeg.cpp.o] Error 1
    make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
    make: *** [all] Error 2

    While the file libavformat/avformat.h does exits in my directory
    /home/newdisk/optnew/opencv-rely/include

    Why can cmake find lib directory

    -- Found ZLIB: /home/newdisk/optnew/opencv-rely/lib/libz.so (found suitable version "1.2.8", minimum required is "1.2.3")

    but cannot find include directory ?

    /home/newdisk/optnew/opencv-rely/include

    Do you have any idea ?