Recherche avancée

Médias (1)

Mot : - Tags -/musée

Autres articles (37)

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

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

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (4507)

  • ffmpeg chains parameters and options while being used in a loop

    10 janvier 2024, par Simon Nazarenko

    I got a code that generates videos from scratch (got gifs, captions and audio). It works amazing when done once, however, when put in a loop and it should create more than 1 video it freezes being caused by memory leak. Upon investigation I realized that ffmpeg (v1.1.0) chains the loop iterations carrying the parameters and options from the first iteration to the second. It then breaks (overwrites) the first video and infinitely writes the second.

    


    This is my dependency

    


    const ffmpeg = require("fluent-ffmpeg")()
  .setFfprobePath(ffprobe.path)
  .setFfmpegPath(ffmpegInstaller.path)


    


    It looks like this

    


    async function convertGifToVideo(
  gifFile,
  audioFile,
  subtitlesFile,
  tempDirectory
) {
  return new Promise((resolve, reject) => {
    const outputFile = `${tempDirectory}/video_${Date.now()}.mp4`
    
    ffmpeg
      .input(gifFile)
      .inputFormat("gif")
      .inputOptions("-stream_loop -1")
      .input(audioFile)
      .outputOptions("-shortest")
      .outputOptions(`-vf subtitles=${subtitlesFile}`)
      .outputOptions("-report")
      .output(outputFile)
      .on("end", () => {
        console.log(`Combined ${gifFile} and ${audioFile} into ${outputFile}`)
        resolve(outputFile)
      })
      .on("error", (err, stdout, stderr) => {
        console.error("Error combining GIF and audio:", err)
        console.error("ffmpeg stdout:", stdout)
        console.error("ffmpeg stderr:", stderr)
        reject(err)
      })
      .run()
  })
}


    


    And it's called in a loop

    


    for (const key in script) {
    if (script.hasOwnProperty(key)) {
      ...stuff

      const videoFileName = await convertGifToVideo(
        gifFileName,
        audioFileName,
        subtitlesFileName,
        tempDirectory
      )
    }
  }


    


    Here is a piece of log from the first video generation

    


    


    ffmpeg started on 2024-01-10 at 02:58:52
Report written to "ffmpeg-20240110-025852.log"
Command line :
/home/simon/Documents/AFYTUBE/node_modules/@ffmpeg-installer/linux-x64/ffmpeg -f gif -stream_loop -1 -i ./temp/gif_funny_frogs.gif -i ./temp/funny_frogs.mp3 -y -shortest -vf "subtitles=./temp/funny_frogs.srt" -report ./temp/video_1704880732780.mp4

    


    


    Here is a piece of log from the second one

    


    


    /home/simon/Documents/AFYTUBE/node_modules/@ffmpeg-installer/linux-x64/ffmpeg -f gif -stream_loop -1 -i ./temp/gif_funny_frogs.gif -i ./temp/funny_frogs.mp3 -f gif -stream_loop -1 -i ./temp/gif_leg_exercises.gif -i ./temp/leg_exercises.mp3 -y -shortest -vf "subtitles=./temp/funny_frogs.srt" -report -shortest -vf "subtitles=./temp/leg_exercises.srt" -report ./temp/video_1704880732780.mp4 ./temp/video_1704880750879.mp4

    


    


    Any ideas what I am doing wrong ?

    


  • ffmpeg not available on Oracle Linux 9 update 3 [closed]

    19 janvier 2024, par Red Cricket

    I cannot figure out how to install ffmpeg on a Oracle Linux 9 update 3 (RHCK).

    


    [root@snc-ol93-rhck ~]# dnf install ffmpeg-free
