Recherche avancée

Médias (1)

Mot : - Tags -/MediaSPIP 0.2

Autres articles (66)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

Sur d’autres sites (5565)

  • Getting and decoding video by RTP H264

    29 novembre 2023, par AlekseiKraev

    Parsing RTP H264.
WINAPI C. A queue from C++ has been applied, I repent.

    


    RTP is generated using FFMPEG with the following command :
ffmpeg.exe -f gdigrab -framerate 25 -i desktop -s 853x480 -b:v 120000 -c:v libx264 -f rtp rtp ://127.0.0.1:8080

    


    Parsing the incoming RTP/h264 stream and converting it to an RGB matrix.

    


    video_H264_decode.h

    


    #pragma once
#ifndef _VIDEO_H264_DECODE_SEND_H // Блокируем повторное включение этого модуля
#define _VIDEO_H264_DECODE_SEND_H
//******************************************************************************
// Section include
//******************************************************************************
#include "main.h"
#include 
//******************************************************************************
// Constants
//******************************************************************************

//******************************************************************************
// Type
//******************************************************************************
typedef struct {
    unsigned char* data;
    int size;
}RTPData_DType;

typedef struct 
{
    union
    {
        struct
        {
            char V:2;               //Версия
            char P:1;               //заполнение
            char X:1;               //расширение
            char CC:4;              //количество CSRC

            char M:1;               //маркер (флаг последнего пакета AU),
            char PT:7;              //полезная нагрузка (тип данных носителя полезной нагрузки RTP, H264 = 96)

            short sequence_number;  //Порядковый номер: порядковый номер пакета RTP, увеличенный на 1.
            int time_stamp;         //временная метка выборки медиа. 
            int SSRC;               //Пакет данных имеет одинаковое происхождение.
        };
        unsigned char data[12];
    };
}RTPHeader_DType;
//******************************************************************************
// Global var
//******************************************************************************

