Recherche avancée

Médias (91)

Autres articles (64)

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

  • Selection of projects using MediaSPIP

    2 mai 2011, par

    The examples below are representative elements of MediaSPIP specific uses for specific projects.
    MediaSPIP farm @ Infini
    The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...)

Sur d’autres sites (4349)

  • Buffered encoded images not saved

    26 mars 2021, par xyfix

    I have an issue with the first 12 images not being saved to file. I have attached the relevant files in this issue. I have also attached a log file to show that the first 12 images aren't written to the file that is generated. The frame rate is 24 fps and the recording is 5 sec, so there should be 120 frames written to the output file. This can be seen in the 4th column. The lines in the log files are as follows :

    


    image num [unique num from camera] [temp image num for recording seq] [time in ms]

    


    The image class is actually a simple wrapper around OpenCV's mat class with some additional members. The output file that I currently get is around 10 MB and when I open it in VLC it doesn't run for 5 seconds but more like 1 - 2 seconds but I can see whatever I have recorded. Can anyone explain to me why the files not written and the duration isn't 5 secs (minus 12 frames missing) as expected . As you can see I have tried with "av_interleaved_write_frame" but that didn't help

    


    xcodec.h

    


    #ifndef XCODEC_H
#define XCODEC_H

#include "image/Image.h"

extern "C"
{
    #include "Codec/include/libavcodec/avcodec.h"
    #include "Codec/include/libavdevice/avdevice.h"
    #include "Codec/include/libavformat/avformat.h"
    #include "Codec/include/libavutil/avutil.h"
    #include "Codec/include/libavformat/avio.h"
    #include "Codec/include/libavutil/imgutils.h"
    #include "Codec/include/libavutil/opt.h"
    #include "Codec/include/libswscale/swscale.h"
}


class XCodec
{
public:

    XCodec(const char *filename);

    ~XCodec();

    void encodeImage( const Image& image );

    void encode( AVFrame *frame, AVPacket *pkt );

    void add_stream();

    void openVideoCodec();

    void write_video_frame(const Image &image);

    void createFrame( const Image& image );

    void close();

private:

    static int s_frameCount;

    int m_timeVideo = 0;

    std::string m_filename;


    AVCodec* m_encoder = NULL;

    AVOutputFormat* m_outputFormat = NULL;

    AVFormatContext* m_formatCtx = NULL;

    AVCodecContext* m_codecCtx = NULL;

    AVStream* m_streamOut = NULL;

    AVFrame* m_frame = NULL;

    AVPacket* m_packet = NULL;

};