Last metadata expiration check: 0:14:16 ago on Wed 17 Jan 2024 04:48:34 PM UTC.
Error:
 Problem: package ffmpeg-free-5.1.4-2.el9.x86_64 from ol9_developer_EPEL requires libavfilter.so.8()(64bit), but none of the providers can be installed
  - package ffmpeg-free-5.1.4-2.el9.x86_64 from ol9_developer_EPEL requires libavfilter.so.8(LIBAVFILTER_8)(64bit), but none of the providers can be installed
  - package libavfilter-free-5.1.3-1.el9.x86_64 from ol9_developer_EPEL requires librubberband.so.2()(64bit), but none of the providers can be installed
  - package libavfilter-free-5.1.4-1.el9.x86_64 from ol9_developer_EPEL requires librubberband.so.2()(64bit), but none of the providers can be installed
  - package libavfilter-free-5.1.4-2.el9.x86_64 from ol9_developer_EPEL requires librubberband.so.2()(64bit), but none of the providers can be installed
  - cannot install the best candidate for the job
  - nothing provides ladspa needed by rubberband-2.0.1-1.el9.x86_64 from ol9_developer_EPEL
  - nothing provides ladspa needed by rubberband-3.1.0-2.el9.x86_64 from ol9_developer_EPEL
  - nothing provides ladspa needed by rubberband-3.1.3-1.el9.x86_64 from ol9_developer_EPEL
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)


    


    Turns out I needed to install the repo like so in my ansible playbook

    


    dnf install https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-9.noarch.rpm


    


  • (C_UDP Socket Programming) How can I convert binary file to video format ?

    30 avril 2024, par user24723398

    I am practicing UDP socket programming. My code's functions are below.

    


      

    1. Connect Server-Client and send "hello" message each other (it is working).
    2. 


    3. Then Server is sending video file to client (problem).
    4. 


    


    Transfer video file to client is working. But it is written in binary so I can't open the video.

    


    So I try to use ffmpeg to convert the video, but it doesn't work.

    


    Is there something wrong in my code ? How can I transfer a received file to a video file ?

    


    My environment is MacOs.

    


    Server.c (Server Code) :

    


    #include &#xA;#include &#xA;#include &#xA;#include <arpa></arpa>inet.h>&#xA;#include &#xA;#include <sys></sys>socket.h>&#xA;&#xA;#define PORT 8888&#xA;#define BUF_SIZE 256&#xA;&#xA;int main(){&#xA;    int serv_sock;&#xA;    char message[BUF_SIZE];&#xA;    char buf[BUF_SIZE];&#xA;    int str_len;&#xA;    socklen_t clnt_adr_sz;&#xA;&#xA;    struct sockaddr_in serv_adr, clnt_adr;&#xA;    &#xA;    //create socket&#xA;    serv_sock=socket(PF_INET, SOCK_DGRAM, 0);&#xA;    if(serv_sock == -1){&#xA;        perror("socket() error");&#xA;        exit(1);&#xA;    }&#xA;    &#xA;    //socket address&#xA;    memset(&amp;serv_adr, 0, sizeof(serv_adr));&#xA;    serv_adr.sin_family=AF_INET;&#xA;    serv_adr.sin_addr.s_addr=htonl(INADDR_ANY);&#xA;    serv_adr.sin_port=htons(PORT);&#xA;    //binding socket&#xA;    if(bind(serv_sock, (struct sockaddr*)&amp;serv_adr, sizeof(serv_adr)) == -1){&#xA;        perror("bind() error");&#xA;        exit(1);&#xA;    }&#xA;    &#xA;    while(1){&#xA;        clnt_adr_sz=sizeof(clnt_adr);&#xA;        str_len=recvfrom(serv_sock, message, BUF_SIZE, 0, (struct sockaddr *)&amp;clnt_adr, &amp;clnt_adr_sz);&#xA;         if (str_len &lt; 0) {&#xA;            perror("recvfrom error");&#xA;            exit(1);&#xA;        }&#xA;    &#xA;        char hello_message[] = "hello i am server";&#xA;        if (sendto(serv_sock, hello_message, strlen(hello_message), 0, (struct sockaddr *)&amp;clnt_adr, clnt_adr_sz) &lt; 0) {&#xA;            perror("sendto error");&#xA;            exit(1);&#xA;        }&#xA;        &#xA;        //print message&#xA;        message[str_len] = &#x27;\0&#x27;;&#xA;        printf("client say: %s\n", message);&#xA;        &#xA;        char buf[BUF_SIZE];&#xA;        ssize_t bytes_read;&#xA;        // sending viedo file&#xA;        printf("sending video file...\n");&#xA;        size_t fsize;&#xA;    &#xA;        //video file&#xA;        FILE *file;&#xA;        char *filename = "video.mp4";&#xA;        // open video file&#xA;        file = fopen(filename, "rb");&#xA;        if (file == NULL) {&#xA;            perror("File opening failed");&#xA;            exit(EXIT_FAILURE);&#xA;        }&#xA;        //calculate video file memory&#xA;        fseek(file, 0, SEEK_END);&#xA;        fsize = ftell(file);&#xA;        fseek(file,0,SEEK_SET);&#xA;    &#xA;        size_t size = htonl(fsize);&#xA;        int nsize =0;&#xA;        &#xA;        while(nsize!=fsize){&#xA;            int fpsize = fread(buf,1, BUF_SIZE, file);&#xA;            nsize &#x2B;= fpsize;&#xA;            if (sendto(serv_sock, &amp;size, sizeof(size), 0, (struct sockaddr *)&amp;clnt_adr, clnt_adr_sz) &lt; 0) {&#xA;                perror("sendto");&#xA;                exit(EXIT_FAILURE);    &#xA;            }&#xA;            fclose(file);&#xA;            /*&#xA;            while ((bytes_read = fread(buf, 1, BUF_SIZE, file)) > 0) {&#xA;                if (sendto(serv_sock, buf, bytes_read, 0,&#xA;                       (struct sockaddr *)&amp;clnt_adr, clnt_adr_sz) &lt; 0) {&#xA;                    perror("sendto");&#xA;                    exit(EXIT_FAILURE);&#xA;                }       &#xA;            }&#xA;            */&#xA;        }        &#xA;    }&#xA;    close(serv_sock);&#xA;    return 0;&#xA;}&#xA;

    &#xA;

    Client.c (Client code)

    &#xA;

    #include &#xA;#include &#xA;#include &#xA;#include <arpa></arpa>inet.h>&#xA;#include &#xA;#include <sys></sys>socket.h>&#xA;&#xA;#define BUFSIZE 256&#xA;#define PORT 8888&#xA;&#xA;int main(){&#xA;    int sock;&#xA;    char message[BUFSIZE];&#xA;    int str_len;&#xA;    socklen_t adr_sz;&#xA;&#xA;    struct sockaddr_in serv_addr, client_addr;   &#xA;    &#xA;    sock = socket(PF_INET, SOCK_DGRAM, 0);&#xA;    if(sock == -1){&#xA;        printf("socket() error\n");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    memset(&amp;serv_addr, 0, sizeof(serv_addr));&#xA;    serv_addr.sin_family = AF_INET;&#xA;    serv_addr.sin_addr.s_addr = inet_addr("127.0.0.1");&#xA;    serv_addr.sin_port = htons(PORT);&#xA;&#xA;    char hello_message[] = "hello i am client";&#xA;    sendto(sock, hello_message, strlen(hello_message), 0, (struct sockaddr*)&amp;serv_addr, sizeof(serv_addr));&#xA;    adr_sz = sizeof(client_addr);&#xA;    str_len=recvfrom(sock,message,BUFSIZE,0,(struct sockaddr*)&amp;client_addr,&amp;adr_sz);&#xA;   &#xA;    message[str_len] = &#x27;\0&#x27;;&#xA;    printf("client say: %s\n", message);&#xA;    &#xA;    /*&#xA;    char buf[BUFSIZE];&#xA;    ssize_t bytes_received;&#xA;    socklen_t serv_len = sizeof(serv_addr);&#xA;    while ((bytes_received = recvfrom(sock, buf, BUFSIZE, 0,&#xA;                                      (struct sockaddr *)&amp;serv_addr, &amp;serv_len)) > 0) {&#xA;        fwrite(buf, 1, bytes_received, file);&#xA;    }&#xA;    */&#xA;     &#xA;    FILE *file = fopen("received_test.mp4", "wb");&#xA;&#xA;    int nbyte = BUFSIZE;&#xA;    while(nbyte>= BUFSIZE){&#xA;        nbyte = recvfrom(sock, message, BUFSIZE, 0, (struct sockaddr*)&amp;serv_addr, &amp;adr_sz);&#xA;        fwrite(message, sizeof(char), nbyte, file);&#xA;    }&#xA;&#xA;    if (file == NULL) {&#xA;        perror("File opening failed");&#xA;        exit(EXIT_FAILURE);&#xA;    }&#xA;&#xA;    fclose(file);&#xA;    close(sock);&#xA;    printf("File received successfully\n");&#xA;    &#xA;    return 0;&#xA;}&#xA;

    &#xA;

    I try to convert the binary file to an .mp4 file using ffmpeg&#xA;but it doesn't work :

    &#xA;

    ffmpeg -i received_test.mp4 output.mp4&#xA;ffmpeg version 7.0 Copyright (c) 2000-2024 the FFmpeg developers&#xA;  built with Apple clang version 15.0.0 (clang-1500.3.9.4)&#xA;  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/7.0 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags=&#x27;-Wl,-ld_classic&#x27; --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopenvino --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon&#xA;  libavutil      59.  8.100 / 59.  8.100&#xA;  libavcodec     61.  3.100 / 61.  3.100&#xA;  libavformat    61.  1.100 / 61.  1.100&#xA;  libavdevice    61.  1.100 / 61.  1.100&#xA;  libavfilter    10.  1.100 / 10.  1.100&#xA;  libswscale      8.  1.100 /  8.  1.100&#xA;  libswresample   5.  1.100 /  5.  1.100&#xA;  libpostproc    58.  1.100 / 58.  1.100&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x12a62bdb0] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible!&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x12a62bdb0] moov atom not found&#xA;[in#0 @ 0x12b0043c0] Error opening input: Invalid data found when processing input&#xA;Error opening input file received_test.mp4.&#xA;Error opening input files: Invalid data found when processing input&#xA;

    &#xA;