//******************************************************************************
// Local function prototype
//******************************************************************************
UCHAR rtp_H264_recive_init(void);
UCHAR RTPStop(void);
//******************************************************************************
// Macros
//******************************************************************************
#define BYTE2_SWAP(X)   ((((short)(X) & 0xff00) >> 8) |(((short)(X) & 0x00ff) << 8))
#endif
//******************************************************************************
// ENF OF FILE
//******************************************************************************


    


    video_H264_decode.c

    


    //******************************************************************************&#xA;//include&#xA;//******************************************************************************&#xA;#include "main.h"&#xA;/*#include "video_H264_decode.h"&#xA;#include &#xA;#include &#xA;#include <chrono>&#xA;#include &#xA;&#xA;#pragma comment(lib, "ws2_32.lib")&#xA;#include */&#xA;#include <iostream>&#xA;#include <queue>&#xA;&#xA;extern "C" {&#xA;#include "libavformat/avformat.h"&#xA;#include "libavfilter/avfilter.h"&#xA;#include "libavdevice/avdevice.h"&#xA;#include "libswscale/swscale.h"&#xA;#include "libswresample/swresample.h"&#xA;#include "libpostproc/postprocess.h"&#xA;#include "libavcodec/avcodec.h"&#xA;}&#xA;&#xA;#pragma comment(lib,"avcodec.lib")&#xA;#pragma comment(lib,"avdevice.lib")&#xA;#pragma comment(lib,"avfilter.lib")&#xA;#pragma comment(lib,"avformat.lib")&#xA;#pragma comment(lib,"avutil.lib")&#xA;#pragma comment(lib,"postproc.lib")&#xA;#pragma comment(lib,"swresample.lib")&#xA;#pragma comment(lib,"swscale.lib")&#xA;&#xA;#pragma warning(disable: 4996)&#xA;//******************************************************************************&#xA;// Section for determining the variables used in the module&#xA;//******************************************************************************&#xA;//------------------------------------------------------------------------------&#xA;// Global&#xA;//------------------------------------------------------------------------------&#xA;&#xA;//------------------------------------------------------------------------------&#xA;// Local&#xA;//------------------------------------------------------------------------------&#xA;const int inteval = 0x01000000;&#xA;BOOL FlagRTPActive = TRUE;&#xA;&#xA;HANDLE hMutexRTPRecive;&#xA;HANDLE hSemaphoreRTP;&#xA;HANDLE hTreadRTPRecive;&#xA;HANDLE hTreadRTPDecode;&#xA;&#xA;&#xA;SOCKET RTPSocket; //socket UDP RTP&#xA;RTPData_DType packet;&#xA;RTPData_DType FU_buffer = { 0 };&#xA;&#xA;std::queue q;&#xA;std::set<int> seq;&#xA;&#xA;AVFormatContext* pAVFormatContext;&#xA;AVCodecContext* pAVCodecContext;&#xA;const AVCodec* pAVCodec;&#xA;AVFrame* pAVFrame;&#xA;AVFrame* AVFrameRGG;&#xA;SwsContext* pSwsContext;&#xA;AVPacket *pAVPacket;&#xA;AVCodecParserContext* pAVCodecParserContext;&#xA;&#xA;UINT port;&#xA;//******************************************************************************&#xA;// Section of prototypes of local functions&#xA;//******************************************************************************&#xA;DWORD WINAPI rtp_H264_recive_Procedure(CONST LPVOID lpParam);&#xA;DWORD WINAPI rtp_decode_Procedure(CONST LPVOID lpParam);&#xA;char RTPSocketInit(void);&#xA;void RTPPacketParser(void);&#xA;char RTPSocketRecive(void);&#xA;void Decode_NaluToAVFrameRGG();&#xA;//******************************************************************************&#xA;// Section of the description of functions&#xA;//******************************************************************************&#xA;UCHAR rtp_H264_recive_init(void)&#xA;{&#xA;    hSemaphoreRTP = CreateSemaphore(&#xA;        NULL,           // default security attributes&#xA;        0,              // initial count&#xA;        1,              // maximum count&#xA;        NULL);          // unnamed semaphore&#xA;&#xA;    hMutexRTPRecive = CreateMutex(&#xA;        NULL,              // default security attributes&#xA;        FALSE,             // initially not owned&#xA;        NULL);             // unnamed mutex&#xA;&#xA;    hTreadRTPRecive = CreateThread(NULL, NULL, rtp_H264_recive_Procedure, NULL, NULL, NULL);&#xA;    hTreadRTPDecode = CreateThread(NULL, NULL, rtp_decode_Procedure, NULL, NULL, NULL);&#xA;&#xA;    return 0;&#xA;}&#xA;//------------------------------------------------------------------------------&#xA;UCHAR RTPStop(void)&#xA;{&#xA;    FlagRTPActive = FALSE;&#xA;&#xA;    if (hSemaphoreRTP) CloseHandle(hSemaphoreRTP);&#xA;    if (hMutexRTPRecive) CloseHandle(hMutexRTPRecive);&#xA;    if (hTreadRTPRecive) CloseHandle(hTreadRTPRecive);&#xA;&#xA;    closesocket(RTPSocket);  &#xA;&#xA;    return 0;&#xA;}&#xA;//------------------------------------------------------------------------------&#xA;DWORD WINAPI rtp_H264_recive_Procedure(CONST LPVOID lpParam)&#xA;{&#xA;    while (RTPSocketInit() == 0)&#xA;        Sleep(2000);&#xA;       &#xA;    while (1)&#xA;    {&#xA;        RTPSocketRecive();&#xA;        RTPPacketParser();&#xA;        ReleaseSemaphore(hSemaphoreRTP, 1, NULL);&#xA;    }&#xA;}&#xA;//------------------------------------------------------------------------------&#xA;DWORD WINAPI rtp_decode_Procedure(CONST LPVOID lpParam)&#xA;{&#xA;    port = param.Option.VideoPort;&#xA;&#xA;    pAVPacket = av_packet_alloc();&#xA;    if (!pAVPacket)&#xA;    {&#xA;        MessageBox(NULL, L"ERROR Could not allocate pAVPacket", L"Init decoder error", MB_OK | MB_ICONERROR);&#xA;        exit(1);&#xA;    }&#xA;    av_init_packet(pAVPacket);&#xA;&#xA;    /* find the MPEG-1 video decoder */&#xA;    pAVCodec = avcodec_find_decoder(AV_CODEC_ID_H264);&#xA;    if (!pAVCodec)&#xA;    {&#xA;        MessageBox(NULL, L"ERROR Codec not found", L"Init decoder error", MB_OK | MB_ICONERROR);&#xA;        exit(1);&#xA;    }&#xA;&#xA;    pAVCodecParserContext = av_parser_init(pAVCodec->id);&#xA;    if (!pAVCodecParserContext)&#xA;    {&#xA;        MessageBox(NULL, L"ERROR Parser not found", L"Init decoder error", MB_OK | MB_ICONERROR);&#xA;        exit(1);&#xA;    }&#xA;&#xA;    pAVCodecContext = avcodec_alloc_context3(pAVCodec);&#xA;    if (!pAVCodecContext) &#xA;    {&#xA;        MessageBox(NULL, L"ERROR Could not allocate video codec context", L"Init decoder error", MB_OK | MB_ICONERROR);&#xA;        exit(1);&#xA;    }&#xA;               &#xA;    if (avcodec_open2(pAVCodecContext, pAVCodec, NULL) &lt; 0)&#xA;    {&#xA;        MessageBox(NULL, L"ERROR Could not open codec", L"Init decoder error", MB_OK | MB_ICONERROR);&#xA;        exit(1);&#xA;    }&#xA;&#xA;    pAVFrame = av_frame_alloc();&#xA;    if (!pAVFrame) &#xA;    {&#xA;        MessageBox(NULL, L"ERROR Could not allocate video frame", L"Init decoder error", MB_OK | MB_ICONERROR);&#xA;        exit(1);&#xA;    }    &#xA;    &#xA;    while (FlagRTPActive)&#xA;    {&#xA;        if(port != param.Option.VideoPort)&#xA;            closesocket(RTPSocket);&#xA;&#xA;        WaitForSingleObject(hSemaphoreRTP, 500);        &#xA;        Decode_NaluToAVFrameRGG();&#xA;    }&#xA;&#xA;    avformat_free_context(pAVFormatContext);&#xA;    av_frame_free(&amp;pAVFrame);&#xA;    avcodec_close(pAVCodecContext);&#xA;    av_packet_free(&amp;pAVPacket);&#xA;&#xA;    &#xA;    if (hTreadRTPDecode) CloseHandle(hTreadRTPDecode);&#xA;&#xA;    return 0;&#xA;}&#xA;&#xA;//------------------------------------------------------------------------------&#xA;char RTPSocketInit(void)&#xA;{    &#xA;    sockaddr_in RTPSocketAddr;&#xA;    &#xA;    RTPSocketAddr.sin_family = AF_INET;&#xA;    RTPSocketAddr.sin_addr.s_addr = htonl(INADDR_ANY);&#xA;    RTPSocketAddr.sin_port = htons(param.Option.VideoPort);&#xA;&#xA;    RTPSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);&#xA;    if (RTPSocket == INVALID_SOCKET)&#xA;    {&#xA;        MessageBox(NULL, L"ERROR Invalid RTP Socket", L"UDP Socket", MB_OK | MB_ICONERROR);&#xA;        return 0;&#xA;    }&#xA;&#xA;    int option = 12000;&#xA;    if (setsockopt(RTPSocket, SOL_SOCKET, SO_RCVBUF, (char*)&amp;option, sizeof(option)) &lt; 0)&#xA;    {&#xA;        printf("setsockopt failed\n");&#xA;&#xA;    }&#xA;&#xA;    /*option = TRUE;&#xA;    if (setsockopt(RTPSocket, SOL_SOCKET, SO_CONDITIONAL_ACCEPT, (char*)&amp;option, sizeof(option)) &lt; 0)&#xA;    {&#xA;        printf("setsockopt failed\n");&#xA;&#xA;    }*/&#xA;&#xA;    if (bind(RTPSocket, (sockaddr*)&amp;RTPSocketAddr, sizeof(RTPSocketAddr)) == SOCKET_ERROR)&#xA;    {&#xA;        MessageBox(NULL, L"ERROR bind", L"UDP Socket", MB_OK | MB_ICONERROR);&#xA;        closesocket(RTPSocket);&#xA;        return 0;&#xA;    }&#xA;    return 1;&#xA;}&#xA;&#xA;//------------------------------------------------------------------------------&#xA;char RTPSocketRecive(void)&#xA;{&#xA;    static char RecvBuf[2000];&#xA;    static int BufLen = 2000;&#xA;&#xA;    int iResult = 0;&#xA;    struct sockaddr_in SenderAddr;&#xA;    int SenderAddrSize = sizeof(SenderAddr);&#xA;    TCHAR szErrorMsg[100];&#xA;&#xA;    iResult = recvfrom(RTPSocket, RecvBuf, BufLen, 0, NULL, NULL);&#xA;    if (iResult == SOCKET_ERROR &amp;&amp; FlagRTPActive == TRUE)&#xA;    {&#xA;        StringCchPrintf(szErrorMsg, 100, L"ERROR recvfrom Ошибка:%d", WSAGetLastError());&#xA;        MessageBox(NULL, szErrorMsg, L"UDP Socket", MB_OK | MB_ICONERROR);&#xA;        return -1;&#xA;    }&#xA;&#xA;    packet.data = (unsigned char*)RecvBuf;&#xA;    packet.size = iResult;&#xA;&#xA;    return 1;&#xA;}&#xA;&#xA;//------------------------------------------------------------------------------&#xA;void RTPPacketParser(void)&#xA;{&#xA;    RTPHeader_DType RTPHeader;&#xA;    RTPData_DType NALU;&#xA;    unsigned char* buffer = packet.data;&#xA;    int pos = 0;&#xA;    static int count = 0;&#xA;    static short lastSequenceNumber = 0xFFFF;&#xA;    short type;&#xA;    char payload_header;&#xA;&#xA;    //read rtp header&#xA;    memcpy(&amp;RTPHeader, buffer, sizeof(RTPHeader));&#xA;    RTPHeader.sequence_number = BYTE2_SWAP(RTPHeader.sequence_number);&#xA;    pos &#x2B;= 12;    &#xA;  &#xA;    if (RTPHeader.X) {&#xA;        //profile extension&#xA;        short define;&#xA;        short length;&#xA;        length = buffer[pos &#x2B; 3];//suppose not so long extension&#xA;        pos &#x2B;= 4;&#xA;        pos &#x2B;= (length * 4);&#xA;    }&#xA;&#xA;    payload_header = buffer[pos];&#xA;    type = payload_header &amp; 0x1f; //Тип полезной нагрузки RTP&#xA;    pos&#x2B;&#x2B;;&#xA;    &#xA;    //STAP-A&#xA;    if (type == 24)&#xA;    {        &#xA;        while (pos &lt; packet.size)&#xA;        {&#xA;            unsigned short NALU_size;&#xA;            memcpy(&amp;NALU_size, buffer &#x2B; pos, 2);&#xA;            NALU_size = BYTE2_SWAP(NALU_size);&#xA;            pos &#x2B;= 2;&#xA;            char NAL_header = buffer[pos];&#xA;            short NAL_type = NAL_header &amp; 0x1f;&#xA;&#xA;            if (NAL_type == 7) &#xA;            {&#xA;                count&#x2B;&#x2B;;&#xA;                //cout&lt;&lt;"SPS, sequence number: "&lt;/cout&lt;&lt;"PPS, sequence number: "&lt;/cout&lt;&lt;"end of sequence, sequence number: "&lt; 0) &#xA;            {&#xA;                NALU.data = (unsigned char*) malloc(NALU_size &#x2B; 4);&#xA;                NALU.size = NALU_size &#x2B; 4;&#xA;                memcpy(NALU.data, &amp;inteval, 4);&#xA;                memcpy(NALU.data &#x2B; 4, &amp;buffer[pos], NALU_size);&#xA;&#xA;                WaitForSingleObject(hMutexRTPRecive, INFINITE);&#xA;                q.push(NALU);&#xA;                ReleaseMutex(hMutexRTPRecive);&#xA;            }&#xA;&#xA;            pos &#x2B;= NALU_size;&#xA;        }&#xA;    }&#xA;    //FU-A Fragmentation unit&#xA;    else if (type == 28)&#xA;    {        &#xA;        //FU header&#xA;        char FU_header = buffer[pos];&#xA;        bool fStart = FU_header &amp; 0x80;&#xA;        bool fEnd = FU_header &amp; 0x40;&#xA;&#xA;        //NAL header&#xA;        char NAL_header = (payload_header &amp; 0xe0) | (FU_header &amp; 0x1f);&#xA;        short NAL_type = FU_header &amp; 0x1f;&#xA;        if (NAL_type == 7) &#xA;        {&#xA;            count&#x2B;&#x2B;;&#xA;            //SPS&#xA;        }&#xA;        else if (NAL_type == 8) &#xA;        {&#xA;            //PPS&#xA;        }&#xA;        else if (NAL_type == 10) &#xA;        {&#xA;            //end of sequence&#xA;        }&#xA;        pos&#x2B;&#x2B;;&#xA;&#xA;        int size = packet.size - pos;&#xA;        &#xA;        if (count > 0)&#xA;        {&#xA;            if (fStart) &#xA;            {&#xA;                if (FU_buffer.size != 0)&#xA;                {&#xA;                    free(FU_buffer.data);&#xA;                    FU_buffer.size = 0;&#xA;                }&#xA;                FU_buffer.data = (unsigned char*)malloc(size &#x2B; 5);&#xA;                if (FU_buffer.data == NULL)&#xA;                    return;&#xA;                FU_buffer.size = size &#x2B; 5;&#xA;                memcpy(FU_buffer.data, &amp;inteval, 4);&#xA;                memcpy(FU_buffer.data &#x2B; 4, &amp;NAL_header, 1);&#xA;                memcpy(FU_buffer.data &#x2B; 5, buffer &#x2B; pos, size);&#xA;            }&#xA;            else&#xA;            {&#xA;                unsigned char* temp = (unsigned char*)malloc(FU_buffer.size &#x2B; size);&#xA;                memcpy(temp, FU_buffer.data, FU_buffer.size);&#xA;                memcpy(temp &#x2B; FU_buffer.size, buffer &#x2B; pos, size);&#xA;                if (FU_buffer.size != 0) free(FU_buffer.data);&#xA;                FU_buffer.data = temp;&#xA;                FU_buffer.size &#x2B;= size;&#xA;            }&#xA;&#xA;            if (fEnd)&#xA;            {&#xA;                NALU.data = (unsigned char*)malloc(FU_buffer.size);&#xA;                NALU.size = FU_buffer.size;&#xA;                memcpy(NALU.data, FU_buffer.data, FU_buffer.size);&#xA;&#xA;                WaitForSingleObject(hMutexRTPRecive, INFINITE);&#xA;                q.push(NALU);&#xA;                ReleaseMutex(hMutexRTPRecive);&#xA;&#xA;                free(FU_buffer.data);&#xA;                FU_buffer.size = 0;&#xA;            }&#xA;        }&#xA;        &#xA;    }&#xA;    else &#xA;    {&#xA;        //other type&#xA;        short NAL_type = type;&#xA;        if (NAL_type == 7) &#xA;        {&#xA;            count&#x2B;&#x2B;;&#xA;            //SPS&#xA;        }&#xA;        else if (NAL_type == 8) &#xA;        {&#xA;            //PPS&#xA;        }&#xA;        else if (NAL_type == 10) &#xA;        {&#xA;            //end of sequence&#xA;        }&#xA;&#xA;        int size = packet.size - pos &#x2B; 1;&#xA;        if (count > 0)&#xA;        {&#xA;            NALU.data = (unsigned char*)malloc(size&#x2B;4);&#xA;            NALU.size = size &#x2B; 4;&#xA;            memcpy(NALU.data, &amp;inteval, 4);&#xA;            memcpy(NALU.data &#x2B; 4, &amp;buffer[12], size);&#xA;&#xA;            WaitForSingleObject(hMutexRTPRecive, INFINITE);&#xA;            q.push(NALU);&#xA;            ReleaseMutex(hMutexRTPRecive);&#xA;        }&#xA;    }&#xA;}&#xA;&#xA;//------------------------------------------------------------------------------&#xA;void Decode_NaluToAVFrameRGG()&#xA;{&#xA;    unsigned char cntNALU;&#xA;    int len = 0;&#xA;    static int size = 0;&#xA;    unsigned char* data = NULL;&#xA;    int ret;&#xA;    RTPData_DType NALU;&#xA;&#xA;    av_frame_unref(pAVFrame);&#xA;    av_packet_unref(pAVPacket);&#xA;&#xA;    while(1)&#xA;    {&#xA;        WaitForSingleObject(hMutexRTPRecive, INFINITE);&#xA;        if (q.empty())&#xA;        {&#xA;            ReleaseMutex(hMutexRTPRecive);&#xA;            break;&#xA;        }&#xA;        NALU = q.front();&#xA;        q.pop();&#xA;        ReleaseMutex(hMutexRTPRecive);&#xA;&#xA;        data = NALU.data;&#xA;        size = NALU.size;&#xA;&#xA;        while(size)&#xA;        {            &#xA;            len = av_parser_parse2(pAVCodecParserContext, pAVCodecContext, &amp;pAVPacket->data, &amp;pAVPacket->size,&#xA;                (uint8_t*)data, size,&#xA;                AV_NOPTS_VALUE, AV_NOPTS_VALUE, AV_NOPTS_VALUE);&#xA;&#xA;            data = len ? data &#x2B; len : data;&#xA;            size -= len;&#xA;            &#xA;            if (pAVPacket->size)&#xA;            {&#xA;                ret = avcodec_send_packet(pAVCodecContext, pAVPacket);&#xA;&#xA;                if(ret == AVERROR_EOF)&#xA;                    MessageBox(NULL, L"the codec has been fully flushed, and there will be no more output frames", L"avcodec_send_packet", MB_OK | MB_ICONERROR);&#xA;&#xA;                if (ret &lt; 0)&#xA;                {&#xA;                    MessageBox(NULL, L"ERROR sending a packet for decoding", L"Decode", MB_OK | MB_ICONERROR);&#xA;                    //exit(1);&#xA;                }&#xA;&#xA;                while (ret >= 0) &#xA;                {&#xA;                    ret = avcodec_receive_frame(pAVCodecContext, pAVFrame);&#xA;                    if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)&#xA;                        break;&#xA;                    else if (ret &lt; 0) {&#xA;                        MessageBox(NULL, L"ERROR during decoding", L"Decode", MB_OK | MB_ICONERROR);&#xA;                        //exit(1);&#xA;                    }&#xA;                    &#xA;                    AVFrameRGG = av_frame_alloc();                                       &#xA;                    pSwsContext = sws_getContext(pAVCodecContext->width, pAVCodecContext->height, pAVCodecContext->pix_fmt,&#xA;                        pAVCodecContext->width, pAVCodecContext->height, AV_PIX_FMT_RGB24, SWS_SPLINE,&#xA;                        0, 0, 0);&#xA;&#xA;                    sws_scale_frame(pSwsContext, AVFrameRGG, pAVFrame);&#xA;                                        &#xA;                    ImgBufferSet(AVFrameRGG->data[0], pAVCodecContext->height, pAVCodecContext->width, AVFrameRGG->linesize[0]);&#xA;&#xA;                    sws_freeContext(pSwsContext);&#xA;                    av_frame_free(&amp;AVFrameRGG);&#xA;                }&#xA;            }&#xA;        }&#xA;        free(NALU.data);&#xA;        NALU.size = 0;&#xA;    }    &#xA;}&#xA;&#xA;</int></queue></iostream></chrono>

    &#xA;

    It's DECIDED

    &#xA;

  • Conversion Rate Optimisation Statistics for 2024 and Beyond

    21 novembre 2023, par Erin — Analytics Tips

    Driving traffic to your website is only half the battle. The real challenge — once you’ve used a web analytics solution to understand how users behave — is turning more of those visitors into customers.

    That doesn’t happen by accident. You need to employ conversion rate optimisation strategies and tools to see even a small lift in conversion rates. The good news is that it doesn’t take much to see massive results. Raising your conversion rate from 1% to 3% can triple your revenue. 

    In even better news, you don’t have to guess at the best ways to improve your conversion rate. We’ve done the hard work and collected the most recent and relevant conversion rate optimisation statistics to help you. 

    General conversion rate optimisation statistics

    It appears the popularity of conversion rate optimisation is soaring. According to data collected by Google Trends, there were more people searching for the term “conversion rate optimization” in September 2023 than ever before. 

    As you can see from the chart below, the term’s popularity is on a clear upward trajectory, meaning even more people could be searching for it in the near future. (Source)

    More people searching for conversion rate optimization than ever before according to Google Trends data

    Do you want to know what the average landing page conversion rate is ? According to research by WordStream, the average website conversion rate across all industries is 2.35%

    That doesn’t paint the whole picture, however. Better-performing websites have significantly higher conversion rates. The top 25% of websites across all industries convert at a rate of 5.31% or higher. (Source)

    Let’s break things down by industry now. The Unbounce Conversion Benchmark Report offers a detailed analysis of how landing pages convert across various industries.

    First, we have the Finance and Insurance industry, which boasts a conversion rate of 15.6%. 

    On the other end, agencies appears to be one of the worst-performing. Agencies’ landing pages convert at a rate of 8.8%. (Source)

    The average landing page conversion rates across industries

    What about the size of the conversion rate optimisation industry ? Given the growth in popularity of the term in Google, surely the industry is experiencing growth, right ?

    You’d be correct in that assumption. The conversion rate optimisation software market was valued at $771.2 million in 2018 and is projected to reach $1.932 billion by 2026 — a compound annual growth rate (CAGR) of 9.6%.

    Statistics on the importance of conversion rate optimisation

    If you’re reading this article, you probably think conversion rate optimisation is pretty important. But do you know its importance and where it ranks in your competitors’ priorities ? Read on to find out. 

    Bounce rate — the number of people who leave your website without visiting another page or taking action — is the scourge of conversion rate optimisation efforts. Every time someone bounces from your site, you lose the chance to convert them.

    The questions, then, are : how often do people bounce on average and how does your bounce rate compare ? 

    Siege Media analysed over 1.3 billion sessions from a range of traffic sources, including 700 million bounces, to calculate an average bounce rate of 50.9%. (Source)

    The average bounce rate is 50.9%

    Bounce rates vary massively from website to website and industry to industry, however. Siege Media’s study unveils an array of average bounce rates across industries :

    • Travel – 82.58%
    • B2B – 65.17%
    • Lifestyle – 64.26%
    • Business and Finance – 63.51%
    • Healthcare – 59.50%
    • eCommerce – 54.54%
    • Insurance – 45.96%
    • Real Estate – 40.78%

    It won’t come as much of a surprise to learn that marketers are determined to reduce bounce rates and improve lead conversion. Today’s marketers are highly performance-based. When asked about their priorities for the coming year, 79% of marketers said their priority was generating quality qualified leads — the most popular answer in the survey. (Source)

    Just because it is a priority for marketers doesn’t mean that everyone has their stuff together. If you have a conversion rate optimisation process in place, you’re in the minority. According to research by HubSpot, less than one in five marketers (17%) use landing page A/B tests to improve their conversion rates. (Source)

    When it comes to personalisation strategies – a common and effective tool to increase conversion rates — the picture isn’t any rosier. Research by Salesforce found just over one-quarter of markets are confident their organisation has a successful strategy for personalisation. (Source)

    Conversion rate optimisation tactics statistics

    There are hundreds of ways to improve your website’s conversion rates. From changing the color of buttons to the structure of your landing page to your entire conversion funnel, in this section, we’ll look at the most important statistics you need to know when choosing tactics and building your own CRO experiments. 

    If you are looking for the best method to convert visitors, then email lead generation forms are the way to go, according to HubSpot. This inoffensive and low-barrier data collection method boasts a 15% conversion rate, according to the marketing automation company’s research. (Source)

    Where possible, make your call-to-actions personalised. Marketing personalisation, whether through behavioral segmentation or another strategy, is an incredibly powerful way of showing users that you care about their specific needs. It’s no great surprise, then, that HubSpot found personalised calls-to-actions perform a whopping 202% better than basic CTAs. (Source)

    If you want to boost conversion rates, then it’s just as important to focus on quantity as well as quality. Yes, a great-looking, well-written landing page will go a long way to improving your conversion rate, but having a dozen of these pages will do even more. 

    Research by HubSpot found companies see a 55% increase in leads when they increase the number of landing pages from 10 to 15. What’s more, companies with over 40 landing pages increase conversion by more than 500%. (Source)

    Companies with more than 40 landing pages increase conversions by over 500%

    User-generated content (UGC) should also be high on your priority list to boost conversion rates. Several statistics show how powerful, impactful and persuasive social proof like user reviews can be. 

    Research shows that visitors who scroll to the point where they encounter user-generated content increase the likelihood they convert by a staggering 102.4%. (Source)

    Other trust signs can be just as impactful. Research by Trustpilot found that the following four trust signals make consumers more likely to make a purchase when shown on a product page :

    • Positive star rating and reviews (85% more likely to make a purchase)
    • Positive star rating (78%)
    • Positive customer testimonials (82%)
    • Approved or authorised seller badge (76%)

    (Source)

    Showing ratings and reviews has also increased conversion rates by 38% on home appliances and electronics stores. (Source)

    And no wonder, given that consumers are more likely to buy from brands they trust than brands they love, according to the 2021 Edelman Trust Barometer Special Report. (Source

    A lack of trust is also one of the top four reasons consumers abandon their shopping cart at checkout. (Source

    Traffic source conversion rate statistics

    What type of traffic works the best when it comes to conversions, or how often you should be signing up users to your mailing list ? Let’s look at the stats to find out. 

    Email opt-ins are one of the most popular methods for collecting customer information — and an area where digital marketers spend a lot of time and effort when it comes to conversion rate optimisation. So, what is the average conversion rate of an email opt-in box ?

    According to research by Sumo — based on 3.2 billion users who have seen their opt-in boxes — the average email opt-in rate is 1.95%. (Source)

    Search advertising is an effective way of driving website traffic, but how often do those users click on these ads ?

    WordStream’s research puts the average conversion of search advertising for all industries at 6.11%. (Source)

    The arts and entertainment industry enjoys the highest clickthrough rates (11.78%), followed by sports and recreation (10.53%) and travel (10.03%). Legal services and the home improvement industry have the lowest clickthrough rates at 4.76% and 4.8%, respectively.

    The average clickthrough rate of search advertising for each industry
    (Source)

    If you’re spending money on Google ads, then you’d better hope a significant amount of users convert after clicking them. 

    Unfortunately, conversion rates from Google ads decreased year-on-year for most industries in 2023, according to research by WordStream — in some cases, those decreases were significant. The only two industries that didn’t see a decrease in conversion rates were beauty and personal care and education and instruction. (Source)

    The average conversion rate for search ads across all industries is 7.04%. The animal and pet niche has the highest conversion rate (13.41%), while apparel, fashion and jewelry have the lowest conversion rate (1.57%). (Source)

    What about other forms of traffic ? Well, there’s good reason to try running interstitial ads on smartphone apps if you aren’t already. Ads on the iOS app see a 14.3 percent conversion rate on average. (Source)

    E-commerce conversion rate optimisation statistics (400 words)

    Conversion rate optimisation can be the difference between a store that sets new annual sales records and one struggling to get by. 

    The good news is that the conversion rate among US shoppers was the highest it’s ever been in 2021, with users converting at 2.6%. (Source)

    If you have a Shopify store, then you may find conversion rates a little lower. A survey by Littledata found the average conversion rate for Shopify was 1.4% in September 2022. (Source)

    What about specific e-commerce categories ? According to data provided by Dynamic Yield, the consumer goods category converted at the highest rate in September 2023 (4.22%), a spike of 0.34% from August. 

    Generally, the food and beverage niche boasts the highest conversion rate (4.87%), and the home and furniture niche has the lowest conversion rate (1.44%). (Source)

    If you’re serious about driving sales, don’t focus on mobile devices at the expense of consumers who shop on desktop devices. The conversion rate among US shoppers tends to be higher for desktop users than for mobile users. 

    The conversion rate among US online shoppers is generally higher for desktop than

    In the second quarter of 2022, for instance, desktop shoppers converted at a rate of 3% on average compared to smartphone users who converted at an average rate of 2%. (Source)

    Increase your conversions with Matomo

    Conversion rate optimisation can help you grow your subscriber list, build your customer base and increase your revenue. Now, it’s time to put what you’ve learned into practice.

    Use the advice above to guide your experiments and track everything with Matomo. Achieve unparalleled data accuracy while harnessing an all-in-one solution packed with essential conversion optimisation features, including Heatmaps, Session Recordings and A/B Testing. Matomo makes it easier than ever to analyse conversion-focused experiments.

    Get more from your conversion rate optimisations by trying Matomo free for 21 days. No credit card required.

  • CRO Testing : The 6-Steps for Maximising Conversion Rates

    10 mars 2024, par Erin

    It’s a nightmare every marketing manager faces. Traffic is soaring after you’ve launched new digital marketing campaigns, but conversions have barely moved.

    Sound familiar ?

    The good news is you’re not alone — loads of marketing managers struggle to get potential customers to purchase. The better news is that you can test dozens of strategies to turn around your site’s fortunes. 

    Conversion rate optimisation testing (CRO testing for short) is the name for this kind of experimentation — and it can send conversion rates and revenue soaring.

    In this article, we’ll explain CRO testing and how you can start doing it today using Matomo. 

    What is CRO Testing ? 

    CRO testing is optimising your site’s conversion funnel using a series of experiments designed to improve conversion rates.

    A CRO test can take several forms, but it usually involves changing one or more elements of your landing page. It looks something like this :

    1. You hypothesise what you expect to happen.
    2. You then run an A/B test using a dedicated CRO platform or tool.
    3. This tool will divide your site’s traffic, sending one segment to one variation and the other segment to another.
    4. The CRO tool will measure conversions, track statistical significance, and declare one variation the winner. 

    A CRO tool isn’t the only software you can use to gather data when running tests. There are several other valuable data sources, including :

    • A web analytics platform : to identify issues with your website
    • User surveys : to find out what your target audience thinks about your site
    • Heatmaps : to learn where users focus their attention
    • Session recordings : to discover how visitors browse your site

    Use as many of these features, tools, and methods as you can when brainstorming hypotheses and measuring results. After all, your CRO test is only as good as your data.

    On that note, we need to mention the importance of data accuracy when researching issues with your website and running CRO tests. If you trust a platform like Google Analytics that uses data sampling (where only a subset of data is analysed), then there’s a risk you make business decisions based on inaccurate reports.

    In practice, that could see you overestimate the effectiveness of a landing page, potentially wasting thousands in ad spend on poorly converting pages. 

    That’s why over a million websites rely on Matomo as their web analytics solution—it doesn’t sample data, providing 100% accurate website traffic insights you can trust to make informed decisions.

    Try Matomo for Free

    Get the web insights you need, without compromising data accuracy.

    No credit card required

    Types of CRO Testing 

    There are three core types of CRO tests :

    A/B testing

    A/B testing, or split testing, is when you test two versions of the same page against each other. Usually, the two pages have only one difference, such as a new headline or a different CTA. 

    An A/B test setup in Matomo

    In the test above, for example, we test what happens if we remove one of the affiliate links from a page. We hypothesise that conversions won’t change because these links aren’t effective.

    A/B/n testing

    A/B/n testing is when you test multiple variations of the same element on the same page. 

    Rather than just testing one headline against another, for example, you test multiple different headlines at once.

    A screenshot of A/B test results run using Matomo

    In the test above in Matomo, we’re testing a website’s original header against a wider and smaller version. It turns out the wider header converts significantly better. 

    Multivariate testing

    In a multivariate CRO test, you test multiple different elements at the same time. That could mean testing combining a different headline, CTA button, and image. 

    Multivariate testing can save time because you test multiple elements at once and find the best combination of elements. But you’ll usually need a lot of traffic to find a statistically significant result.

    Why is CRO testing important ?

    Who doesn’t want more conversions, right ? Improving your conversion rate is the core benefit of running a CRO test, but there are a couple of other reasons you should do it, too :

    Why Is CRO Testing Important?

    Improve conversion rates

    How well does your website convert visitors ? The average conversion rate of a typical website is 2.35%, but better-performing websites have significantly higher conversion rates. The top 25% of websites across all industries convert at a rate of 5.31% or higher.

    CRO testing is the best way to improve your site’s conversion rate by tweaking elements of your website and implementing the best results. And because it’s based on data, not your intuition, you’re likely to identify changes that move the needle. 

    Optimise the user experience

    CRO tests are also a great way to improve your site’s user experience. The process of CRO testing forces you to understand how users navigate your website using heatmaps and session recordings and fix the issues they face. 

    You could simplify your form fields to make them easier to fill in, for example, or make your pages easier to navigate. In both cases, your actions will also increase conversion rates.

    Decrease acquisition costs

    Improving your conversion rate using CRO testing will usually mean a decrease in customer acquisition costs and other conversion metrics

    After all, if the cost of your PPC ads stays the same but you convert more traffic, then each new customer will cost less to acquire.

    How to do CRO testing in 6 steps 

    Ready to get your hands dirty ? Follow these six steps to set up your first CRO test :

    Have a clear goal

    Don’t jump straight into testing. You need to be clear about what you want to achieve ; otherwise, you risk wasting time on irrelevant experiments. 

    If you’re unsure what to focus on, look back through your web analytics data and other tools like heatmaps, form analytics, and session recordings to get a feel for some of your site’s biggest conversion roadblocks. 

    Maybe there’s a page with a much lower conversion rate, for example — or a form that most users fail to complete. 

    If it’s the former, then your goal could be to increase the conversion rate of this specific landing page by 25%, bringing it in line with your site’s average. 

    The Goals dashboard in Matomo

    Make sure your new conversion goal is set up properly in your website analytics platform, too. This will ensure you’re tracking conversions accurately. 

    Set a hypothesis

    Now you’ve got a goal, it’s time to create a hypothesis. Based on your available research, a hypothesis is an assumption you make about your conversion rate optimisation test.

    A heatmap of your poorly converting landing page may show that users aren’t focusing on your CTA button because it’s hidden below the fold. 

    You could hypothesise that by placing the CTA button directly under your headline above the fold, your conversion rate should increase. 

    Whatever your goal, you can use the following template to write a hypothesis :

    If we [make this specific change], then [this specific outcome] will occur because [reason].

    Design your test elements

    Most marketing managers won’t be able to run CRO tests independently. A team of talented experts must create the assets you need for a successful experimentation. This includes designers, copywriters, and web developers. 

    Don’t just have them create one new element at a time. Accelerate the process by having your team create dozens of designs simultaneously. That way, you can run a new CRO test as soon as your current test has finished. 

    Create and launch the test

    It’s time to launch your test. Use a CRO tool to automate building your test and tracking results. 

    With Matomo’s A/B Testing feature, it’s as easy as giving your test a name, writing a hypothesis and description, and uploading the URLs of your page variants.

    How to create a new A/B test in Matomo

    Matomo handles everything else, giving you a detailed breakdown at the end of the test with the winning variant. 

    Try Matomo for Free

    Get the web insights you need, without compromising data accuracy.

    No credit card required

    Analyse the results

    You can only review the results of your CRO test once it has reached statistical significance — which means the observed outcome isn’t the result of chance.

    In the same way you wouldn’t say a die is unbiased after three rolls, you need thousands of visitors to see your landing pages and take action before deciding which is better. 

    Luckily, most CRO testing platforms, including Matomo, will highlight when a test reaches statistical significance. That means you only need to look at the result to see if your hypothesis is correct. 

    Implement and repeat

    Was your test a success ? Great, you can implement the results and test a new element. 

    Yep, that’s right. There’s no time to rest on your laurels. Continuous CRO testing is necessary to squeeze every conversion possible from your website. Just like fashion trends, website effectiveness changes over time. What works today might not work tomorrow, making ongoing CRO testing beneficial and necessary.

    That’s why it’s a good idea to choose a CRO testing platform like Matomo with no data limits.

    Try Matomo for Free

    Get the web insights you need, without compromising data accuracy.

    No credit card required

    CRO testing examples you can run today 

    There’s no shortage of CRO tests you can run. Here are some experiments to get started with :

    Change your CTA design and copy

    Calls to action (CTAs) are the best elements to optimise during your first CRO test. You can change many things about them ; even the smallest optimisation can have a huge impact. 

    Just take a look at the image below to see how diverse your CTAs could be :

    A range of different CTA buttons

    Changing your CTA’s copy is a great place to start, especially if you have generic instructions like “Apply Now.”

    Try a more specific instruction like “Download your free trial” or “Buy now to get 30% off.” Or test benefit-led instructions like “Reduce your ad spend today” or “Take back control of your data.”

    Changing the colour of your CTAs can also yield more conversions. Bright colours are always a good bet. Just make sure your button stands out from the rest of your page. 

    Move the CTA button placement

    The placement of your CTA can be just as important as its copy or colour. If it’s down at the bottom of your page, there’s a good chance most of your visitors will miss it. 

    Try moving it above the fold to see if that makes a difference. Then, test multiple CTA buttons as opposed to just one. 

    Heatmaps and session recordings can identify whether this test is worthwhile. If users rarely focus on your CTA or just don’t scroll far enough to find it, then it’s a good bet you could see an uptick in conversions by moving it. 

    Try different headlines

    Your website’s headlines are another great place to start CRO testing. These are usually the first (and sometimes only) things visitors read, so optimising them as much as possible makes sense. 

    There are entire books written about creating persuasive headlines, but start with one of the following tactics :

    • Include a benefit
      • “Achieve radiant skin—discover the secret !”
    • Add numbers
      • “3 foolproof methods for saving money on your next vacation”
    • Using negative words instead of positive ones
      • “Avoid these 7 mistakes to unlock your potential for personal growth”
    • Shortening or lengthening your headline
      • Shortened : “Crush your fitness goals : Expert tips for success”
      • Lengthened : “Embark on your fitness journey : Learn from experts with proven tips to crush your wellness goals”

    Add more trust signals

    Adding trust signals to your website, such as brand logos, customer reviews, and security badges, can increase your conversion rate.

    We use it at Matomo by adding the logos of well-known clients like the United Nations and Amnesty International underneath our CTAs.

    Trust signals on the Matomo website

    It’s incredibly effective, too. Research by Edelman finds that trust is among the top three most important buying decision factors, above brand likeability.

    Start CRO testing with Matomo

    CRO testing is a data-backed method to improve your site’s conversion rate, making it more user-friendly and decreasing customer acquisition costs. Even a small improvement will be worth the cost of the tools and your time. 

    Fortunately, there’s no need to allocate hundreds of dollars monthly for multiple specialised testing tools. With Matomo, you get a comprehensive platform offering web analytics, user behaviour insights, and CRO testing – all conveniently bundled into one solution. Matomo’s pricing starts from just $19 per month, making it accessible to businesses of all sizes.

    Plus, rest assured knowing that you are GDPR compliant and the data provided is 100% accurate, ethically empowering you to make informed decisions with confidence.

    Take the first step on your CRO testing journey by trying Matomo free for 21 days ; no credit card required.