Recherche avancée

Médias (9)

Mot : - Tags -/soundtrack

Autres articles (112)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

Sur d’autres sites (10714)

  • How to comvert MOV to MP4 with metadata [closed]

    11 janvier 2020, par Nadav Rosenberg

    I’m trying to convert mov videos from iphone to mp4 videos but I want to save the metadata.
    I had tried some options but ffmpeg for android seems the best.

    Does any one have some kind of a template that I can just implement it ?
    I don’t have a clue how to write in ffmpeg ..

    [screenshot from the app][1]

    [another screenshot from the app][2]

    log (the input is different then in the screenshot) :

    ffmpeg -y -i "/storage/9C33-6BBD/DCIM/עינב/IMG_5267.MOV" -c:v libx265 -q:v 5 -c:a aac -ab 128k -ar 44100 "/storage/emulated/0/FFMPEG/IMG_5267.mp4"

    ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
     built with gcc 4.9.x (GCC) 20150123 (prerelease)
     configuration: --enable-version3 --enable-gpl --enable-nonfree --disable-indev=v4l2 --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libvpx --enable-libvorbis --enable-libtheora --enable-libopus --enable-libfdk-aac --enable-libfreetype --enable-libass --enable-libfribidi --enable-fontconfig --enable-pthreads --enable-libxvid --enable-filters --enable-openssl --enable-librtmp --disable-protocol='udp,udplite' --enable-libopencore-amrwb --enable-libopencore-amrnb --enable-libvo-amrwbenc --enable-libspeex --enable-libsoxr --enable-libwavpack --enable-libwebp --enable-libxml2 --enable-libopenh264 --enable-mediacodec --enable-jni --prefix=/home/silentlexx/AndroidstudioProjects/ffmpeg/ffmpeg/build/arm64-api21-r13b --sysroot=/home/silentlexx/Android/android-ndk-r13b/platforms/android-21/arch-arm64 --arch=arm64 --disable-shared --enable-static --enable-pic --enable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffnvcodec --disable-avdevice --disable-debug --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-symver --cross-prefix=/home/silentlexx/Android/android-ndk-r13b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android- --target-os=android --enable-cross-compile --pkg-config-flags=--static --extra-libs='-lgnustl_static -lm -lpng -l:libz.so -lpthread' --enable-asm --enable-neon --enable-libxavs2 --disable-runtime-cpudetect --enable-small
     libavutil      56. 31.100 / 56. 31.100
     libavcodec     58. 54.100 / 58. 54.100
     libavformat    58. 29.100 / 58. 29.100
     libavfilter     7. 57.100 /  7. 57.100
     libswscale      5.  5.100 /  5.  5.100
     libswresample   3.  5.100 /  3.  5.100
     libpostproc    55.  5.100 / 55.  5.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/9C33-6BBD/DCIM/עינב/IMG_5267.MOV':
     Metadata:
       major_brand     : qt  
       minor_version   : 0
       compatible_brands: qt  
       creation_time   : 2020-01-04T10:43:12.000000Z
       com.apple.quicktime.make: Apple
       com.apple.quicktime.model: iPhone 8 Plus
       com.apple.quicktime.software: 12.4.1
       com.apple.quicktime.creationdate: 2020-01-03T22:09:55+0200
       com.apple.photos.originating.signature: AXIrrckzUSuTNLamJ909jOgUZ8Mr
     Duration: 00:00:17.40, start: 0.000000, bitrate: 17343 kb/s
       Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 16511 kb/s, 30.01 fps, 30 tbr, 600 tbn, 1200 tbc (default)
       Metadata:
         creation_time   : 2020-01-04T10:43:12.000000Z
         handler_name    : Core Media Video
         encoder         : H.264
       Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 101 kb/s (default)
       Metadata:
         creation_time   : 2020-01-04T10:43:12.000000Z
         handler_name    : Core Media Audio
       Stream #0:2(und): Data: none (mebx / 0x7862656D), 33 kb/s (default)
       Metadata:
         creation_time   : 2020-01-04T10:43:12.000000Z
         handler_name    : Core Media Metadata
       Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
       Metadata:
         creation_time   : 2020-01-04T10:43:12.000000Z
         handler_name    : Core Media Metadata
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
     Stream #0:1 -> #0:1 (aac (native) -> aac (native))
    Press [q] to stop, [?] for help
    x265 [info]: HEVC encoder version 3.1de920e0a3183
    x265 [info]: build info [Linux][GCC 4.9.0][32 bit][noasm] 8bit
    x265 [info]: using cpu capabilities: none!
    x265 [info]: Main profile, Level-4 (Main tier)
    x265 [info]: Thread pool created using 8 threads
    x265 [info]: Slices                              : 1
    x265 [info]: frame threads / pool features       : 3 / wpp(17 rows)
    x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
    x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
    x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
    x265 [info]: Keyframe min / max / scenecut / bias: 25 / 250 / 40 / 5.00
    x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
    x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
    x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
    x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
    x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60
    x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip signhide tmvp b-intra
    x265 [info]: tools: strong-intra-smoothing lslices=6 deblock sao
    Output #0, mp4, to '/storage/emulated/0/FFMPEG/IMG_5267.mp4':
     Metadata:
       major_brand     : qt  
       minor_version   : 0
       compatible_brands: qt  
       com.apple.photos.originating.signature: AXIrrckzUSuTNLamJ909jOgUZ8Mr
       com.apple.quicktime.make: Apple
       com.apple.quicktime.model: iPhone 8 Plus
       com.apple.quicktime.software: 12.4.1
       com.apple.quicktime.creationdate: 2020-01-03T22:09:55+0200
       encoder         : Lavf58.29.100
       Stream #0:0(und): Video: hevc (libx265) (hev1 / 0x31766568), yuv420p, 1920x1080, q=2-31, 30 fps, 15360 tbn, 30 tbc (default)
       Metadata:
         creation_time   : 2020-01-04T10:43:12.000000Z
         handler_name    : Core Media Video
         encoder         : Lavc58.54.100 libx265
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
       Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 128 kb/s (default)
       Metadata:
         creation_time   : 2020-01-04T10:43:12.000000Z
         handler_name    : Core Media Audio
         encoder         : Lavc58.54.100 aac
    frame=   27 fps= 13 q=0.0 size=       0kB time=00:00:02.08 bitrate=   0.2kbits/s speed=1.02x    
    frame=   30 fps=9.1 q=-0.0 size=       0kB time=00:00:02.18 bitrate=   0.2kbits/s speed=0.665x    
    frame=   31 fps=8.1 q=-0.0 size=       0kB time=00:00:02.22 bitrate=   0.2kbits/s speed=0.581x    
    frame=   32 fps=7.3 q=-0.0 size=       0kB time=00:00:02.25 bitrate=   0.2kbits/s speed=0.511x    
    frame=   33 fps=5.9 q=-0.0 size=       0kB time=00:00:02.29 bitrate=   0.2kbits/s speed=0.409x    
    frame=   36 fps=5.4 q=-0.0 size=       0kB time=00:00:02.39 bitrate=   0.1kbits/s speed=0.359x    
    frame=   37 fps=5.0 q=-0.0 size=       0kB time=00:00:02.41 bitrate=   0.1kbits/s speed=0.324x    
    frame=   40 fps=4.5 q=-0.0 size=       0kB time=00:00:02.53 bitrate=   0.1kbits/s speed=0.287x    
    frame=   43 fps=4.3 q=-0.0 size=       0kB time=00:00:02.62 bitrate=   0.1kbits/s speed=0.265x    
    frame=   44 fps=4.1 q=-0.0 size=       0kB time=00:00:02.64 bitrate=   0.1kbits/s speed=0.248x    
    frame=   45 fps=3.9 q=-0.0 size=       0kB time=00:00:02.69 bitrate=   0.1kbits/s speed=0.231x    
    frame=   48 fps=3.7 q=-0.0 size=       0kB time=00:00:02.78 bitrate=   0.1kbits/s speed=0.217x    
    frame=   50 fps=3.7 q=-0.0 size=       0kB time=00:00:02.85 bitrate=   0.1kbits/s speed=0.214x    
    frame=   51 fps=3.4 q=-0.0 size=       0kB time=00:00:02.87 bitrate=   0.1kbits/s speed=0.195x    
    frame=   54 fps=3.2 q=-0.0 size=     256kB time=00:00:02.99 bitrate= 700.2kbits/s speed=0.18x    
    frame=   57 fps=3.2 q=-0.0 size=     256kB time=00:00:03.08 bitrate= 679.2kbits/s speed=0.174x    
    frame=   58 fps=3.1 q=-0.0 size=     256kB time=00:00:03.11 bitrate= 674.1kbits/s speed=0.169x    
    frame=   59 fps=3.1 q=-0.0 size=     256kB time=00:00:03.15 bitrate= 664.2kbits/s speed=0.165x    
    frame=   61 fps=3.0 q=-0.0 size=     256kB time=00:00:03.22 bitrate= 649.9kbits/s speed=0.161x    
    frame=   62 fps=3.0 q=-0.0 size=     256kB time=00:00:03.25 bitrate= 645.2kbits/s speed=0.157x    
    frame=   63 fps=2.9 q=-0.0 size=     256kB time=00:00:03.29 bitrate= 636.1kbits/s speed=0.152x    
    frame=   65 fps=2.9 q=-0.0 size=     256kB time=00:00:03.34 bitrate= 627.3kbits/s speed=0.149x    
    frame=   66 fps=2.9 q=-0.0 size=     256kB time=00:00:03.39 bitrate= 618.7kbits/s speed=0.147x    
    frame=   68 fps=2.9 q=-0.0 size=     256kB time=00:00:03.45 bitrate= 606.3kbits/s speed=0.146x    
    frame=   69 fps=2.8 q=-0.0 size=     256kB time=00:00:03.48 bitrate= 602.2kbits/s speed=0.142x    
    frame=   70 fps=2.8 q=-0.0 size=     256kB time=00:00:03.52 bitrate= 594.3kbits/s speed=0.14x    
    frame=   72 fps=2.8 q=-0.0 size=     256kB time=00:00:03.59 bitrate= 582.8kbits/s speed=0.14x    
    frame=   73 fps=2.8 q=-0.0 size=     256kB time=00:00:03.62 bitrate= 579.1kbits/s speed=0.136x    
    frame=   74 fps=2.7 q=-0.0 size=     256kB time=00:00:03.64 bitrate= 575.4kbits/s speed=0.134x    
    frame=   76 fps=2.7 q=-0.0 size=     256kB time=00:00:03.71 bitrate= 564.6kbits/s speed=0.132x    
    frame=   77 fps=2.7 q=-0.0 size=     256kB time=00:00:03.76 bitrate= 557.6kbits/s speed=0.13x    
    frame=   79 fps=2.7 q=-0.0 size=     256kB time=00:00:03.83 bitrate= 547.5kbits/s speed=0.131x    
    frame=   80 fps=2.7 q=-0.0 size=     512kB time=00:00:03.85 bitrate=1088.2kbits/s speed=0.129x    
    frame=   82 fps=2.6 q=-0.0 size=     512kB time=00:00:03.92 bitrate=1068.9kbits/s speed=0.127x    
    frame=   83 fps=2.6 q=-0.0 size=     512kB time=00:00:03.94 bitrate=1062.6kbits/s speed=0.125x    
    frame=   84 fps=2.6 q=-0.0 size=     512kB time=00:00:03.99 bitrate=1050.3kbits/s speed=0.124x    
    frame=   87 fps=2.6 q=-0.0 size=     512kB time=00:00:04.08 bitrate=1026.4kbits/s speed=0.122x    
    frame=   89 fps=2.6 q=-0.0 size=     512kB time=00:00:04.15 bitrate=1009.2kbits/s speed=0.12x    
    frame=   90 fps=2.6 q=-0.0 size=     512kB time=00:00:04.17 bitrate=1003.6kbits/s speed=0.119x    
    frame=   92 fps=2.6 q=-0.0 size=     512kB time=00:00:04.24 bitrate= 987.2kbits/s speed=0.119x    
    frame=   93 fps=2.5 q=-0.0 size=     512kB time=00:00:04.29 bitrate= 976.5kbits/s speed=0.118x    
    frame=   94 fps=2.5 q=-0.0 size=     512kB time=00:00:04.31 bitrate= 971.2kbits/s speed=0.116x    
    frame=   96 fps=2.5 q=-0.0 size=     512kB time=00:00:04.38 bitrate= 955.8kbits/s speed=0.116x    
    frame=   97 fps=2.5 q=-0.0 size=     512kB time=00:00:04.41 bitrate= 950.8kbits/s speed=0.115x    
    frame=  100 fps=2.5 q=-0.0 size=     512kB time=00:00:04.52 bitrate= 926.4kbits/s speed=0.113x    
    frame=  101 fps=2.5 q=-0.0 size=     512kB time=00:00:04.55 bitrate= 921.7kbits/s speed=0.111x    
    frame=  103 fps=2.5 q=-0.0 size=     512kB time=00:00:04.62 bitrate= 907.8kbits/s speed=0.112x    
    frame=  104 fps=2.5 q=-0.0 size=     512kB time=00:00:04.64 bitrate= 903.2kbits/s speed=0.11x    
    frame=  105 fps=2.5 q=-0.0 size=     512kB time=00:00:04.69 bitrate= 894.3kbits/s speed=0.11x    
    frame=  106 fps=2.4 q=-0.0 size=     512kB time=00:00:04.71 bitrate= 889.9kbits/s speed=0.109x    
    frame=  107 fps=2.4 q=-0.0 size=     512kB time=00:00:04.76 bitrate= 881.2kbits/s speed=0.108x    
    frame=  108 fps=2.4 q=-0.0 size=     512kB time=00:00:04.78 bitrate= 876.9kbits/s speed=0.105x    
    frame=  111 fps=2.4 q=-0.0 size=     768kB time=00:00:04.89 bitrate=1284.2kbits/s speed=0.105x    
    frame=  112 fps=2.4 q=-0.0 size=     768kB time=00:00:04.92 bitrate=1278.1kbits/s speed=0.104x    
    frame=  115 fps=2.4 q=-0.0 size=     768kB time=00:00:05.01 bitrate=1254.5kbits/s speed=0.103x    
    frame=  116 fps=2.4 q=-0.0 size=     768kB time=00:00:05.06 bitrate=1243.0kbits/s speed=0.103x    
    frame=  119 fps=2.4 q=-0.0 size=     768kB time=00:00:05.15 bitrate=1220.6kbits/s speed=0.102x    
    frame=  120 fps=2.3 q=-0.0 size=     768kB time=00:00:05.17 bitrate=1215.1kbits/s speed=0.101x    
    frame=  121 fps=2.3 q=-0.0 size=     768kB time=00:00:05.22 bitrate=1204.3kbits/s speed=0.0998x    
    frame=  124 fps=2.3 q=-0.0 size=     768kB time=00:00:05.31 bitrate=1183.3kbits/s speed= 0.1x    
    frame=  126 fps=2.3 q=-0.0 size=     768kB time=00:00:05.38 bitrate=1168.0kbits/s speed=0.0983x    
    frame=  129 fps=2.3 q=-0.0 size=     768kB time=00:00:05.47 bitrate=1148.2kbits/s speed=0.0985x    
    frame=  130 fps=2.3 q=-0.0 size=     768kB time=00:00:05.52 bitrate=1138.5kbits/s speed=0.0984x    
    frame=  131 fps=2.3 q=-0.0 size=     768kB time=00:00:05.54 bitrate=1133.7kbits/s speed=0.0975x    
    frame=  134 fps=2.3 q=-0.0 size=     768kB time=00:00:05.64 bitrate=1115.1kbits/s speed=0.0976x    
    frame=  136 fps=2.3 q=-0.0 size=     768kB time=00:00:05.71 bitrate=1101.5kbits/s speed=0.0976x    
    frame=  138 fps=2.3 q=-0.0 size=     768kB time=00:00:05.78 bitrate=1088.2kbits/s speed=0.0977x    
    frame=  139 fps=2.3 q=-0.0 size=     768kB time=00:00:05.82 bitrate=1079.5kbits/s speed=0.0974x    
    frame=  142 fps=2.3 q=-0.0 size=     768kB time=00:00:05.92 bitrate=1062.6kbits/s speed=0.0972x    
    frame=  144 fps=2.3 q=-0.0 size=     768kB time=00:00:05.99 bitrate=1050.3kbits/s speed=0.0969x    
    frame=  147 fps=2.3 q=-0.0 size=     768kB time=00:00:06.08 bitrate=1034.2kbits/s speed=0.0964x    
    frame=  148 fps=2.3 q=-0.0 size=     768kB time=00:00:06.13 bitrate=1026.4kbits/s speed=0.0963x    
    frame=  150 fps=2.3 q=-0.0 size=     768kB time=00:00:06.17 bitrate=1018.7kbits/s speed=0.0956x    
    frame=  153 fps=2.3 q=-0.0 size=    1024kB time=00:00:06.26 bitrate=1338.1kbits/s speed=0.0963x    
    frame=  153 fps=2.3 q=-0.0 size=    1024kB time=00:00:06.29 bitrate=1333.1kbits/s speed=0.0959x    
    frame=  154 fps=2.3 q=-0.0 size=    1024kB time=00:00:06.31 bitrate=1328.2kbits/s speed=0.0955x    
    frame=  157 fps=2.3 q=-0.0 size=    1024kB time=00:00:06.40 bitrate=1309.0kbits/s speed=0.0953x    
    frame=  158 fps=2.3 q=-0.0 size=    1024kB time=00:00:06.45 bitrate=1299.6kbits/s speed=0.0951x    
    frame=  161 fps=2.3 q=-0.0 size=    1024kB time=00:00:06.54 bitrate=1281.1kbits/s speed=0.0951x    
    frame=  163 fps=2.3 q=-0.0 size=    1024kB time=00:00:06.61 bitrate=1267.7kbits/s speed=0.0954x    
    frame=  165 fps=2.3 q=-0.0 size=    1024kB time=00:00:06.68 bitrate=1254.5kbits/s speed=0.0952x    
    frame=  166 fps=2.3 q=-0.0 size=    1024kB time=00:00:06.71 bitrate=1250.1kbits/s speed=0.0948x    
    frame=  169 fps=2.3 q=-0.0 size=    1024kB time=00:00:06.82 bitrate=1228.9kbits/s speed=0.0945x    
    frame=  171 fps=2.3 q=-0.0 size=    1024kB time=00:00:06.89 bitrate=1216.4kbits/s speed=0.0943x    
    frame=  174 fps=2.3 q=-0.0 size=    1024kB time=00:00:06.98 bitrate=1200.3kbits/s speed=0.0941x    
    frame=  175 fps=2.3 q=-0.0 size=    1024kB time=00:00:07.01 bitrate=1196.3kbits/s speed=0.0937x    
    frame=  178 fps=2.3 q=-0.0 size=    1024kB time=00:00:07.12 bitrate=1176.8kbits/s speed=0.0936x    
    frame=  179 fps=2.3 q=-0.0 size=    1024kB time=00:00:07.15 bitrate=1173.0kbits/s speed=0.0931x    
    frame=  180 fps=2.3 q=-0.0 size=    1024kB time=00:00:07.19 bitrate=1165.4kbits/s speed=0.0927x    
    frame=  183 fps=2.3 q=-0.0 size=    1024kB time=00:00:07.29 bitrate=1150.6kbits/s speed=0.0926x    
    frame=  186 fps=2.3 q=-0.0 size=    1024kB time=00:00:07.38 bitrate=1136.1kbits/s speed=0.0925x    
    frame=  187 fps=2.3 q=-0.0 size=    1024kB time=00:00:07.43 bitrate=1129.0kbits/s speed=0.0924x    
    frame=  189 fps=2.3 q=-0.0 size=    1024kB time=00:00:07.47 bitrate=1122.0kbits/s speed=0.0923x    
    frame=  190 fps=2.3 q=-0.0 size=    1024kB time=00:00:07.52 bitrate=1115.1kbits/s speed=0.0919x    
    frame=  191 fps=2.3 q=-0.0 size=    1280kB time=00:00:07.54 bitrate=1389.5kbits/s speed=0.0914x    
    frame=  192 fps=2.3 q=-0.0 size=    1280kB time=00:00:07.59 bitrate=1381.0kbits/s speed=0.0909x    
    frame=  194 fps=2.3 q=-0.0 size=    1280kB time=00:00:07.66 bitrate=1368.5kbits/s speed=0.0912x    
    frame=  196 fps=2.3 q=-0.0 size=    1280kB time=00:00:07.70 bitrate=1360.2kbits/s speed=0.0905x    
    frame=  198 fps=2.3 q=-0.0 size=    1280kB time=00:00:07.77 bitrate=1348.1kbits/s speed=0.09x    
    frame=  200 fps=2.3 q=-0.0 size=    1280kB time=00:00:07.84 bitrate=1336.1kbits/s speed=0.0902x    
    frame=  201 fps=2.3 q=-0.0 size=    1280kB time=00:00:07.89 bitrate=1328.2kbits/s speed=0.0896x    
    frame=  202 fps=2.3 q=-0.0 size=    1280kB time=00:00:07.91 bitrate=1324.3kbits/s speed=0.0892x    
    frame=  205 fps=2.3 q=-0.0 size=    1280kB time=00:00:08.01 bitrate=1309.0kbits/s speed=0.0888x    
    frame=  206 fps=2.3 q=-0.0 size=    1280kB time=00:00:08.05 bitrate=1301.4kbits/s speed=0.0886x    
    frame=  207 fps=2.3 q=-0.0 size=    1280kB time=00:00:08.08 bitrate=1297.7kbits/s speed=0.0883x    
    frame=  209 fps=2.3 q=-0.0 size=    1280kB time=00:00:08.15 bitrate=1286.6kbits/s speed=0.0882x    
    frame=  210 fps=2.3 q=-0.0 size=    1280kB time=00:00:08.19 bitrate=1279.3kbits/s speed=0.0879x    
    frame=  213 fps=2.2 q=-0.0 size=    1280kB time=00:00:08.28 bitrate=1265.0kbits/s speed=0.0873x    
    frame=  214 fps=2.2 q=-0.0 size=    1280kB time=00:00:08.31 bitrate=1261.5kbits/s speed=0.087x    
    frame=  216 fps=2.2 q=-0.0 size=    1280kB time=00:00:08.38 bitrate=1251.0kbits/s speed=0.087x    
    frame=  217 fps=2.2 q=-0.0 size=    1280kB time=00:00:08.42 bitrate=1244.1kbits/s speed=0.0868x    
    frame=  218 fps=2.2 q=-0.0 size=    1280kB time=00:00:08.45 bitrate=1240.7kbits/s speed=0.0864x    
    frame=  219 fps=2.2 q=-0.0 size=    1280kB time=00:00:08.47 bitrate=1237.3kbits/s speed=0.0857x    
    frame=  221 fps=2.2 q=-0.0 size=    1536kB time=00:00:08.54 bitrate=1472.6kbits/s speed=0.0859x    
    frame=  222 fps=2.2 q=-0.0 size=    1536kB time=00:00:08.59 bitrate=1464.6kbits/s speed=0.0859x    
    frame=  223 fps=2.2 q=-0.0 size=    1536kB time=00:00:08.61 bitrate=1460.7kbits/s speed=0.0854x    
    frame=  225 fps=2.2 q=-0.0 size=    1536kB time=00:00:08.68 bitrate=1449.0kbits/s speed=0.085x    
    frame=  227 fps=2.2 q=-0.0 size=    1536kB time=00:00:08.75 bitrate=1437.4kbits/s speed=0.0853x    
    frame=  228 fps=2.2 q=-0.0 size=    1536kB time=00:00:08.77 bitrate=1433.6kbits/s speed=0.0847x    
    frame=  229 fps=2.2 q=-0.0 size=    1536kB time=00:00:08.82 bitrate=1426.1kbits/s speed=0.0845x    
    frame=  230 fps=2.2 q=-0.0 size=    1536kB time=00:00:08.84 bitrate=1422.4kbits/s speed=0.0842x    
    frame=  232 fps=2.2 q=-0.0 size=    1536kB time=00:00:08.91 bitrate=1411.2kbits/s speed=0.0838x    
    frame=  233 fps=2.2 q=-0.0 size=    1536kB time=00:00:08.96 bitrate=1403.9kbits/s speed=0.0834x    
    frame=  234 fps=2.2 q=-0.0 size=    1536kB time=00:00:08.98 bitrate=1400.3kbits/s speed=0.083x    
    frame=  236 fps=2.2 q=-0.0 size=    1536kB time=00:00:09.05 bitrate=1389.5kbits/s speed=0.0832x    
    frame=  237 fps=2.2 q=-0.0 size=    1536kB time=00:00:09.07 bitrate=1386.0kbits/s speed=0.083x    
    frame=  240 fps=2.2 q=-0.0 size=    1536kB time=00:00:09.19 bitrate=1368.5kbits/s speed=0.083x    
    frame=  241 fps=2.2 q=-0.0 size=    1536kB time=00:00:09.21 bitrate=1365.0kbits/s speed=0.0827x    
    frame=  242 fps=2.2 q=-0.0 size=    1536kB time=00:00:09.26 bitrate=1358.2kbits/s speed=0.0826x    
    frame=  244 fps=2.2 q=-0.0 size=    1536kB time=00:00:09.31 bitrate=1351.4kbits/s speed=0.0825x    
    frame=  245 fps=2.2 q=-0.0 size=    1536kB time=00:00:09.35 bitrate=1344.7kbits/s speed=0.0825x    
    frame=  247 fps=2.2 q=-0.0 size=    1536kB time=00:00:09.42 bitrate=1334.8kbits/s speed=0.0825x    
    frame=  248 fps=2.2 q=-0.0 size=    1536kB time=00:00:09.45 bitrate=1331.5kbits/s speed=0.0823x    
    frame=  249 fps=2.2 q=-0.0 size=    1536kB time=00:00:09.49 bitrate=1325.0kbits/s speed=0.0823x    
    frame=  252 fps=2.2 q=-0.0 size=    1792kB time=00:00:09.58 bitrate=1530.8kbits/s speed=0.0823x    
    frame=  253 fps=2.2 q=-0.0 size=    1792kB time=00:00:09.61 bitrate=1527.1kbits/s speed=0.082x    
    frame=  256 fps=2.2 q=-0.0 size=    1792kB time=00:00:09.72 bitrate=1508.9kbits/s speed=0.0822x    
    frame=  257 fps=2.2 q=-0.0 size=    1792kB time=00:00:09.75 bitrate=1505.3kbits/s speed=0.0819x    
    frame=  258 fps=2.2 q=-0.0 size=    1792kB time=00:00:09.77 bitrate=1501.7kbits/s speed=0.0818x    
    frame=  260 fps=2.2 q=-0.0 size=    1792kB time=00:00:09.84 bitrate=1491.1kbits/s speed=0.0819x    
    frame=  261 fps=2.2 q=-0.0 size=    1792kB time=00:00:09.89 bitrate=1484.1kbits/s speed=0.0818x    
    frame=  263 fps=2.2 q=-0.0 size=    1792kB time=00:00:09.96 bitrate=1473.7kbits/s speed=0.0819x    
    frame=  265 fps=2.2 q=-0.0 size=    1792kB time=00:00:10.03 bitrate=1463.5kbits/s speed=0.082x    
    frame=  266 fps=2.2 q=-0.0 size=    1792kB time=00:00:1
  • Improve ffmpeg x11grab screen capture performance

    10 janvier 2020, par Toby Eggitt

    I have been doing screen-only (no sound) capture using ffmpeg with libx264 for the encoding quite successfully on an old machine built around a Core2 Quad Q6600 processor. I now need to include audio in this, but the fans on this ancient machine are too loud. So, I found a fanless motherboard (https://www.asrock.com/mb/Intel/J5005-ITX/index.asp) that has an Intel Pentium Silver J5005 processor and decided to use this instead. The CPU’s benchmarks put it in a similar bracket to the Q6600, and the general performance seems to be significantly better, presumably at least in part because it’s now using DDR4 memory that’s faster access.

    However, the machine fails horribly at the screen capture. It’s missing frames all over the place ; I actually end up with video that’s missing almost half the frames, and plays back at about double speed. Also, any audio is just messed up so badly I can hardly think how to describe it, best I can come up with is that I get perhaps a quarter second of sound then a few seconds pause (the video meanwhile is actually still playing back, albeit with no sense of time).

    Some things occur to me that might be the cause, or cure, of my troubles, some of which I might be able to fix, others not so much. What other things should I try ? (I’d prefer to avoid simply throwing money at the issue with random ideas that are baseless !)

    1) perhaps the CPU lacks some "extensions" to the instruction set (I recall years ago some CPUs gaining MMX extensions") so that the CPU is fast at mundane computing but sucks at video encoding.

    2) perhaps the fact that the old machine had a dedicated graphics card, while this new one is sharing main memory with the graphics system means that reading the screen pixels is much slower.

    3) perhaps the fact that this new machine has a single DDR4 memory stick in it means that I’m forcing all the memory reads and writes for the computations through the same memory as is holding the screen, and that’s too much (implying that adding an additional memory stick might jus possibly help ?)

    4) perhaps there’s some bios setting that would allow more efficient sharing of video memory ?

    5) my favorite, perhaps there’s a better compression library that I could use to get decent quality screen capture with much less CPU usage.

    I should also note that I have tried this with -threads 0, and the CPU usage hovers between 100% and 200% ; around 100% when the screen is static, and rising as I move windows around and otherwise create more output.

    6) the motherboard claims to have some kind of hardware video encoder built into it. I haven’t paid this any attention to this point, as I assumed it was for the purpose of taking HDMI input and encoding it, but maybe there’s a way to use this, if so, what libraries might I need to get ffmpeg to do this.

    Edits :

    • This is an off the shelf ffmpeg. I’m certainly willing to try building it myself if I have some idea what I should do different.
    • The motherboard claims to have hardware encoders, but I’m struggling to find out what they are (seems like it’s an Intel chip called "UHD Graphics 605" but nothing I can find suggests ffmpeg can work with that)
    • command line right now has been (without audio) :

      ffmpeg  -video_size 1280x720   -f x11grab  -i ${DISPLAY}+100,100  -vcodec libx264  -f alsa -i pulse -acodec ac3 -threads 0  ./video$(date +%F-%H-%M-%S).mp4

    Log from a short recording session is :

    ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
     built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
     configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
     libavutil      55. 78.100 / 55. 78.100
     libavcodec     57.107.100 / 57.107.100
     libavformat    57. 83.100 / 57. 83.100
     libavdevice    57. 10.100 / 57. 10.100
     libavfilter     6.107.100 /  6.107.100
     libavresample   3.  7.  0 /  3.  7.  0
     libswscale      4.  8.100 /  4.  8.100
     libswresample   2.  9.100 /  2.  9.100
     libpostproc    54.  7.100 / 54.  7.100
    [x11grab @ 0x561a723e5ac0] Stream #0: not enough frames to estimate rate; consider increasing probesize
    Input #0, x11grab, from ':0+100,100':
     Duration: N/A, start: 1578693116.465807, bitrate: N/A
       Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1280x720, 29.97 fps, 1000k tbr, 1000k tbn, 1000k tbc
    Unknown decoder 'libx264'
    simon@studio:~$ ffmpeg  -video_size 1280x720   -f x11grab  -i ${DISPLAY}+100,100  -vcodec libx264 -threads 0  ./video$(date +%F-%H-%M-%S).mp4
    ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
     built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
     configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
     libavutil      55. 78.100 / 55. 78.100
     libavcodec     57.107.100 / 57.107.100
     libavformat    57. 83.100 / 57. 83.100
     libavdevice    57. 10.100 / 57. 10.100
     libavfilter     6.107.100 /  6.107.100
     libavresample   3.  7.  0 /  3.  7.  0
     libswscale      4.  8.100 /  4.  8.100
     libswresample   2.  9.100 /  2.  9.100
     libpostproc    54.  7.100 / 54.  7.100
    [x11grab @ 0x558225bc29a0] Stream #0: not enough frames to estimate rate; consider increasing probesize
    Input #0, x11grab, from ':0+100,100':
     Duration: N/A, start: 1578693132.513351, bitrate: N/A
       Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1280x720, 29.97 fps, 1000k tbr, 1000k tbn, 1000k tbc
    Stream mapping:
     Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    [libx264 @ 0x558225bcd360] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
    [libx264 @ 0x558225bcd360] profile High 4:4:4 Predictive, level 3.1, 4:4:4 8-bit
    [libx264 @ 0x558225bcd360] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=6 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=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to './video2020-01-10-14-52-12.mp4':
     Metadata:
       encoder         : Lavf57.83.100
       Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p, 1280x720, q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc
       Metadata:
         encoder         : Lavc57.107.100 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Past duration 0.806847 too large     256kB time=00:00:00.43 bitrate=4835.3kbits/s dup=16 drop=0 speed=0.207x    
    frame=  371 fps= 29 q=-1.0 Lsize=     639kB time=00:00:12.27 bitrate= 426.6kbits/s dup=16 drop=14 speed=0.971x    
    video:634kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.813096%
    [libx264 @ 0x558225bcd360] frame I:2     Avg QP:18.16  size:221502
    [libx264 @ 0x558225bcd360] frame P:93    Avg QP:14.97  size:  2007
    [libx264 @ 0x558225bcd360] frame B:276   Avg QP:20.13  size:    69
    [libx264 @ 0x558225bcd360] consecutive B-frames:  0.8%  0.0%  0.0% 99.2%
    [libx264 @ 0x558225bcd360] mb I  I16..4: 44.6%  0.0% 55.4%
    [libx264 @ 0x558225bcd360] mb P  I16..4:  0.2%  0.0%  0.3%  P16..4:  0.7%  0.1%  0.1%  0.0%  0.0%    skip:98.5%
    [libx264 @ 0x558225bcd360] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  1.0%  0.0%  0.0%  direct: 0.0%  skip:99.0%  L0:50.9% L1:49.0% BI: 0.1%
    [libx264 @ 0x558225bcd360] coded y,u,v intra: 41.3% 37.5% 37.4% inter: 0.1% 0.0% 0.0%
    [libx264 @ 0x558225bcd360] i16 v,h,dc,p: 58% 41%  1%  0%
    [libx264 @ 0x558225bcd360] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 30% 14%  2%  4%  4%  5%  3%  5%
    [libx264 @ 0x558225bcd360] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 0x558225bcd360] ref P L0: 59.2%  8.8% 25.5%  6.5%
    [libx264 @ 0x558225bcd360] ref B L0: 59.4% 39.0%  1.6%
    [libx264 @ 0x558225bcd360] ref B L1: 96.5%  3.5%
    [libx264 @ 0x558225bcd360] kb/s:419.29
    Exiting normally, received signal 2.
  • Matomo analytics for wordpress

    15 octobre 2019, par Matomo Core Team — Community

    Self-hosting web analytics got a whole lot easier ! Introducing Matomo for WordPress

    Be the first to try it out ! Your feedback is much needed and appreciated

    Get a fully functioning Matomo (which is comparable to Google Analytics) in seconds ! How ? With the new Matomo Analytics for WordPress plugin. 

    Web analytics in WordPress has never been easier to get, or more powerful. Matomo Analytics for WordPress is the one-stop problem solver. It’ll save you time, money and give you the insights to help your website or business succeed. 

    Best of all, we get to further the goal of decentralising the internet. Our hope is for Matomo Analytics for WordPress to spread far and wide. We’re so excited that more and more people can now get their hands on this powerful, free, open-source analytics platform, in a few clicks !

    Download now and check it out !

    What do you get ?

    • No more signing up to third party analytics service (like Google)
    • No more sending away your valuable data to a third party service (like Google)
    • Easy setup – install with a few clicks, no tracking code installation or developer knowledge needed
    • 100% accurate data – no data sampling and no data limits 
    • Full data ownership – all data is stored on your servers and no one else can see your data
    • Privacy protection / GDPR compliance
    • Ecommerce tracking out-of-the-box (Woocommerce, Easy Digital Downloads, and MemberPress) and we’re keen to add many more over time
    • Powerful features – segmenting, comparing reports, different visualisations, real-time reports, visit logs and visitor profiles, Matomo Tag Manager, dashboards, data export, APIs, and many more
    • Compared to other WordPress solutions we don’t charge you extra for basic features that should work out-of-the-box
    • Just like Matomo On-Premise, Matomo Analytics for WordPress is free

    We need your feedback !

    We all know and love the versatility of WordPress – with over 55,000 plugins and all the different ways of hosting it. However, with this great versatility comes the potential for things to be missed, so we’re keen to hear your feedback.

    Thank you ! We really appreciate your help on this ❤️

    How do you get Matomo Analytics for WordPress ?

    Log in to your WordPress and go to “Plugins => Add New”, search for “Matomo Analytics – Ethical Stats. Powerful Insights”, click on “Install” and then “Activate”.

    All you need is at least WordPress 4.8 and PHP 7.0 or later. MySQL 5.1+ is recommended. 

    The source code is available at : https://github.com/matomo-org/wp-matomo/

    In perfect harmony : Matomo and WordPress

    Matomo Analytics for WordPress

    The idea for this started two years ago when we realised the similarities between the Matomo and WordPress project. 

    Not only from a technological point of view – where both are based on PHP and MySQL and can be extended using plugins – but also from a philosophical, license and values point of view. We both believe in privacy, security, data ownership, openness, transparency, having things working out-of-the-box, simplicity etc. 

    WordPress is currently used on approximately 30% of all websites. Many of them use the self-hosted open-source WordPress version. Giving everyone in this market the opportunity to easily get a powerful web analytics platform for free, means a lot to us. We believe WordPress users get a real choice besides the standard solution of Google Analytics, and it furthers our effort and goal of decentralising the internet. 

    We’re hoping more people will be empowered to protect user privacy, have access to a great free and open-source tool, and keep control of data in their own hands.

    We hope you feel the same. Help us spread the word to your friends and get them in on this awesome new project !

    Share on facebook
    Share on twitter
    Share on linkedin

    FAQs

    Isn’t there already a WP-Matomo plugin for WordPress available ?

    Yes, the existing WP-Matomo (WP-Piwik) plugin is an awesome plugin to connect your existing Matomo On-Premise or Matomo Cloud account with WordPress. The difference is that this new plugin installs Matomo Analytics fully in your WordPress. So you get the convenience of having a powerful analytics platform within your WordPress.

    We highly recommend you install this new plugin if you use WordPress and are not running Matomo yet. 

    If you are already using Matomo on our Cloud or On-Premise, we’d still highly recommend you use WP-Matomo (WP-Piwik). So that you get an easier way of inserting the tracking code into your WordPress site and get insights faster.

    I have a high traffic website, will it be an issue ?

    If you have a lot of traffic, we’d advise you to install Matomo On-Premise separately. There’s no specific traffic threshold we can give you on when it’s better to use Matomo On-Premise. It really depends on your server. 

    We reckon if you have more than 500,000 page views a month, you may want to think about using Matomo On-Premise with WP-Matomo instead, but this is just an estimate. In general, if the load on your server is already quite high, then it might be better to install Matomo on a separate server. See also recommended server sizing for running Matomo.

    How do I report a bug or request a new feature in Matomo for WordPress ?

    Please create an issue, on our repository whenever you find a bug or if you have any suggestion or ideas of improvement. We want to build an outstanding analytics experience for WordPress !

    Have another question you’re dying to ask ? The Matomo for WordPress FAQ page might have the answer you need. 

    Matomo Analytics for WordPress newsletter

    Get ahead of the crowd – signup to our exclusive Matomo for WordPress newsletter to get the latest updates on this exciting new project.

    &lt;script type=&quot;text/javascript&quot;&gt;<br />
    (function(global) {<br />
     function serialize(form){if(!form||form.nodeName!==&quot;FORM&quot;){return }var i,j,q=[];for(i=form.elements.length-1;i&gt;=0;i=i-1){if(form.elements[i].name===&quot;&quot;){continue}switch(form.elements[i].nodeName){case&quot;INPUT&quot;:switch(form.elements[i].type){case&quot;text&quot;:case&quot;hidden&quot;:case&quot;password&quot;:case&quot;button&quot;:case&quot;reset&quot;:case&quot;submit&quot;:q.push(form.elements[i].name+&quot;=&quot;+encodeURIComponent(form.elements[i].value));break;case&quot;checkbox&quot;:case&quot;radio&quot;:if(form.elements[i].checked){q.push(form.elements[i].name+&quot;=&quot;+encodeURIComponent(form.elements[i].value))}break;case&quot;file&quot;:break}break;case&quot;TEXTAREA&quot;:q.push(form.elements[i].name+&quot;=&quot;+encodeURIComponent(form.elements[i].value));break;case&quot;SELECT&quot;:switch(form.elements[i].type){case&quot;select-one&quot;:q.push(form.elements[i].name+&quot;=&quot;+encodeURIComponent(form.elements[i].value));break;case&quot;select-multiple&quot;:for(j=form.elements[i].options.length-1;j&gt;=0;j=j-1){if(form.elements[i].options[j].selected){q.push(form.elements[i].name+&quot;=&quot;+encodeURIComponent(form.elements[i].options[j].value))}}break}break;case&quot;BUTTON&quot;:switch(form.elements[i].type){case&quot;reset&quot;:case&quot;submit&quot;:case&quot;button&quot;:q.push(form.elements[i].name+&quot;=&quot;+encodeURIComponent(form.elements[i].value));break}break}}return q.join(&quot;&amp;&quot;)};<br />
    <br />
    <br />
     function extend(destination, source) {<br />
       for (var prop in source) {<br />
         destination[prop] = source[prop];<br />
       }<br />
     }<br />
    <br />
     if (!Mimi) var Mimi = {};<br />
     if (!Mimi.Signups) Mimi.Signups = {};<br />
    <br />
     Mimi.Signups.EmbedValidation = function() {<br />
       this.initialize();<br />
    <br />
       var _this = this;<br />
       if (document.addEventListener) {<br />
         this.form.addEventListener('submit', function(e){<br />
           _this.onFormSubmit(e);<br />
         });<br />
       } else {<br />
         this.form.attachEvent('onsubmit', function(e){<br />
           _this.onFormSubmit(e);<br />
         });<br />
       }<br />
     };<br />
    <br />
     extend(Mimi.Signups.EmbedValidation.prototype, {<br />
       initialize: function() {<br />
         this.form         = document.getElementById('ema_signup_form');<br />
         this.submit       = document.getElementById('webform_submit_button');<br />
         this.callbackName = 'jsonp_callback_' + Math.round(100000 * Math.random());<br />
         this.validEmail   = /.+@.+\..+/<br />
       },<br />
    <br />
       onFormSubmit: function(e) {<br />
         e.preventDefault();<br />
    <br />
         this.validate();<br />
         if (this.isValid) {<br />
           this.submitForm();<br />
         } else {<br />
           this.revalidateOnChange();<br />
         }<br />
       },<br />
    <br />
       validate: function() {<br />
         this.isValid = true;<br />
         this.emailValidation();<br />
         this.fieldAndListValidation();<br />
         this.updateFormAfterValidation();<br />
       },<br />
    <br />
       emailValidation: function() {<br />
         var email = document.getElementById('signup_email');<br />
    <br />
         if (this.validEmail.test(email.value)) {<br />
           this.removeTextFieldError(email);<br />
         } else {<br />
           this.textFieldError(email);<br />
           this.isValid = false;<br />
         }<br />
       },<br />
    <br />
       fieldAndListValidation: function() {<br />
         var fields = this.form.querySelectorAll('.mimi_field.required');<br />
    <br />
         for (var i = 0; i &lt; fields.length; ++i) {<br />
           var field = fields[i],<br />
               type  = this.fieldType(field);<br />
           if (type === 'checkboxes' || type === 'radio_buttons' || type === 'age_check') {<br />
             this.checkboxAndRadioValidation(field);<br />
           } else {<br />
             this.textAndDropdownValidation(field, type);<br />
           }<br />
         }<br />
       },<br />
    <br />
       fieldType: function(field) {<br />
         var type = field.querySelectorAll('.field_type');<br />
    <br />
         if (type.length) {<br />
           return type[0].getAttribute('data-field-type');<br />
         } else if (field.className.indexOf('checkgroup') &gt;= 0) {<br />
           return 'checkboxes';<br />
         } else {<br />
           return 'text_field';<br />
         }<br />
       },<br />
    <br />
       checkboxAndRadioValidation: function(field) {<br />
         var inputs   = field.getElementsByTagName('input'),<br />
             selected = false;<br />
    <br />
         for (var i = 0; i &lt; inputs.length; ++i) {<br />
           var input = inputs[i];<br />
           if((input.type === 'checkbox' || input.type === 'radio') &amp;&amp; input.checked) {<br />
             selected = true;<br />
           }<br />
         }<br />
    <br />
         if (selected) {<br />
           field.className = field.className.replace(/ invalid/g, '');<br />
         } else {<br />
           if (field.className.indexOf('invalid') === -1) {<br />
             field.className += ' invalid';<br />
           }<br />
    <br />
           this.isValid = false;<br />
         }<br />
       },<br />
    <br />
       textAndDropdownValidation: function(field, type) {<br />
         var inputs = field.getElementsByTagName('input');<br />
    <br />
         for (var i = 0; i &lt; inputs.length; ++i) {<br />
           var input = inputs[i];<br />
           if (input.name.indexOf('signup') &gt;= 0) {<br />
             if (type === 'text_field') {<br />
               this.textValidation(input);<br />
             } else {<br />
               this.dropdownValidation(field, input);<br />
             }<br />
           }<br />
         }<br />
         this.htmlEmbedDropdownValidation(field);<br />
       },<br />
    <br />
       textValidation: function(input) {<br />
         if (input.id === 'signup_email') return;<br />
    <br />
         if (input.value) {<br />
           this.removeTextFieldError(input);<br />
         } else {<br />
           this.textFieldError(input);<br />
           this.isValid = false;<br />
         }<br />
       },<br />
    <br />
       dropdownValidation: function(field, input) {<br />
         if (input.value) {<br />
           field.className = field.className.replace(/ invalid/g, '');<br />
         } else {<br />
           if (field.className.indexOf('invalid') === -1) field.className += ' invalid';<br />
           this.onSelectCallback(input);<br />
           this.isValid = false;<br />
         }<br />
       },<br />
    <br />
       htmlEmbedDropdownValidation: function(field) {<br />
         var dropdowns = field.querySelectorAll('.mimi_html_dropdown');<br />
         var _this = this;<br />
    <br />
         for (var i = 0; i &lt; dropdowns.length; ++i) {<br />
           var dropdown = dropdowns[i];<br />
    <br />
           if (dropdown.value) {<br />
             field.className = field.className.replace(/ invalid/g, '');<br />
           } else {<br />
             if (field.className.indexOf('invalid') === -1) field.className += ' invalid';<br />
             this.isValid = false;<br />
             dropdown.onchange = (function(){ _this.validate(); });<br />
           }<br />
         }<br />
       },<br />
    <br />
       textFieldError: function(input) {<br />
         input.className   = 'required invalid';<br />
         input.placeholder = input.getAttribute('data-required-field');<br />
       },<br />
    <br />
       removeTextFieldError: function(input) {<br />
         input.className   = 'required';<br />
         input.placeholder = '';<br />
       },<br />
    <br />
       onSelectCallback: function(input) {<br />
         if (typeof Widget === 'undefined' || !Widget.BasicDropdown) return;<br />
    <br />
         var dropdownEl = input.parentNode,<br />
             instances  = Widget.BasicDropdown.instances,<br />
             _this = this;<br />
    <br />
         for (var i = 0; i &lt; instances.length; ++i) {<br />
           var instance = instances[i];<br />
           if (instance.wrapperEl === dropdownEl) {<br />
             instance.onSelect = function(){ _this.validate() };<br />
           }<br />
         }<br />
       },<br />
    <br />
       updateFormAfterValidation: function() {<br />
         this.form.className   = this.setFormClassName();<br />
         this.submit.value     = this.submitButtonText();<br />
         this.submit.disabled  = !this.isValid;<br />
         this.submit.className = this.isValid ? 'submit' : 'disabled';<br />
       },<br />
    <br />
       setFormClassName: function() {<br />
         var name = this.form.className;<br />
    <br />
         if (this.isValid) {<br />
           return name.replace(/\s?mimi_invalid/, '');<br />
         } else {<br />
           if (name.indexOf('mimi_invalid') === -1) {<br />
             return name += ' mimi_invalid';<br />
           } else {<br />
             return name;<br />
           }<br />
         }<br />
       },<br />
    <br />
       submitButtonText: function() {<br />
         var invalidFields = document.querySelectorAll('.invalid'),<br />
             text;<br />
    <br />
         if (this.isValid || !invalidFields) {<br />
           text = this.submit.getAttribute('data-default-text');<br />
         } else {<br />
           if (invalidFields.length || invalidFields[0].className.indexOf('checkgroup') === -1) {<br />
             text = this.submit.getAttribute('data-invalid-text');<br />
           } else {<br />
             text = this.submit.getAttribute('data-choose-list');<br />
           }<br />
         }<br />
         return text;<br />
       },<br />
    <br />
       submitForm: function() {<br />
         this.formSubmitting();<br />
    <br />
         var _this = this;<br />
         window[this.callbackName] = function(response) {<br />
           delete window[this.callbackName];<br />
           document.body.removeChild(script);<br />
           _this.onSubmitCallback(response);<br />
         };<br />
    <br />
         var script = document.createElement('script');<br />
         script.src = this.formUrl('json');<br />
         document.body.appendChild(script);<br />
       },<br />
    <br />
       formUrl: function(format) {<br />
         var action  = this.form.action;<br />
         if (format === 'json') action += '.json';<br />
         return action + '?callback=' + this.callbackName + '&amp;' + serialize(this.form);<br />
       },<br />
    <br />
       formSubmitting: function() {<br />
         this.form.className  += ' mimi_submitting';<br />
         this.submit.value     = this.submit.getAttribute('data-submitting-text');<br />
         this.submit.disabled  = true;<br />
         this.submit.className = 'disabled';<br />
       },<br />
    <br />
       onSubmitCallback: function(response) {<br />
         if (response.success) {<br />
           this.onSubmitSuccess(response.result);<br />
         } else {<br />
           top.location.href = this.formUrl('html');<br />
         }<br />
       },<br />
    <br />
       onSubmitSuccess: function(result) {<br />
         if (result.has_redirect) {<br />
           top.location.href = result.redirect;<br />
         } else if(result.single_opt_in || !result.confirmation_html) {<br />
           this.disableForm();<br />
           this.updateSubmitButtonText(this.submit.getAttribute('data-thanks'));<br />
         } else {<br />
           this.showConfirmationText(result.confirmation_html);<br />
         }<br />
       },<br />
    <br />
       showConfirmationText: function(html) {<br />
         var fields = this.form.querySelectorAll('.mimi_field');<br />
    <br />
         for (var i = 0; i &lt; fields.length; ++i) {<br />
           fields[i].style['display'] = 'none';<br />
         }<br />
    <br />
         (this.form.querySelectorAll('fieldset')[0] || this.form).innerHTML = html;<br />
       },<br />
    <br />
       disableForm: function() {<br />
         var elements = this.form.elements;<br />
         for (var i = 0; i &lt; elements.length; ++i) {<br />
           elements[i].disabled = true;<br />
         }<br />
       },<br />
    <br />
       updateSubmitButtonText: function(text) {<br />
         this.submit.value = text;<br />
       },<br />
    <br />
       revalidateOnChange: function() {<br />
         var fields = this.form.querySelectorAll(&quot;.mimi_field.required&quot;),<br />
             _this = this;<br />
    <br />
         var onTextFieldChange = function() {<br />
           if (this.getAttribute('name') === 'signup[email]') {<br />
             if (_this.validEmail.test(this.value)) _this.validate();<br />
           } else {<br />
             if (this.value.length === 1) _this.validate();<br />
           }<br />
         }<br />
    <br />
         for (var i = 0; i &lt; fields.length; ++i) {<br />
           var inputs = fields[i].getElementsByTagName('input');<br />
           for (var j = 0; j &lt; inputs.length; ++j) {<br />
             if (this.fieldType(fields[i]) === 'text_field') {<br />
               inputs[j].onkeyup = onTextFieldChange;<br />
               inputs[j].onchange = onTextFieldChange; <br />
             } else {<br />
               inputs[j].onchange = function(){ _this.validate() };<br />
             }<br />
           }<br />
         }<br />
       }<br />
     });<br />
    <br />
     if (document.addEventListener) {<br />
       document.addEventListener(&quot;DOMContentLoaded&quot;, function() {<br />
         new Mimi.Signups.EmbedValidation();<br />
       });<br />
     }<br />
     else {<br />
       window.attachEvent('onload', function() {<br />
         new Mimi.Signups.EmbedValidation();<br />
       });<br />
     }<br />
    })(this);<br />
    &lt;/script&gt;