Recherche avancée

Médias (1)

Mot : - Tags -/musée

Autres articles (49)

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

    5 septembre 2013, par

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

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

Sur d’autres sites (6037)

  • Evolution #2633 : Pouvoir modifier _DIR_RESTREINT_ABS

    10 juillet 2015, par jluc -

    Si on enlève les répertoires de tests, il ne reste plus grand chose :

    // normal
    spip.php:14:if (!defined(’_DIR_RESTREINT_ABS’)) define(’_DIR_RESTREINT_ABS’, ’ecrire/’) ;
    ecrire/inc_version.php:38 :    define(’_DIR_RESTREINT_ABS’, ’ecrire/’) ;
    

    // pb ecrire
    ecrire/public/debusquer.php:366 : if ($reg[1]==’ecrire/public’)

    // dist
    plugins-dist/forum/prive/modeles/forum-actions-moderer.html:2 :[(#SETretour,[(#REM|test_espace_prive| ?[(#VALecrire/|concat#SELF|replace’./’,’’)],#SELF|ancre_urlforum#ID_FORUM)])]

    // installation ’normale’
    config/ecran_securite.php:113 : OR @file_exists(’ecrire/inc_version.php’))
    config/ecran_securite.php:259:if (strpos($_SERVER[’REQUEST_URI’],"ecrire/") !==false)

    spip_loader.php:44:define(’_SPIP_LOADER_PLUGIN_RETOUR’, "ecrire/ ?exec=admin_plugin&voir=tous") ;
    spip_loader.php:923:if (@file_exists(’ecrire/inc_version.php’))
    spip_loader.php:924 : define(’_SPIP_LOADER_URL_RETOUR’, "ecrire/ ?exec=accueil") ;
    spip_loader.php:925 : include_once ’ecrire/inc_version.php’ ;
    spip_loader.php:933 :
    else define(’_SPIP_LOADER_URL_RETOUR’, "ecrire/ ?exec=install") ;

  • Recording of Full HD 60 FPS videos in C#

    17 mars 2021, par Alexander Naumov

    My application works with a high-speed camera. I am trying to record a videofile using C#.

    


    The task is pretty "simple" : to record the video from the camera. We need to record medium (higher-better) quality videos to save as many details as possible.

    


      

    • Resolution : 1920 x 1080 (FullHD)
    • 


    • Frames per second (FPS) : 60
    • 


    • Bitrate : I've started from 10000*1000 (but now I don't know)
    • 


    • Mediacontainer : MP4, AVI (does not really matter, we just need to
solve our task)
    • 


    • Codec : also does not matter, we just need speed and quality.
    • 


    • Maximum size of videofile : 10 GB/hour
    • 


    


    Framerate of the camera can be changed during the recording by the camera itself (not by user), so it's necessary to have something like timestamps for every frame or anything else.

    


    The problem is not fast enough recording.
Example : using AForge libs, generated pictures ("white" noise), duration of test videos is 20 seconds.

    


    Duration of video creating using different codecs (provided by AForge) :

    


      

    • Codec : MPEG4, Time : 33,703
    • 


    • Codec : WMV1, Time : 45,338
    • 


    • Codec : WMV2, Time : 45,530
    • 


    • Codec : MSMPEG4v2, Time : 43,775
    • 


    • Codec : MSMPEG4v3, Time : 44,390
    • 


    • Codec : H263P, Time : 38,894
    • 


    • Codec : FLV1, Time : 39,151
    • 


    • Codec : MPEG2, Time : 35,561
    • 


    • Codec : Raw, Time : 61,456
    • 


    


    Another libs we've tried is not satisfied us.
