Recherche avancée

Médias (29)

Mot : - Tags -/Musique

Autres articles (84)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (15992)

  • 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;

  • Wrong subtitle packet data from av_read_frame() for FFmpeg 4.4 and higher ?

    12 avril 2023, par Elija

    I have a video file in MOV format. This file contains EIA608 subtitles. I use ffprobe to see the contents of all packets. For FFmpeg 4.3.1, I get the data of the first subtitle packet according to the file content at the offset specified for this packet, but for FFmpeg 4.4 and higher, I get "corrupted" data from the same packet. The beginning is cut off, the characters "0xfc" are added and the packet size is different. For packets of other types (video, audio, data), the result is the same for all versions of FFmpeg and exactly matches the contents of the file.&#xA;I get the same result when using the av_read_frame() function call in my code with different versions of FFmpeg.&#xA;Why does this happen with subtitle packets ? What has changed in FFmpeg with the transition to version 4.4 and higher ? What do I not know or do not understand ?

    &#xA;

    The file content at packet position (position = 9723 = 0x25fb) :&#xA;The file content at packet position (position = 9723 = 0x25fb)

    &#xA;

    FFmpeg 4.3.1 ffprobe result for the first subtitle packet :&#xA;FFmpeg 4.3.1 ffprobe result for the first subtitle packet

    &#xA;

    FFmpeg 4.4 and higher ffprobe result for the first subtitle packet :&#xA;FFmpeg 4.4 and higher ffprobe result for the first subtitle packet

    &#xA;

    UPDATE :&#xA;I found that since version 4.4. when reading a EIA608 subtitle packet for the MOV format, the get_eia608_packet() function has been added (mov_read_packet() used inside of av_read_frame(), get_eia608_packet() used inside of mov_read_packet()). But I don't understand for what purpose it was done. Can someone explain to me ?&#xA;As FFmpeg says about av_read_frame() : "This function returns what is stored in the file, and does not validate that what is there are valid frames for the decoder. It will split what is stored in the file into frames and return one for each call. It will not omit invalid data between valid frames so as to give the decoder the maximum information possible for decoding."&#xA;av_read_frame() description

    &#xA;

    libavformat/mov.c :

    &#xA;

    static int get_eia608_packet(AVIOContext *pb, AVPacket *pkt, int size)&#xA;{&#xA;    int new_size, ret;&#xA;&#xA;    if (size &lt;= 8)&#xA;        return AVERROR_INVALIDDATA;&#xA;    new_size = ((size - 8) / 2) * 3;&#xA;    ret = av_new_packet(pkt, new_size);&#xA;    if (ret &lt; 0)&#xA;        return ret;&#xA;&#xA;    avio_skip(pb, 8);&#xA;    for (int j = 0; j &lt; new_size; j &#x2B;= 3) {&#xA;        pkt->data[j] = 0xFC;&#xA;        pkt->data[j&#x2B;1] = avio_r8(pb);&#xA;        pkt->data[j&#x2B;2] = avio_r8(pb);&#xA;    }&#xA;&#xA;    return 0;&#xA;}&#xA;&#xA;static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)&#xA;{&#xA;...&#xA;if (st->codecpar->codec_id == AV_CODEC_ID_EIA_608 &amp;&amp; sample->size > 8)&#xA;            ret = get_eia608_packet(sc->pb, pkt, sample->size);&#xA;        else&#xA;            ret = av_get_packet(sc->pb, pkt, sample->size);&#xA;...&#xA;}&#xA;

    &#xA;

  • Three.js video texture displays green on Chrome mobile, wrong encoding ?

    19 mai 2015, par beeb

    I am trying to make a video texture "skybox" that works on mobile browsers with Three.js. So far, I’ve been able to implement this and it works great on desktop browsers. The problem is, when viewing the animation in Chrome mobile (42.0.2311.111 on Android 5.0.2), the video appears all green with a few artifacts. I tried with mp4 (encoded with ffmpeg libx264) and ogv (ffmpeg libtheora) videos and they both fail to work (mp4 is green as stated, and ogv doesn’t display at all - black). Is the encoding the problem or webgl ? The strange thing is that my method is the same as this method : http://jeromeetienne.github.io/threex.videotexture/examples/videotexture.html
    But my Chrome mobile browser can play this example fine, so I’m guessing the encoding must be the problem ?

    Here are the command lines I used to generate the videos :

    ffmpeg -framerate 30 -i %05d.png -c:v libtheora -qscale:v 8 -r 30 outputfile.ogv
    ffmpeg -framerate 30 -i %05d.png -c:v libx264 -qscale:v 8 -r 30 outputfile.mp4

    Here’s the full code, even though I don’t think the problem originates from this : https://jsfiddle.net/rufn75ef/ (you have to hit the play button, autoplay doesn’t work on mobile so I disabled it for this example)

    video = document.createElement('video');
    video.crossOrigin = "Anonymous";
    var canPlayMp4 = document.createElement('video').canPlayType('video/mp4') !== '' ? true : false;
    var canPlayOgg = document.createElement('video').canPlayType('video/ogg') !== '' ? true : false;
    if (canPlayMp4) {
       video.src = 'vid.mp4';
    } else if (canPlayOgg) {
       video.src = 'vid.ogv';
    } else {
       alert('Your browser can\'t play video, please view this site in a modern desktop browser.');
    }
    video.muted = true;
    video.loop = true;

    video.width = 358;
    video.height = 264;

    video.load(); //do after source change

    videoTexture = new THREE.Texture(video);
    videoTexture.minFilter = THREE.NearestFilter;
    videoTexture.magFilter = THREE.NearestFilter;

    If you are able to test, do you experience the same problem ? How should I encode my videos using ffmpeg to maximize mobile compatibility ?

    Thanks in advance