Recherche avancée

Médias (91)

Autres articles (16)

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

  • Ajouter notes et légendes aux images

    7 février 2011, par

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

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

    Dans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
    Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)

Sur d’autres sites (3389)

  • x264 : Expose the NV21 input support

    1er août 2015, par Yu Xiaolei
    x264 : Expose the NV21 input support
    

    x264 build 147 adds the native support for NV21.

    Useful to avoid additional pixel format conversion when encoding
    from a wide range of capture devices, Android among those.

    Signed-off-by : Luca Barbato <lu_zero@gentoo.org>

    • [DBH] libavcodec/libx264.c
  • Ffmpeg program to stitch image side by side

    14 mars 2021, par Beyond Motivation

    So I have about 90-100 images which are of the resolution 1080x1920px. I want to make a program in ffmpeg that will join them as in stitch them side by side(horizontally), such that all the images combine to become a wide image. Can someone pls help me with a program for this ?

    &#xA;

  • How to encode Planar 4:2:0 (fourcc P010)

    20 juillet 2021, par DennisFleurbaaij

    I'm trying to recode fourcc V210 (which is a packed YUV4:2:2 format) into a P010 (planar YUV4:2:0). I think I've implemented it according to spec, but the renderer is giving a wrong image so something is off. Decoding the V210 has a decent example in ffmpeg (defines are modified from their solution) but I can't find a P010 encoder to look at what I'm doing wrong.

    &#xA;

    (Yes, I've tried ffmpeg and that works but it's too slow for this, it takes 30ms per frame on an Intel Gen11 i7)

    &#xA;

    Clarification (after @Frank's question) : The frames being processed are 4k (3840px wide) and hence there is no code for doing the 128b alignment.

    &#xA;

    This is running on intel so little endian conversions applied.

    &#xA;

    Try1 - all green image :

    &#xA;

    The following code

    &#xA;

    #define V210_READ_PACK_BLOCK(a, b, c) \&#xA;    do {                              \&#xA;        val  = *src&#x2B;&#x2B;;                \&#xA;        a = val &amp; 0x3FF;              \&#xA;        b = (val >> 10) &amp; 0x3FF;      \&#xA;        c = (val >> 20) &amp; 0x3FF;      \&#xA;    } while (0)&#xA;&#xA;#define PIXELS_PER_PACK 6&#xA;#define BYTES_PER_PACK (4*4)&#xA;&#xA;void MyClass::FormatVideoFrame(&#xA;    BYTE* inFrame,&#xA;    BYTE* outBuffer)&#xA;{&#xA;    const uint32_t pixels = m_height * m_width;&#xA;&#xA;    const uint32_t* src = (const uint32_t *)inFrame);&#xA;&#xA;    uint16_t* dstY = (uint16_t *)outBuffer;&#xA;&#xA;    uint16_t* dstUVStart = (uint16_t*)(outBuffer &#x2B; ((ptrdiff_t)pixels * sizeof(uint16_t)));&#xA;    uint16_t* dstUV = dstUVStart;&#xA;&#xA;    const uint32_t packsPerLine = m_width / PIXELS_PER_PACK;&#xA;&#xA;    for (uint32_t line = 0; line &lt; m_height; line&#x2B;&#x2B;)&#xA;    {&#xA;        for (uint32_t pack = 0; pack &lt; packsPerLine; pack&#x2B;&#x2B;)&#xA;        {&#xA;            uint32_t val;&#xA;            uint16_t u, y1, y2, v;&#xA;&#xA;            if (pack % 2 == 0)&#xA;            {&#xA;                V210_READ_PACK_BLOCK(u, y1, v);&#xA;                *dstUV&#x2B;&#x2B; = u;&#xA;                *dstY&#x2B;&#x2B; = y1;&#xA;                *dstUV&#x2B;&#x2B; = v;&#xA;&#xA;                V210_READ_PACK_BLOCK(y1, u, y2);&#xA;                *dstY&#x2B;&#x2B; = y1;&#xA;                *dstUV&#x2B;&#x2B; = u;&#xA;                *dstY&#x2B;&#x2B; = y2;&#xA;&#xA;                V210_READ_PACK_BLOCK(v, y1, u);&#xA;                *dstUV&#x2B;&#x2B; = v;&#xA;                *dstY&#x2B;&#x2B; = y1;&#xA;                *dstUV&#x2B;&#x2B; = u;&#xA;&#xA;                V210_READ_PACK_BLOCK(y1, v, y2);&#xA;                *dstY&#x2B;&#x2B; = y1;&#xA;                *dstUV&#x2B;&#x2B; = v;&#xA;                *dstY&#x2B;&#x2B; = y2;&#xA;            }&#xA;            else&#xA;            {&#xA;                V210_READ_PACK_BLOCK(u, y1, v);&#xA;                *dstY&#x2B;&#x2B; = y1;&#xA;&#xA;                V210_READ_PACK_BLOCK(y1, u, y2);&#xA;                *dstY&#x2B;&#x2B; = y1;&#xA;                *dstY&#x2B;&#x2B; = y2;&#xA;&#xA;                V210_READ_PACK_BLOCK(v, y1, u);&#xA;                *dstY&#x2B;&#x2B; = y1;&#xA;&#xA;                V210_READ_PACK_BLOCK(y1, v, y2);&#xA;                *dstY&#x2B;&#x2B; = y1;&#xA;                *dstY&#x2B;&#x2B; = y2;&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;#ifdef _DEBUG&#xA;&#xA;    // Fully written Y space&#xA;    assert(dstY == dstUVStart);&#xA;&#xA;    // Fully written UV space&#xA;    const BYTE* expectedVurrentUVPtr = outBuffer &#x2B; (ptrdiff_t)GetOutFrameSize();&#xA;    assert(expectedVurrentUVPtr == (BYTE *)dstUV);&#xA;&#xA;#endif&#xA;}&#xA;&#xA;// This is called to determine outBuffer size&#xA;LONG MyClass::GetOutFrameSize() const&#xA;{&#xA;    const LONG pixels = m_height * m_width;&#xA;&#xA;    return&#xA;        (pixels * sizeof(uint16_t)) &#x2B;  // Every pixel 1 y&#xA;        (pixels / 2 / 2 * (2 * sizeof(uint16_t)));  // Every 2 pixels and every odd row 2 16-bit numbers&#xA;}&#xA;

    &#xA;

    Leads to all green image. This turned out to be a missing bit shift to place the 10 bits in the upper bits of the 16-bit value as per the P010 spec.

    &#xA;

    Try 2 - Y works, UV doubled ?

    &#xA;

    Updated the code to properly (or so I think) shifts the YUV values to the correct position in their 16-bit space.

    &#xA;

    #define V210_READ_PACK_BLOCK(a, b, c) \&#xA;    do {                              \&#xA;        val  = *src&#x2B;&#x2B;;                \&#xA;        a = val &amp; 0x3FF;              \&#xA;        b = (val >> 10) &amp; 0x3FF;      \&#xA;        c = (val >> 20) &amp; 0x3FF;      \&#xA;    } while (0)&#xA;&#xA;&#xA;#define P010_WRITE_VALUE(d, v) (*d&#x2B;&#x2B; = (v &lt;&lt; 6))&#xA;&#xA;#define PIXELS_PER_PACK 6&#xA;#define BYTES_PER_PACK (4 * sizeof(uint32_t))&#xA;&#xA;// Snipped constructor here which guarantees that we&#x27;re processing&#xA;// something which does not violate alignment.&#xA;&#xA;void MyClass::FormatVideoFrame(&#xA;    const BYTE* inBuffer,&#xA;    BYTE* outBuffer)&#xA;{   &#xA;    const uint32_t pixels = m_height * m_width;&#xA;    const uint32_t aligned_width = ((m_width &#x2B; 47) / 48) * 48;&#xA;    const uint32_t stride = aligned_width * 8 / 3;&#xA;&#xA;    uint16_t* dstY = (uint16_t *)outBuffer;&#xA;&#xA;    uint16_t* dstUVStart = (uint16_t*)(outBuffer &#x2B; ((ptrdiff_t)pixels * sizeof(uint16_t)));&#xA;    uint16_t* dstUV = dstUVStart;&#xA;&#xA;    const uint32_t packsPerLine = m_width / PIXELS_PER_PACK;&#xA;&#xA;    for (uint32_t line = 0; line &lt; m_height; line&#x2B;&#x2B;)&#xA;    {&#xA;        // Lines start at 128 byte alignment&#xA;        const uint32_t* src = (const uint32_t*)(inBuffer &#x2B; (ptrdiff_t)(line * stride));&#xA;&#xA;        for (uint32_t pack = 0; pack &lt; packsPerLine; pack&#x2B;&#x2B;)&#xA;        {&#xA;            uint32_t val;&#xA;            uint16_t u, y1, y2, v;&#xA;&#xA;            if (pack % 2 == 0)&#xA;            {&#xA;                V210_READ_PACK_BLOCK(u, y1, v);&#xA;                P010_WRITE_VALUE(dstUV, u);&#xA;                P010_WRITE_VALUE(dstY, y1);&#xA;                P010_WRITE_VALUE(dstUV, v);&#xA;&#xA;                V210_READ_PACK_BLOCK(y1, u, y2);&#xA;                P010_WRITE_VALUE(dstY, y1);&#xA;                P010_WRITE_VALUE(dstUV, u);&#xA;                P010_WRITE_VALUE(dstY, y2);&#xA;&#xA;                V210_READ_PACK_BLOCK(v, y1, u);&#xA;                P010_WRITE_VALUE(dstUV, v);&#xA;                P010_WRITE_VALUE(dstY, y1);&#xA;                P010_WRITE_VALUE(dstUV, u);&#xA;&#xA;                V210_READ_PACK_BLOCK(y1, v, y2);&#xA;                P010_WRITE_VALUE(dstY, y1);&#xA;                P010_WRITE_VALUE(dstUV, v);&#xA;                P010_WRITE_VALUE(dstY, y2);&#xA;            }&#xA;            else&#xA;            {&#xA;                V210_READ_PACK_BLOCK(u, y1, v);&#xA;                P010_WRITE_VALUE(dstY, y1);&#xA;&#xA;                V210_READ_PACK_BLOCK(y1, u, y2);&#xA;                P010_WRITE_VALUE(dstY, y1);&#xA;                P010_WRITE_VALUE(dstY, y2);&#xA;&#xA;                V210_READ_PACK_BLOCK(v, y1, u);&#xA;                P010_WRITE_VALUE(dstY, y1);&#xA;&#xA;                V210_READ_PACK_BLOCK(y1, v, y2);&#xA;                P010_WRITE_VALUE(dstY, y1);&#xA;                P010_WRITE_VALUE(dstY, y2);&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;#ifdef _DEBUG&#xA;&#xA;    // Fully written Y space&#xA;    assert(dstY == dstUVStart);&#xA;&#xA;    // Fully written UV space&#xA;    const BYTE* expectedVurrentUVPtr = outBuffer &#x2B; (ptrdiff_t)GetOutFrameSize();&#xA;    assert(expectedVurrentUVPtr == (BYTE *)dstUV);&#xA;&#xA;#endif&#xA;}&#xA;

    &#xA;

    This leads to the Y being correct and the amount of lines for U and V as well, but somehow U and V are not overlaid properly. There are two versions of it seemingly mirrored through the center vertical. Something similar but less visible for zeroing out V. So both of these are getting rendered at half the width ? Any tips appreciated :)

    &#xA;

    Fix :&#xA;Found the bug, I'm flipping VU not per pack but per block

    &#xA;

    if (pack % 2 == 0)&#xA;

    &#xA;

    Should be

    &#xA;

    if (line % 2 == 0)&#xA;

    &#xA;