Accord.FFMPEG is slow because of strange inner exceptions.
EmguCV.FFMPEG has no timestamps, therefore it creates corrupted video.

    


    Recording the video to the SSD drive did not give us any visible acceleration.

    


    Google search gives no clear examples or modern solutions to solve this task. That's the main reason to write here.

    


    There is a code sample of our test :

    


    private static void AForge_test()
    {
        Console.WriteLine("AForge test started...");
        unsafe
        {
            Stopwatch watch = new Stopwatch();

            Console.WriteLine("FPS: {0}, W:{1}, H:{2}, T:{3}", fps, w, h, time);

            AForge.Video.FFMPEG.VideoCodec[] codecs = (AForge.Video.FFMPEG.VideoCodec[]) Enum.GetValues(typeof(AForge.Video.FFMPEG.VideoCodec));

            for(int k = 0; k < codecs.Length; k++)
            {
              /*  if (codecs[k] != VideoCodec.MPEG4)
                    continue;*/
                try
                {
                    watch.Restart();

                    Random r2 = new Random(200);
                    AForge.Video.FFMPEG.VideoFileWriter vw = new AForge.Video.FFMPEG.VideoFileWriter();
                    string name = String.Format("E:\\VideosHDD\\AForge_test_{0}_mid.avi", Enum.GetName(typeof(AForge.Video.FFMPEG.VideoCodec), codecs[k]));
                    vw.Open(name, w, h, fps, codecs[k], 10000 * 1000);

                    for (int i = 0; i < frames; i++)
                    {
                        vw.WriteVideoFrame(bmps[i%N]);
                    }

                    vw.Close();
                    vw.Dispose();

                    watch.Stop();

                    Console.WriteLine("Codec: {0}, Time: {1:F3}", Enum.GetName(typeof(AForge.Video.FFMPEG.VideoCodec), codecs[k]), watch.ElapsedMilliseconds / 1000d);
                }
                catch(Exception ex)
                {
                    Console.WriteLine("Error " + codecs[k].ToString());
                }

            }
            
        }

        Console.ReadKey();
    }


    


    Additional :

    


      

    1. We are ready to use not-for-free solutions, but free is preferable.
    2. 


    3. One of the supposed reasons for low recording speed : (x86) building of applications. I tried so hard to find x64 Aforge building but failed in this. We really don't know is there any influence of application architecture on recording speed.
    4. 


    


    I am ensured that I don't know all the background of video recording and another "little" thing, so I would be very pleased to solutions with clear explanations.

    


  • what is wrong about the I420 render from ffmpeg ?

    9 mai 2022, par DLKUN

    I use glfw render YUV from ffmpeg ;the Y is ok(only use data Y ,and frag texture2D Y is ok ,the color is Grayscale).but when I add U,V ;the display show pink and green ; I try to change frag shader or the imgtexture ,there have no use .

    


    #include <glad></glad>glad.h>&#xA;#include <glfw></glfw>glfw3.h>&#xA;&#xA;#include<string>&#xA;#include<fstream>&#xA;#include<sstream>&#xA;#include<iostream>&#xA;#include&#xA;&#xA;#include &#xA;&#xA;// settings&#xA;const unsigned int SCR_WIDTH = 544;&#xA;const unsigned int SCR_HEIGHT = 960;&#xA;const int len = 544 * 960 * 3/2;&#xA;BYTE YUVdata [len];//&#xA;BYTE Ydata [544 * 960];//&#xA;BYTE Udata [272 * 480];//&#xA;BYTE Vdata [272 * 480];//&#xA;unsigned int VBO = 0;&#xA;unsigned int VAO = 0;&#xA;unsigned int EBO = 0;&#xA;unsigned int texturePIC = 0;&#xA;int shaderProgram = 0;&#xA;&#xA;GLuint texIndexarray[3];&#xA;GLuint texUniformY = 99;&#xA;GLuint texUniformU = 99;&#xA;GLuint texUniformV = 99;&#xA;&#xA;void LoadPicture()&#xA;{&#xA;&#xA;&#xA;    glGenTextures(3, texIndexarray);&#xA;&#xA;    glBindTexture(GL_TEXTURE_2D, texIndexarray[0]);&#xA;    &#xA;    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);&#xA;    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);&#xA;    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);&#xA;    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);&#xA;&#xA;    glBindTexture(GL_TEXTURE_2D, texIndexarray[1]);&#xA;    &#xA;    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);&#xA;    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);&#xA;    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);&#xA;    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);&#xA;    glBindTexture(GL_TEXTURE_2D, texIndexarray[2]);&#xA;    &#xA;    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);&#xA;    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);&#xA;    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);&#xA;    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);&#xA;&#xA;&#xA;    glValidateProgram(shaderProgram);&#xA;&#xA;    texUniformY = glGetUniformLocation(shaderProgram, "dataY");//2&#xA;    texUniformU = glGetUniformLocation(shaderProgram, "dataU");//0&#xA;    texUniformV = glGetUniformLocation(shaderProgram, "dataV");//1&#xA;&#xA;    &#xA;    FILE* fp = fopen("./output544_960.yuv","rb&#x2B;");//I420&#xA;    int returns  =fread(YUVdata,1,len,fp);&#xA;    int w = 544;&#xA;    int h = 960;&#xA;    int ysize = w*h;&#xA;    int uvsize = w * h / 4;&#xA;&#xA;    void* uptr = &amp;YUVdata[ysize];&#xA;    void* vptr = &amp;YUVdata[ysize * 5 / 4];&#xA;&#xA;    memcpy(Ydata,YUVdata,ysize);&#xA;    memcpy(Udata, uptr,uvsize);&#xA;    memcpy(Vdata, vptr,uvsize);&#xA;    glActiveTexture(GL_TEXTURE0);&#xA;    glBindTexture(GL_TEXTURE_2D, texIndexarray[0]);&#xA;    &#xA;    glTexImage2D(GL_TEXTURE_2D, 0 , GL_RED, w, h ,0, GL_RED,GL_UNSIGNED_BYTE ,Ydata);&#xA;    glUniform1i(texUniformY, texIndexarray[0]);               &#xA;&#xA;&#xA;    glActiveTexture(GL_TEXTURE1);&#xA;    glBindTexture(GL_TEXTURE_2D, texIndexarray[1]);&#xA;    glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, w/2, h/2, 0, GL_RED, GL_UNSIGNED_BYTE,Udata );&#xA;&#xA;    glUniform1i(texUniformU, texIndexarray[1]);&#xA;&#xA;&#xA;    glActiveTexture(GL_TEXTURE2);&#xA;    glBindTexture(GL_TEXTURE_2D, texIndexarray[2]);&#xA;    glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, w/2, h/2, 0, GL_RED, GL_UNSIGNED_BYTE,Vdata);&#xA;    glUniform1i(texUniformV, texIndexarray[2]);&#xA;&#xA;}&#xA;&#xA;&#xA;void render()&#xA;{&#xA;    glBindVertexArray(VAO);&#xA;    glUseProgram(shaderProgram);&#xA;    glDrawElements(GL_TRIANGLES,6,GL_UNSIGNED_INT,0);&#xA;    //glDrawArrays(GL_TRIANGLE_FAN,0,4);&#xA;    glUseProgram(0);&#xA;    glBindVertexArray(0);&#xA;}&#xA;&#xA;void initmodule()&#xA;{&#xA;    &#xA;    float vertexs[] = {&#xA;        &#xA;        1.0f,  1.0f, 0.0f,  1.0f, 0.0f,   &#xA;        1.0f, -1.0f, 0.0f,  1.0f, 1.0f,   &#xA;        -1.0f, -1.0f, 0.0f,  0.0f, 1.0f,   &#xA;        -1.0f,  1.0f, 0.0f,  0.0f, 0.0f    &#xA;    &#xA;    &#xA;    };&#xA;    &#xA;    unsigned int indexs[] = {&#xA;        0,1,3,&#xA;        1,2,3,&#xA;    };&#xA;&#xA;    &#xA;    glGenVertexArrays(1,&amp;VAO);&#xA;    glBindVertexArray(VAO);&#xA;&#xA;    &#xA;&#xA;    glGenBuffers(1, &amp;VBO);&#xA;    glBindBuffer(GL_ARRAY_BUFFER, VBO);&#xA;    &#xA;    glBufferData(GL_ARRAY_BUFFER,sizeof(vertexs), vertexs, GL_STATIC_DRAW);&#xA;&#xA;    &#xA;    glGenBuffers(1,&amp;EBO);&#xA;    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,EBO);&#xA;    glBufferData(GL_ELEMENT_ARRAY_BUFFER,sizeof(indexs),indexs,GL_STATIC_DRAW);&#xA;    &#xA;    LoadPicture();&#xA;&#xA;    glVertexAttribPointer(0,3,GL_FLOAT,GL_FALSE,5*sizeof(float),(void*)0);&#xA;    &#xA;    glEnableVertexAttribArray(0);&#xA;    &#xA;    glVertexAttribPointer(1,2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));&#xA;    &#xA;    glEnableVertexAttribArray(1);&#xA;&#xA;    &#xA;    glBindBuffer(GL_ARRAY_BUFFER,0);&#xA;&#xA;    &#xA;    glBindVertexArray(0);&#xA;&#xA;&#xA;&#xA;}&#xA;&#xA;void initshader(const char* verpath,const char* fragpath)&#xA;{&#xA;    &#xA;    std::string VerCode("");&#xA;    std::string fregCode("");&#xA;    &#xA;    std::ifstream  vShaderFile;&#xA;    std::ifstream  fShaderFile;&#xA;&#xA;    vShaderFile.exceptions(std::ifstream::failbit | std::ifstream::badbit);&#xA;    fShaderFile.exceptions(std::ifstream::failbit | std::ifstream::badbit);&#xA;&#xA;    try&#xA;    {&#xA;        vShaderFile.open(verpath);&#xA;        fShaderFile.open(fragpath);&#xA;&#xA;        std::stringstream vsstream, fsstream;&#xA;        vsstream &lt;&lt; vShaderFile.rdbuf();&#xA;        fsstream &lt;&lt; fShaderFile.rdbuf();&#xA;        VerCode = vsstream.str();&#xA;        fregCode = fsstream.str();&#xA;    &#xA;    }&#xA;    catch (const std::exception&amp;)&#xA;    {&#xA;        std::cout &lt;&lt; "read file error" &lt;&lt; std::endl;&#xA;    }&#xA;&#xA;    const char* vshader = VerCode.c_str();&#xA;    const char* fshader = fregCode.c_str();&#xA;&#xA;    &#xA;    unsigned int vertexID = 0, fragID = 0;&#xA;    char infoLog[512];&#xA;    int  successflag = 0;&#xA;    vertexID = glCreateShader(GL_VERTEX_SHADER);&#xA;    glShaderSource(vertexID,1,&amp;vshader,NULL );&#xA;    glCompileShader(vertexID);&#xA;    &#xA;    glGetShaderiv(vertexID,GL_COMPILE_STATUS,&amp;successflag);&#xA;    if (!successflag)&#xA;    {&#xA;        glGetShaderInfoLog(vertexID,512,NULL,infoLog);&#xA;        std::string errstr(infoLog);&#xA;        std::cout &lt;&lt; "v shader err"&lt;/frag&#xA;    fragID = glCreateShader(GL_FRAGMENT_SHADER);&#xA;    glShaderSource(fragID, 1, &amp;fshader, NULL);&#xA;    glCompileShader(fragID);&#xA;    &#xA;    glGetShaderiv(fragID, GL_COMPILE_STATUS, &amp;successflag);&#xA;    if (!successflag)&#xA;    {&#xA;        glGetShaderInfoLog(fragID, 512, NULL, infoLog);&#xA;        std::string errstr(infoLog);&#xA;        std::cout &lt;&lt; "f shader err"&lt;/&#xA;    initmodule();&#xA;&#xA;&#xA;    &#xA;    while (!glfwWindowShouldClose(window))&#xA;    {&#xA;        &#xA;        processInput(window);&#xA;&#xA;        glClearColor(0.0f,0.0f,0.0f,1.0f);&#xA;        glClear(GL_COLOR_BUFFER_BIT);&#xA;        render();&#xA;    &#xA;        &#xA;        glfwSwapBuffers(window);&#xA;        &#xA;        glfwPollEvents();&#xA;    }&#xA;&#xA;    &#xA;    glfwTerminate();&#xA;    return 0;&#xA;}&#xA;</iostream></sstream></fstream></string>

    &#xA;

    I get the Y data ,and run the code is ok ;the color is gray ;but when I add the U ,the color is Light green;and when i add the V is pink and green ;

    &#xA;

        #version 330 core&#xA;layout(location = 0) out vec4 FragColor;&#xA;in vec2 TexCoord;&#xA;uniform sampler2D dataY;&#xA;uniform sampler2D dataU;&#xA;uniform sampler2D dataV;&#xA;vec3 yuv;&#xA;vec3 rgb;&#xA;void main()&#xA;{&#xA;&#xA;&#xA;   yuv.x = texture2D(dataY, TexCoord).r-0.0625;&#xA;   yuv.y = texture2D(dataU, TexCoord).r-0.5;&#xA;   yuv.z = texture2D(dataV, TexCoord).r-0.5;&#xA;&#xA;   rgb = mat3(1,              1,      1,     &#xA;            0,       -0.18732, 1.8556,    &#xA;            1.57481, -0.46813,      0) * yuv;   &#xA;    FragColor = vec4(rgb.x, rgb.y,rgb.z,1); &#xA;};&#xA;

    &#xA;