#endif


    


    xcodec.cpp

    


    #include "XCodec.h"&#xA;&#xA;#include <qdebug>&#xA;&#xA;&#xA;#define STREAM_DURATION   5.0&#xA;#define STREAM_FRAME_RATE 24&#xA;#define STREAM_NB_FRAMES  ((int)(STREAM_DURATION * STREAM_FRAME_RATE))&#xA;#define STREAM_PIX_FMT    AV_PIX_FMT_YUV420P /* default pix_fmt */&#xA;#define OUTPUT_CODEC AV_CODEC_ID_H264&#xA;&#xA;int XCodec::s_frameCount = 0;&#xA;&#xA;XCodec::XCodec( const char* filename ) :&#xA;    m_filename( filename ),&#xA;    m_encoder( avcodec_find_encoder( OUTPUT_CODEC ))&#xA;{&#xA;    av_log_set_level(AV_LOG_VERBOSE);&#xA;&#xA;    int ret(0);&#xA;&#xA;&#xA;    // allocate the output media context&#xA;    ret = avformat_alloc_output_context2( &amp;m_formatCtx, m_outputFormat, NULL, m_filename.c_str());&#xA;&#xA;    if (!m_formatCtx)&#xA;        return;&#xA;&#xA;    m_outputFormat = m_formatCtx->oformat;&#xA;&#xA;    // Add the video stream using H264 codec&#xA;    add_stream();&#xA;&#xA;    // Open video codec and allocate the necessary encode buffers&#xA;    if (m_streamOut)&#xA;        openVideoCodec();&#xA;&#xA;    // Print detailed information about input and output&#xA;    av_dump_format( m_formatCtx, 0, m_filename.c_str(), 1);&#xA;&#xA;    // Open the output media file, if needed&#xA;    if (!( m_outputFormat->flags &amp; AVFMT_NOFILE))&#xA;    {&#xA;        ret = avio_open( &amp;m_formatCtx->pb, m_filename.c_str(), AVIO_FLAG_WRITE);&#xA;&#xA;        if (ret &lt; 0)&#xA;        {&#xA;            char error[255];&#xA;            ret = av_strerror( ret, error, 255);&#xA;            fprintf(stderr, "Could not open &#x27;%s&#x27;: %s\n", m_filename.c_str(), error);&#xA;            return ;&#xA;        }&#xA;    }&#xA;    else&#xA;    {&#xA;        return;&#xA;    }&#xA;&#xA;    // Write media header&#xA;    ret = avformat_write_header( m_formatCtx, NULL );&#xA;&#xA;    if (ret &lt; 0)&#xA;    {&#xA;        char error[255];&#xA;        av_strerror(ret, error, 255);&#xA;        fprintf(stderr, "Error occurred when opening output file: %s\n", error);&#xA;        return;&#xA;    }&#xA;&#xA;    if ( m_frame )&#xA;           m_frame->pts = 0;&#xA;}&#xA;&#xA;&#xA;&#xA;XCodec::~XCodec()&#xA;{}&#xA;&#xA;/* Add an output stream. */&#xA;void XCodec::add_stream()&#xA;{&#xA;    AVCodecID codecId = OUTPUT_CODEC;&#xA;&#xA;    if (!( m_encoder ))&#xA;    {&#xA;        fprintf(stderr, "Could not find encoder for &#x27;%s&#x27;\n",&#xA;            avcodec_get_name(codecId));&#xA;        return;&#xA;    }&#xA;&#xA;    // Get the stream for codec&#xA;    m_streamOut = avformat_new_stream(m_formatCtx, m_encoder);&#xA;&#xA;    if (!m_streamOut) {&#xA;        fprintf(stderr, "Could not allocate stream\n");&#xA;        return;&#xA;    }&#xA;&#xA;    m_streamOut->id = m_formatCtx->nb_streams - 1;&#xA;&#xA;    m_codecCtx = avcodec_alloc_context3( m_encoder);&#xA;&#xA;    switch (( m_encoder)->type)&#xA;    {&#xA;    case AVMEDIA_TYPE_VIDEO:&#xA;        m_streamOut->codecpar->codec_id = codecId;&#xA;        m_streamOut->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;&#xA;        m_streamOut->codecpar->bit_rate = 400000;&#xA;        m_streamOut->codecpar->width = 800;&#xA;        m_streamOut->codecpar->height = 640;&#xA;        m_streamOut->codecpar->format = STREAM_PIX_FMT;&#xA;        m_streamOut->time_base = { 1, STREAM_FRAME_RATE };&#xA;&#xA;        avcodec_parameters_to_context( m_codecCtx, m_streamOut->codecpar);&#xA;&#xA;        m_codecCtx->gop_size = 12; /* emit one intra frame every twelve frames at most */&#xA;        m_codecCtx->max_b_frames = 1;&#xA;        m_codecCtx->time_base = { 1, STREAM_FRAME_RATE };&#xA;        m_codecCtx->framerate = { STREAM_FRAME_RATE, 1 };&#xA;        m_codecCtx->pix_fmt = STREAM_PIX_FMT;&#xA;        m_codecCtx->profile = FF_PROFILE_H264_HIGH;&#xA;&#xA;        break;&#xA;&#xA;    default:&#xA;        break;&#xA;    }&#xA;&#xA;    if (m_streamOut->codecpar->codec_id == OUTPUT_CODEC)&#xA;    {&#xA;      av_opt_set( m_codecCtx, "preset", "ultrafast", 0 );&#xA;    }&#xA;&#xA;/&#xA;//    /* Some formats want stream headers to be separate. */&#xA;    if (m_formatCtx->oformat->flags &amp; AVFMT_GLOBALHEADER)&#xA;            m_codecCtx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;&#xA;&#xA;&#xA;    int ret = avcodec_parameters_from_context( m_streamOut->codecpar, m_codecCtx );&#xA;&#xA;    if (ret &lt; 0)&#xA;    {&#xA;        char error[255];&#xA;        av_strerror(ret, error, 255);&#xA;        fprintf(stderr, "avcodec_parameters_from_context returned (%d) - %s", ret, error);&#xA;        return;&#xA;    }&#xA;}&#xA;&#xA;&#xA;void XCodec::openVideoCodec()&#xA;{&#xA;    int ret;&#xA;&#xA;    /* open the codec */&#xA;    ret = avcodec_open2(m_codecCtx, m_encoder, NULL);&#xA;&#xA;    if (ret &lt; 0)&#xA;    {&#xA;        char error[255];&#xA;        av_strerror(ret, error, 255);&#xA;        fprintf(stderr, "Could not open video codec: %s\n", error);&#xA;        return;&#xA;    }&#xA;&#xA;    /* allocate and init a re-usable frame */&#xA;//    m_frame = av_frame_alloc();&#xA;&#xA;}&#xA;&#xA;&#xA;void XCodec::encodeImage(const Image &amp;image)&#xA;{&#xA;    // Compute video time from last added video frame&#xA;    m_timeVideo = image.timeStamp(); //(double)m_frame->pts) * av_q2d(m_streamOut->time_base);&#xA;&#xA;    // Stop media if enough time&#xA;    if (!m_streamOut /*|| m_timeVideo >= STREAM_DURATION*/)&#xA;       return;&#xA;&#xA;&#xA;    // Add a video frame&#xA;    write_video_frame( image );&#xA;&#xA;}&#xA;&#xA;&#xA;void XCodec::write_video_frame( const Image&amp; image )&#xA;{&#xA;    int ret;&#xA;&#xA;qDebug() &lt;&lt; "image num " &lt;&lt; image.uniqueImageNumber() &lt;&lt; " " &lt;&lt; s_frameCount;&#xA;&#xA;    if ( s_frameCount >= STREAM_NB_FRAMES)&#xA;    {&#xA;        /* No more frames to compress. The codec has a latency of a few&#xA;         * frames if using B-frames, so we get the last frames by&#xA;         * passing the same picture again. */&#xA;        int p( 0 ) ;&#xA;    }&#xA;    else&#xA;    {&#xA;         createFrame( image );&#xA;    }&#xA;&#xA;    // Increase frame pts according to time base&#xA;//    m_frame->pts &#x2B;= av_rescale_q(1, m_codecCtx->time_base, m_streamOut->time_base);&#xA;    m_frame->pts = int64_t( image.timeStamp()) ;&#xA;&#xA;&#xA;    if (m_formatCtx->oformat->flags &amp; 0x0020 )&#xA;    {&#xA;        /* Raw video case - directly store the picture in the packet */&#xA;        AVPacket pkt;&#xA;        av_init_packet(&amp;pkt);&#xA;&#xA;        pkt.flags |= AV_PKT_FLAG_KEY;&#xA;        pkt.stream_index = m_streamOut->index;&#xA;        pkt.data = m_frame->data[0];&#xA;        pkt.size = sizeof(AVPicture);&#xA;&#xA;//        ret = av_interleaved_write_frame(m_formatCtx, &amp;pkt);&#xA;        ret = av_write_frame( m_formatCtx, &amp;pkt );&#xA;    }&#xA;    else&#xA;    {&#xA;        AVPacket pkt;&#xA;        av_init_packet(&amp;pkt);&#xA;&#xA;        /* encode the image */&#xA;        ret = avcodec_send_frame(m_codecCtx, m_frame);&#xA;&#xA;        if (ret &lt; 0)&#xA;        {&#xA;            char error[255];&#xA;            av_strerror(ret, error, 255);&#xA;            fprintf(stderr, "Error encoding video frame: %s\n", error);&#xA;            return;&#xA;        }&#xA;&#xA;        /* If size is zero, it means the image was buffered. */&#xA;        ret = avcodec_receive_packet(m_codecCtx, &amp;pkt);&#xA;&#xA;        if( !ret &amp;&amp; pkt.size)&#xA;        {&#xA;qDebug() &lt;&lt; "write frame " &lt;&lt; m_frame->display_picture_number;&#xA;            pkt.stream_index = m_streamOut->index;&#xA;&#xA;            /* Write the compressed frame to the media file. */&#xA;//            ret = av_interleaved_write_frame(m_formatCtx, &amp;pkt);&#xA;            ret = av_write_frame( m_formatCtx, &amp;pkt );&#xA;        }&#xA;        else&#xA;        {&#xA;            ret = 0;&#xA;        }&#xA;    }&#xA;&#xA;    if (ret != 0)&#xA;    {&#xA;        char error[255];&#xA;        av_strerror(ret, error, 255);&#xA;        fprintf(stderr, "Error while writing video frame: %s\n", error);&#xA;        return;&#xA;    }&#xA;&#xA;    s_frameCount&#x2B;&#x2B;;&#xA;}&#xA;&#xA;&#xA;void XCodec::createFrame( const Image&amp; image /*, AVFrame *m_frame, int frame_index, int width, int height*/)&#xA;{&#xA;    /**&#xA;     * \note allocate frame&#xA;     */&#xA;    m_frame = av_frame_alloc();&#xA;    int ret = av_frame_make_writable( m_frame );&#xA;&#xA;    m_frame->format = STREAM_PIX_FMT;&#xA;    m_frame->width = image.width();&#xA;    m_frame->height = image.height();&#xA;//    m_frame->pict_type = AV_PICTURE_TYPE_I;&#xA;    m_frame->display_picture_number = image.uniqueImageNumber();&#xA;&#xA;    ret = av_image_alloc(m_frame->data, m_frame->linesize, m_frame->width,  m_frame->height, STREAM_PIX_FMT, 1);&#xA;&#xA;    if (ret &lt; 0)&#xA;    {&#xA;        return;&#xA;    }&#xA;&#xA;    struct SwsContext* sws_ctx = sws_getContext((int)image.width(), (int)image.height(), AV_PIX_FMT_RGB24,&#xA;                                                (int)image.width(), (int)image.height(), STREAM_PIX_FMT, 0, NULL, NULL, NULL);&#xA;&#xA;    const uint8_t* rgbData[1] = { (uint8_t* )image.getData() };&#xA;    int rgbLineSize[1] = { 3 * image.width() };&#xA;&#xA;    sws_scale(sws_ctx, rgbData, rgbLineSize, 0, image.height(), m_frame->data, m_frame->linesize);&#xA;&#xA;//cv::Mat yuv420p( m_frame->height &#x2B; m_frame->height/2, m_frame->width, CV_8UC1, m_frame->data[0]);&#xA;//cv::Mat cvmIm;&#xA;//cv::cvtColor(yuv420p,cvmIm,CV_YUV420p2BGR);&#xA;//std::ostringstream ss;&#xA;//ss &lt;&lt; "c:\\tmp\\YUVoriginal_" &lt;&lt; image.uniqueImageNumber() &lt;&lt; ".png";&#xA;//cv::imwrite( ss.str().c_str(), cvmIm);&#xA;}&#xA;&#xA;&#xA;void XCodec::close()&#xA;{&#xA;    /* reset the framecount */&#xA;    s_frameCount = 0 ;&#xA;&#xA;    int ret( 0 );&#xA;&#xA;    /* flush the encoder */&#xA;    while( ret >= 0 )&#xA;        ret = avcodec_send_frame(m_codecCtx, NULL);&#xA;&#xA;    // Write media trailer&#xA;    if( m_formatCtx )&#xA;        ret = av_write_trailer( m_formatCtx );&#xA;&#xA;    /* Close each codec. */&#xA;    if ( m_streamOut )&#xA;    {&#xA;        if( m_frame )&#xA;        {&#xA;            av_free( m_frame->data[0]);&#xA;            av_frame_free( &amp;m_frame );&#xA;        }&#xA;&#xA;        if( m_packet )&#xA;            av_packet_free( &amp;m_packet );&#xA;    }&#xA;&#xA;    if (!( m_outputFormat->flags &amp; AVFMT_NOFILE))&#xA;        /* Close the output file. */&#xA;        ret = avio_close( m_formatCtx->pb);&#xA;&#xA;&#xA;    /* free the stream */&#xA;    avformat_free_context( m_formatCtx );&#xA;&#xA;    fflush( stdout );&#xA;}&#xA;</qdebug>

    &#xA;

    image.h

    &#xA;

    #ifndef IMAGE_H&#xA;#define IMAGE_H&#xA;&#xA;#include  &#xA;&#xA;class Image &#xA;{&#xA;public:&#xA;&#xA;    Image();&#xA;&#xA;    Image( const cv::Mat&amp; mat );&#xA;&#xA;    Image(const Image&amp; other) = default;&#xA;&#xA;    Image(Image&amp;&amp; other) = default;&#xA;&#xA;    ~Image();&#xA;&#xA;&#xA;    inline const cv::Mat&amp; matrix() const{ return m_matrix; }&#xA;&#xA;    inline const int uniqueImageNumber() const{ return m_uniqueId; }&#xA;&#xA;    inline const int timeStamp() const { return m_timeStamp; }&#xA;&#xA;    inline const int width() const { return m_matrix.cols(); }&#xA;    &#xA;    inline const int height() const { return m_matrix.rows(); }&#xA;&#xA;private:&#xA;&#xA;    cv::Mat   m_matrix;&#xA;&#xA;    int       m_timeStamp;&#xA;&#xA;    int       m_uniqueId;&#xA;&#xA;};&#xA;&#xA;#endif&#xA;

    &#xA;

    logtxt

    &#xA;

     image num  1725   0   0&#xA; image num  1727   1   40&#xA; image num  1729   2   84&#xA; image num  1730   3   126&#xA; image num  1732   4   169&#xA; image num  1734   5   211&#xA; image num  1736   6   259&#xA; image num  1738   7   297&#xA; image num  1740   8   340&#xA; image num  1742   9   383&#xA; image num  1744   10   425&#xA; image num  1746   11   467&#xA; image num  1748   12   511&#xA; image num  1750   13   553&#xA; write frame  1750&#xA; image num  1752   14   600&#xA; write frame  1752&#xA; image num  1753   15   637&#xA; write frame  1753&#xA; image num  1755   16   680&#xA; write frame  1755&#xA; image num  1757   17   723&#xA; write frame  1757&#xA; image num  1759   18   766&#xA; write frame  1759&#xA; image num  1761   19   808&#xA; write frame  1761&#xA; image num  1763   20   854&#xA; write frame  1763&#xA; image num  1765   21   893&#xA; write frame  1765&#xA; image num  1767   22   937&#xA; write frame  1767&#xA; image num  1769   23   979&#xA; write frame  1769&#xA; image num  1770   24   1022&#xA; write frame  1770&#xA; image num  1772   25   1064&#xA; write frame  1772&#xA; image num  1774   26   1108&#xA; write frame  1774&#xA; image num  1776   27   1150&#xA; write frame  1776&#xA; image num  1778   28   1192&#xA; write frame  1778&#xA; image num  1780   29   1235&#xA; write frame  1780&#xA; image num  1782   30   1277&#xA; write frame  1782&#xA; image num  1784   31   1320&#xA; write frame  1784&#xA; image num  1786   32   1362&#xA; write frame  1786&#xA; image num  1787   33   1405&#xA; write frame  1787&#xA; image num  1789   34   1450&#xA; write frame  1789&#xA; image num  1791   35   1493&#xA; write frame  1791&#xA; image num  1793   36   1536&#xA; write frame  1793&#xA; image num  1795   37   1578&#xA; write frame  1795&#xA; image num  1797   38   1621&#xA; write frame  1797&#xA; image num  1799   39   1663&#xA; write frame  1799&#xA; image num  1801   40   1709&#xA; write frame  1801&#xA; image num  1803   41   1748&#xA; write frame  1803&#xA; image num  1805   42   1791&#xA; write frame  1805&#xA; image num  1807   43   1833&#xA; write frame  1807&#xA; image num  1808   44   1876&#xA; write frame  1808&#xA; image num  1810   45   1920&#xA; write frame  1810&#xA; image num  1812   46   1962&#xA; write frame  1812&#xA; image num  1814   47   2004&#xA; write frame  1814&#xA; image num  1816   48   2048&#xA; write frame  1816&#xA; image num  1818   49   2092&#xA; write frame  1818&#xA; image num  1820   50   2133&#xA; write frame  1820&#xA; image num  1822   51   2175&#xA; write frame  1822&#xA; image num  1824   52   2221&#xA; write frame  1824&#xA; image num  1826   53   2277&#xA; write frame  1826&#xA; image num  1828   54   2319&#xA; write frame  1828&#xA; image num  1830   55   2361&#xA; write frame  1830&#xA; image num  1832   56   2405&#xA; write frame  1832&#xA; image num  1833   57   2447&#xA; write frame  1833&#xA; image num  1835   58   2491&#xA; write frame  1835&#xA; image num  1837   59   2533&#xA; write frame  1837&#xA; image num  1839   60   2576&#xA; write frame  1839&#xA; image num  1841   61   2619&#xA; write frame  1841&#xA; image num  1843   62   2662&#xA; write frame  1843&#xA; image num  1845   63   2704&#xA; write frame  1845&#xA; image num  1847   64   2746&#xA; write frame  1847&#xA; image num  1849   65   2789&#xA; write frame  1849&#xA; image num  1851   66   2831&#xA; write frame  1851&#xA; image num  1852   67   2874&#xA; write frame  1852&#xA; image num  1854   68   2917&#xA; write frame  1854&#xA; image num  1856   69   2959&#xA; write frame  1856&#xA; image num  1858   70   3003&#xA; write frame  1858&#xA; image num  1860   71   3045&#xA; write frame  1860&#xA; image num  1862   72   3088&#xA; write frame  1862&#xA; image num  1864   73   3130&#xA; write frame  1864&#xA; image num  1866   74   3173&#xA; write frame  1866&#xA; image num  1868   75   3215&#xA; write frame  1868&#xA; image num  1870   76   3257&#xA; write frame  1870&#xA; image num  1872   77   3306&#xA; write frame  1872&#xA; image num  1873   78   3347&#xA; write frame  1873&#xA; image num  1875   79   3389&#xA; write frame  1875&#xA; image num  1877   80   3433&#xA; write frame  1877&#xA; image num  1879   81   3475&#xA; write frame  1879&#xA; image num  1883   82   3562&#xA; write frame  1883&#xA; image num  1885   83   3603&#xA; write frame  1885&#xA; image num  1887   84   3660&#xA; write frame  1887&#xA; image num  1889   85   3704&#xA; write frame  1889&#xA; image num  1891   86   3747&#xA; write frame  1891&#xA; image num  1893   87   3789&#xA; write frame  1893&#xA; image num  1895   88   3832&#xA; write frame  1895&#xA; image num  1897   89   3874&#xA; write frame  1897&#xA; image num  1899   90   3917&#xA; write frame  1899&#xA; image num  1900   91   3959&#xA; write frame  1900&#xA; image num  1902   92   4001&#xA; write frame  1902&#xA; image num  1904   93   4044&#xA; write frame  1904&#xA; image num  1906   94   4086&#xA; write frame  1906&#xA; image num  1908   95   4130&#xA; write frame  1908&#xA; image num  1910   96   4174&#xA; write frame  1910&#xA; image num  1912   97   4216&#xA; write frame  1912&#xA; image num  1914   98   4257&#xA; write frame  1914&#xA; image num  1915   99   4303&#xA; write frame  1915&#xA; image num  1918   100   4344&#xA; write frame  1918&#xA; image num  1919   101   4387&#xA; write frame  1919&#xA; image num  1922   102   4451&#xA; write frame  1922&#xA; image num  1924   103   4494&#xA; write frame  1924&#xA; image num  1926   104   4541&#xA; write frame  1926&#xA; image num  1927   105   4588&#xA; write frame  1927&#xA; image num  1931   106   4665&#xA; write frame  1931&#xA; image num  1933   107   4707&#xA; write frame  1933&#xA; image num  1935   108   4750&#xA; write frame  1935&#xA; image num  1937   109   4794&#xA; write frame  1937&#xA; image num  1939   110   4836&#xA; write frame  1939&#xA; image num  1941   111   4879&#xA; write frame  1941&#xA; image num  1943   112   4922&#xA; write frame  1943&#xA; image num  1945   113   4965&#xA; write frame  1945&#xA; image num  1947   114   5007&#xA; write frame  1947&#xA; image num  1948   115   5050&#xA; write frame  1948&#xA; image num  1950   116   5093&#xA; write frame  1950&#xA; image num  1952   117   5136&#xA; write frame  1952&#xA; image num  1954   118   5178&#xA; write frame  1954&#xA; image num  1956   119   5221&#xA; write frame  1956&#xA; MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2&#xA;0, 8-bit&#xA;Not writing &#x27;clli&#x27; atom. No content light level info.&#xA;Not writing &#x27;mdcv&#x27; atom. Missing mastering metadata.&#xA; 2 seeks, 41 writeouts&#xA;

    &#xA;

  • How to Choose a GDPR Compliant Web Analytics Solution

    2 mars 2022, par Matthieu Aubry — Privacy

    Since the launch of GDPR, one big question has lingered around with uncertainty – is Google Analytics GDPR compliant ? The current GDPR enforcement trend happening across the EU is certainly shedding some light on this question.

    Starting with the Austrian Data Protection Authority’s ruling on Google Analytics and more recently, CNIL (the French Data Protection Authority) has followed suit by also ruling Google Analytics illegal to use. Organisations with EU-based web visitors are now scrambling to find a compliant solution.

    The French Data Protection Authority (CNIL) has already started delivering formal notices to websites using Google Analytics, so now is the time to act. According to CNIL, organisations have two options :

    1. Ceasing use of the Google Analytics functionality (under the current conditions) 
    2. Use a compliant web analytics tool that does not transfer data outside the EU

    Getting started 

    For organisations considering migrating to a compliant web analytics tool, I’ve outlined below the things you need to consider when weighing up compliant web analytics tools. Once you’ve made a choice, I’ve also included a step-by-step guide to migrating away from Google Analytics. This guide is useful regardless of which GDPR compliant analytics provider you choose.

    Before getting started, I recommend that you document your findings against the following considerations while reviewing GDPR compliant Google Analytics alternatives. This document can then be shared with your Data Protection Officer (DPO) to get their final recommendation.

    10 key considerations when selecting a GDPR compliant web analytics tools

    Many tools will claim to be GDPR compliant so it’s important that you do your due diligence and review tools against the following considerations. 

    1. Where does the tool store data ? 

    The rulings in France and Austria were based on the fact that Google Analytics stores data in the US, which does not have an adequate level of data protection. Your safest option is to find a tool that legally stores data in the EU.

    You should be able to find out where the data is stored in the organisation’s privacy policy. Generally, data storage information can be found under sections titled “Subprocessors” and “Third-party services”. Check out the Matomo Privacy Policy as an example. 

    If you’re unable to easily find this information or it’s unclear, reach out to the organisation for more information.

    2. Does the tool offer anonymous tracking ?

    Anonymous tracking comes with many benefits, including :

    • The ability to track visitors without a cookie consent screen. Due to the privacy-respecting aspect of cookieless tracking, you don’t need to worry about the extra steps involved with compliant cookie banners.
    • More accurate data. When visitors deny tracking cookies, you lose out on valuable data. With anonymous tracking there is no data lost as you don’t need consent to track.
    • Simplified GDPR compliance. With this enabled, there are fewer steps you need to take to get GDPR compliant and stay GDPR compliant.

    For those reasons, it may be important for you to select a tool that offers anonymous tracking functionalities. The level of anonymous tracking you require will depend on your situation but you should look out for tools that allow you to :

    • Disable fingerprinting 
    • Disable user profiles 
    • Anonymise data
    • Cookieless tracking

    If you want to read more about data anonymization, check out this guide on data anonymization in web analytics.

    3. Does the tool integrate with my existing tech stack ?

    You’ll want to ensure that a new web analytics tool will play well with other tools in your tech stack including things like your CMS (content management system), eCommerce shop, etc. You should list out all the existing tools that currently integrate with your Google Analytics and check that the same integrations can be re-created with the new tool, via integrations or APIs.

    If not, it could become costly trying to connect your existing tech stack to a new solution.

    4. Does the tool offer the same features and insights you are currently using in Google Analytics ? Or more, if necessary ? 

    Just because you are moving to a new web analytics platform, doesn’t mean you have to give up the insights, reports and features you’ve grown accustomed to with Google Analytics. Ensuring that a new platform provides the same features and reports that you value the most will result in a smoother transition away from Google Analytics.

    It’s unlikely that a new tool will have all of the same features as Google Analytics, so I’d recommend listing out and prioritising your business-critical features and reports. 

    If I had to guess, you probably set up Google Analytics years ago because it was the default option. Now is your chance to make the most of this switch from Google Analytics and find a tool that offers additional reports and features that better aligns with your business. If time permits, I’d highly recommend that you consider other features or reports that you might have been missing out on while using Google Analytics.

    Check out this comparison of Google Analytics vs Matomo to see side-by-side feature comparison.

    5. Does the tool accept Google Analytics data imports ? 

    The historical data in Google Analytics is a critical asset for many businesses. Fortunately, some tools accept Google Analytics data imports so you don’t lose all of the data you’ve generated over time.

    However, it’s important to note that any data you import from Google Analytics to a new tool needs to be compliant data. I’ll cover this more below.

    6. Does the tool provide conversion tracking exports ? 

    Do you invest in paid advertising ? If you do, then tracking the conversions from people clicking on these paid ads is critical in assessing your return on investment. Since sending IP addresses or other personal information to the US is illegal under GDPR, we can only assume that this will also apply to advertising pixel/conversion tracking (e.g., Facebook pixel, Google Ads conversion tracking, etc). 

    As an example, Matomo offers conversion tracking exports so you can get a better understanding of ad performance while meeting privacy laws and without requiring consent from users. See how it works with Matomo’s conversion tracking exports

    7. How will you train up your in-house team ? Or can you hire a contractor ?

    This is a common concern of many, and rightfully so. You’ll want to confirm what resources are readily available so you can hit the ground running with your new web analytics tool. If you’d prefer to train up your in-house team, check the provider’s site for training resources, videos, guides, etc.

    If you’d rather hire an external contractor, we recommend heading to LinkedIn, reaching out to your community or asking the provider if they have any recommendations for contractors.

    In addition, check that the provider offers technical support or a forum, in case you have specific questions and need help.   

    8. Does the tool offer self-hosting ? (optional)

    For organisations that want full control over their data and storage location, an on-premise web analytics tool will be the preferred option. From a GDPR perspective, this is also the easiest option for compliance.

    Keep in mind that this requires resources, regular maintenance, technical knowledge and/or technical consultants. If you’re unsure which option is best for your organisation, check out our on-premise vs cloud web analytics comparison breakdown.

    Find out more about self-hosting Matomo.

    9. Is the tool approved by the CNIL for tracking without consent ?

    This is an important step for websites with French users. This step will help narrow down your selection of tools. The CNIL offers a programme to identify web analytics solutions that can be used without tracking consent. The CNIL’s list of recommended web analytics tools can act as your starting point for solutions to review.

    While this step is specific to sites with French users, it can also be helpful for websites with visitors from any other EU country.

    Benefits of consent-free tracking

    There are many benefits of tracking without consent.

    For one, it simplifies GDPR compliance and reduces the chances of GDPR breaches and fines. Cookie consent screens have recently been the target for EU Data Protection Authorities because many websites are unknowingly serving cookie consent screens that do not meet GDPR requirements. 

    Yet another benefit, and quite possibly the most important is more accurate data. Even if a website displays a user-friendly, lawful consent screen, the majority of users will either ignore or reject cookie consent. Legally website owners can’t track anything unless the visitor gives consent. So not having a cookie consent screen ensures that every visit is tracked and your web analytics data is 100% accurate

    Lastly, many visitors have grown fatigued and frustrated with invasive cookie consent screens. Not having one on your site creates a user-friendly experience, which will likely result in longer user sessions and lower bounce rates.

    10. Does the tool offer a Data Processing Agreement (DPA) ? 

    Technically, any GDPR compliant web analytics tool should offer a DPA but for the sake of completeness, I’ve added this as a consideration. Double check that any tools you are looking at provide this legally binding document. This should be located in the Privacy Policy of the web analytics provider, if not reach out to request it.

    As an example, here’s Matomo’s Data Processing Agreement which can be found in our Privacy Policy under Subprocessors. 

    That wraps up the key considerations. When it comes to compliance, privacy and customer data, Matomo leads the way. We are looking forward to helping you achieve GDPR compliance easily. Start your free 21-day trial of Matomo now – no credit card required.

    A step-by-step guide to migrating from Google Analytics

    Once you’ve identified a tool that suits your needs and your Data Protection Officer (DPO) has approved, you’re ready to get started. Here’s a simple step-by-step guide with all the important steps for you to follow :

    1. Before getting started, you should sign or download the Data Processing Agreement (DPA) offered by your new web analytics provider.

    2. Register for the new tool and configure it for compliance. The provider should offer guides on how to configure for GDPR compliance. This will include things like giving your users an easy way to opt-out of all tracking, turning on cookieless tracking or asking users for consent and anonymizing data and IP addresses, for instance.

    3. Inform your organisation about the change. Whether your colleagues use the tool or not, it’s important that you share information about the new tool with your staff. Let them know what the tool will be used for, who will use the tool and how it complies with GDPR. 

    4. Let your DPO know that you’ve removed Google Analytics and have implemented the new tool.

    5. Update your records of processing activities to include the new tool.

    6. Update your privacy policy. You’ll need to include details about the web analytics provider, where the data is stored, what data is being collected, how long the data will be stored and why the data is being collected. The web analytics tool should readily have this information for you.

    As an example, if you decide to use Matomo as your web analytics tool, we provide a Privacy Policy template for you to use on your site and a guide on how to complete your privacy policy under GDPR with Matomo. Note that these are only applicable if you are using Matomo.

    In addition, if the tool has an opt-out feature, you will also need to put the opt-out into the privacy policy (e.g., when using cookieless tracking).

    7. Now, the exciting part. Add the tracking code to your site by following the steps provided by the web analytics tool. 

    If you’re not comfortable with this step, the provider should offer steps to do this and you can share this with your web developer.

    8. Once added, login to your tool and check to see if traffic is being tracked.

    9. If your tool does not offer Google Analytics data imports or you do not need the historical data in your new tool, go to step 11. 

    To plan for your Google Analytics data migration, you’ll first need to establish what historical data is compliant with GDPR.

    For example, you shouldn’t import any data stored beyond the retention period established in your Privacy Policy or any personally identifiable information (PII) like IP addresses that aren’t anonymised. Discuss this further with your DPO.

    10. Once you’ve established what data you can legally import, then you can begin the import. Follow the steps provided by your new web analytics solution provider.

    11. Remove Google Analytics tracking code from your site. This will stop the collection of your visitors data by Google as well as slightly increase the page load speed.

    If you still haven’t made a choice yet, try Matomo free for 21-days and see why over 1 million websites choose Matomo. 

  • Cohort Analysis 101 : How-To, Examples & Top Tools

    13 novembre 2023, par Erin — Analytics Tips

    Imagine that a farmer is trying to figure out why certain hens are laying large brown eggs and others are laying average-sized white eggs.

    The farmer decides to group the hens into cohorts based on what kind of eggs they lay to make it easier to detect patterns in their day-to-day lives. After careful observation and analysis, she discovered that the hens laying big brown eggs ate more than the roost’s other hens.

    With this cohort analysis, the farmer deduced that a hen’s body weight directly corresponds to egg size. She can now develop a strategy to increase the body weight of her hens to sell more large brown eggs, which are very popular at the weekly farmers’ market.

    Cohort analysis has a myriad of applications in the world of web analytics. Like our farmer, you can use it to better understand user behaviour and reap the benefits of your efforts. This article will discuss the best practices for conducting an effective cohort analysis and compare the top cohort analysis tools for 2024. 

    What is cohort analysis ?

    By definition, cohort analysis refers to a technique where users are grouped based on shared characteristics or behaviours and then examined over a specified period.

    Think of it as a marketing superpower, enabling you to comprehend user behaviours, craft personalised campaigns and allocate resources wisely, ultimately resulting in improved performance and better ROI.

    Why does cohort analysis matter ?

    In web analytics, a cohort is a group of users who share a certain behaviour or characteristic. The goal of cohort analysis is to uncover patterns and compare the performance and behaviour of different cohorts over time.

    An example of a cohort is a group of users who made their first purchase during the holidays. By analysing this cohort, you could learn more about their behaviour and buying patterns. You may discover that this cohort is more likely to buy specific product categories as holiday gifts — you can then tailor future holiday marketing campaigns to include these categories. 

    Types of cohort analysis

    There are a few different types of notable cohorts : 

    1. Time-based cohorts are groups of users categorised by a specific time. The example of the farmer we went over at the beginning of this section is a great example of a time-based cohort.
    2. Acquisition cohorts are users acquired during a specific time frame, event or marketing channel. Analysing these cohorts can help you determine the value of different acquisition methods. 
    3. Behavioural cohorts consist of users who show similar patterns of behaviour. Examples include frequent purchases with your mobile app or digital content engagement. 
    4. Demographic cohorts share common demographic characteristics like age, gender, education level and income. 
    5. Churn cohorts are buyers who have cancelled a subscription/stopped using your service within a specific time frame. Analysing churn cohorts can help you understand why customers leave.
    6. Geographic cohorts are pretty self-explanatory — you can use them to tailor your marketing efforts to specific regions. 
    7. Customer journey cohorts are based on the buyer lifecycle — from acquisition to adoption to retention. 
    8. Product usage cohorts are buyers who use your product/service specifically (think basic users, power users or occasional users). 

    Best practices for conducting a cohort analysis 

    So, you’ve decided you want to understand your user base better but don’t know how to go about it. Perhaps you want to reduce churn and create a more engaging user experience. In this section, we’ll walk you through the dos and don’ts of conducting an effective cohort analysis. Remember that you should tailor your cohort analysis strategy for organisation-specific goals.

    A line graph depicting product usage cohort data with a blue line for new users and a green line for power users.

    1. Preparing for cohort analysis : 

      • First, define specific goals you want your cohort analysis to achieve. Examples include improving conversion rates or reducing churn.
      • Choosing the right time frame will help you compare short-term vs. long-term data trends. 

    2. Creating effective cohorts : 

      • Define your segmentation criteria — anything from demographics to location, purchase history or user engagement level. Narrowing in on your specific segments will make your cohort analysis more precise. 
      • It’s important to find a balance between cohort size and similarity. If your cohort is too small and diverse, you won’t be able to find specific behavioural patterns.

    3. Performing cohort analysis :

        • Study retention rates across cohorts to identify patterns in user behaviour and engagement over time. Pay special attention to cohorts with high retention or churn rates. 
        • Analysing cohorts can reveal interesting behavioural insights — how do specific cohorts interact with your website ? Do they have certain preferences ? Why ? 

    4. Visualising and interpreting data :

      • Visualising your findings can be a great way to reveal patterns. Line charts can help you spot trends, while bar charts can help you compare cohorts.
      • Guide your analytics team on how to interpret patterns in cohort data. Watch for sudden drops or spikes and what they could mean. 

    5. Continue improving :

      • User behaviour is constantly evolving, so be adaptable. Continuous tracking of user behaviour will help keep your strategies up to date. 
      • Encourage iterative analysis optimisation based on your findings. 
    wrench trying to hammer in a nail, and a hammer trying to screw in a screw to a piece of wood

    The top cohort analysis tools for 2024

    In this section, we’ll go over the best cohort analysis tools for 2024, including their key features, cohort analysis dashboards, cost and pros and cons.

    1. Matomo

    A screenshot of a cohorts graph in Matomo

    Matomo is an open-source, GDPR-compliant web analytics solution that offers cohort analysis as a standard feature in Matomo Cloud and is available as a plugin for Matomo On-Premise. Pairing traditional web analytics with cohort analysis will help you gain even deeper insights into understanding user behaviour over time. 

    You can use the data you get from web analytics to identify patterns in user behaviour and target your marketing strategies to specific cohorts. 

    Key features

    • Matomo offers a cohorts table that lets you compare cohorts side-by-side, and it comes with a time series.
      • All core session and conversion metrics are also available in the Cohorts report.
    • Create custom segments based on demographics, geography, referral sources, acquisition date, device types or user behaviour. 
    • Matomo provides retention analysis so you can track how many users from a specific cohort return to your website and when. 
    • Flexibly analyse your cohorts with custom reports. Customise your reports by combining metrics and dimensions specific to different cohorts. 
    • Create cohorts based on events or interactions with your website. 
    • Intuitive, colour-coded data visualisation, so you can easily spot patterns.

    Pros

    • No setup is needed if you use the JavaScript tracker
    • You can fetch cohort without any limit
    • 100% accurate data, no AI or Machine Learning data filling, and without the use of data sampling

    Cons

    • Matomo On-Premise (self-hosted) is free, but advanced features come with additional charges
    • Servers and technical know-how are required for Matomo On-Premise. Alternatively, for those not ready for self-hosting, Matomo Cloud presents a more accessible option and starts at $19 per month.

    Price : 

    • Matomo Cloud : 21-day free trial, then starts at $19 per month (includes Cohorts).
    • Matomo On-Premise : Free to self-host ; Cohorts plugin : 30-day free trial, then $99 per year.

    2. Mixpanel

    Mixpanel is a product analytics tool designed to help teams better understand user behaviour. It is especially well-suited for analysing user behaviour on iOS and Android apps. It offers various cohort analytics features that can be used to identify patterns and engage your users. 

    Key features

    • Create cohorts based on criteria such as sign-up date, first purchase date, referral source, geographic location, device type or another custom event/property. 
    • Compare how different cohorts engage with your app with Mixpanel’s comparative analysis features.
    • Create interactive dashboards, charts and graphs to visualise data.
    • Mixpanel provides retention analysis tools to see how often users return to your product over time. 
    • Send targeted messages and notifications to specific cohorts to encourage user engagement, announce new features, etc. 
    • Track and analyse user behaviours within cohorts — understand how different types of users engage with your product.

    Pros

    • Easily export cohort analysis data for further analysis
    • Combined with Mixpanel reports, cohorts can be a powerful tool for improving your product

    Cons

    • With the free Mixpanel plan, you can’t save cohorts for future use
    • Enterprise-level pricing is expensive
    • Time-consuming cohort creation process

    Price : Free basic version. The growth version starts at £16/month.

    3. Amplitude

    A screenshot of a cohorts graph in Amplitude

    Amplitude is another product analytics solution that can help businesses track user interactions across digital platforms. Amplitude offers a standard toolkit for in-depth cohort analysis.

    Key features

    • Create cohorts based on criteria such as sign-up date, first purchase date, referral source, geographic location, device type or another custom event/property. 
    • Conduct behavioural, time-based and retention analyses.
    • Create custom reports with custom data.
    • Segment cohorts further based on additional criteria and compare multiple cohorts side-by-side.

    Pros

    • Highly customisable and flexible
    • Quick and simple setup

    Cons

    • Steep learning curve — requires significant training 
    • Slow loading speed
    • High price point compared to other tools

    Price : Free basic version. Plus version starts at £40/month (billed annually).

    4. Kissmetrics

    A screenshot of a cohorts graph in Kissmetrics

    Kissmetrics is a customer engagement automation platform that offers powerful analytics features. Kissmetrics provides behavioural analytics, segmentation and email campaign automation. 

    Key features

    • Create cohorts based on demographics, user behaviour, referral sources, events and specific time frames.
    • The user path tool provides path visualisation so you can identify common paths users take and spot abandonment points. 
    • Create and optimise conversion funnels.
    • Customise events, user properties, funnels, segments, cohorts and more.

    Pros

    • Powerful data visualisation options
    • Highly customisable

    Cons

    • Difficult to install
    • Not well-suited for small businesses
    • Limited integration with other tools

    Price : Starting at £21/month for 10k events (billed monthly).

    Improve your cohort analysis with Matomo

    When choosing a cohort analysis tool, consider factors such as the tool’s ease of integration with your existing systems, data accuracy, the flexibility it offers in defining cohorts, the comprehensiveness of reporting features, and its scalability to accommodate the growth of your data and analysis needs over time. Moreover, it’s essential to confirm GDPR compliance to uphold rigorous privacy standards. 

    If you’re ready to understand your user’s behaviour, take Matomo for a test drive. Paired with web analytics, this powerful combination can advance your marketing efforts. Start your 21-day free trial today — no credit card required.