Recherche avancée

Médias (17)

Mot : - Tags -/wired

Autres articles (55)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

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

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

Sur d’autres sites (7705)

  • Can I use the file buffer or stream as input for fluent-ffmpeg ? I am trying to avoid saving the video locally to get its path before removing

    22 avril 2023, par Moath Thawahreh

    I am receiving the file via an api, I was trying to process the file.buffer as input for FFmpeg but it did not work, I had to save the video locally first and then process the path and remove the saved video later on.
I don't want to believe that there is no other way to solve this and I have been looking for solutions and workarounds but it was all about ffmpeg input as a path.

    


    I would love to find a solution using fluent-ffmpeg because it has some other great features, but I won't mind any suggestions for compressing the video using any different approaches if it's more efficient

    


    Again my code below works fine but I have to save the video and then remove it I am hoping for a more efficient solution :

    


      fs.writeFileSync(&#x27;temp.mp4&#x27;, file.buffer);&#xA;&#xA;    // Resize the temporary file using ffmpeg&#xA;    ffmpeg(&#x27;temp.mp4&#x27;) // here I tried pass file.buffer as readable stream,it receives paths only &#xA;      .format(&#x27;mp4&#x27;)&#xA;      .size(&#x27;50%&#x27;)&#xA;      .save(&#x27;resized.mp4&#x27;)&#xA;      .on(&#x27;end&#x27;, async () => {&#xA;        // Upload the resized file to Firebase&#xA;        const resizedFileStream = bucket.file(`video/${uniqueId}`).createWriteStream();&#xA;        fs.createReadStream(&#x27;resized.mp4&#x27;).pipe(resizedFileStream);&#xA;&#xA;        await new Promise<void>((resolve, reject) => {&#xA;          resizedFileStream&#xA;            .on(&#x27;finish&#x27;, () => {&#xA;              // Remove the local files after they have been uploaded&#xA;              fs.unlinkSync(&#x27;temp.mp4&#x27;);&#xA;              fs.unlinkSync(&#x27;resized.mp4&#x27;);&#xA;              resolve();&#xA;            })&#xA;            .on(&#x27;error&#x27;, reject);&#xA;        });&#xA;&#xA;        // Get the URL of the uploaded resized version&#xA;        const resizedFile = bucket.file(`video/${uniqueId}`);&#xA;        const url = await resizedFile.getSignedUrl({&#xA;          action: &#x27;read&#x27;,&#xA;          expires: &#x27;03-17-2025&#x27;, // Change this to a reasonable expiration date&#xA;        });&#xA;&#xA;        console.log(&#x27;Resized file uploaded successfully.&#x27;);&#xA;      })&#xA;      .on(&#x27;error&#x27;, (err) => {&#xA;        console.log(&#x27;An error occurred: &#x27; &#x2B; err.message);&#xA;      });&#xA;</void>

    &#xA;

  • flutter_ffmpeg is discontinued with no alternatives ?

    13 mars, par Rageh Azzazy

    Based on this article by Taner Sener&#xA;https://tanersener.medium.com/saying-goodbye-to-ffmpegkit-33ae939767e1

    &#xA;

    and after the discontinuation of flutter_ffmpeg and ffmpeg_kit_flutter packages.

    &#xA;

    most packages for executing video editing commands were built depending on them and so won't work After April 1, 2025 as mentioned in the package documentation and Taner's article.

    &#xA;

    example of packages depending on flutter_ffmpeg or ffmpeg_kit_flutter like

    &#xA;

      &#xA;
    • video_trimmer
    • &#xA;

    • zero_video_trimmer
    • &#xA;

    • flutter_video_trimmer
    • &#xA;

    • video_trim
    • &#xA;

    • bemeli_compress
    • &#xA;

    • video_trimmer_pro
    • &#xA;

    • ... others
    • &#xA;

    &#xA;

    and editing video using video_editor or video_editor_2 or video_editor_pits has become a problem

    &#xA;

    and I believe downloading the binaries and doing the whole thing locally is not just tedious but illegal as well.

    &#xA;

    so I broke down exactly what I need to edit videos in my flutter app

    &#xA;

    and I found those package but not yet tested them

    &#xA;

    Trimming : flutter_native_video_trimmer

    &#xA;

    Compression : video_compress or video_compress_plus

    &#xA;

    Muting : video_compress handles this

    &#xA;

    Encoding : Not sure, I just need a simple MP4 video files

    &#xA;

    Cropping : I can't find a solution for video cropping

    &#xA;

    I don't need to rotate, reverse or do any fancy stuff to the videos, just those five functions.

    &#xA;

    so now only remaining solution for this approach is to find a simple video cropping function and an encoder that work on flutter IOS & Android

    &#xA;

    so my question is not looking for external library recommendation but&#xA;do you have any ideas how to crop a video in flutter natively ?

    &#xA;

  • How to improve web camera streaming latency to v4l2loopback device with ffmpeg ?

    11 mars, par Made by Moses

    I'm trying to stream my iPhone camera to my PC on LAN.

    &#xA;

    What I've done :

    &#xA;

      &#xA;
    1. HTTP server with html page and streaming script :

      &#xA;

      I use WebSockets here and maybe WebRTC is better choice but it seems like network latency is good enough

      &#xA;

    2. &#xA;

    &#xA;

    async function beginCameraStream() {&#xA;  const mediaStream = await navigator.mediaDevices.getUserMedia({&#xA;    video: { facingMode: "user" },&#xA;  });&#xA;&#xA;  websocket = new WebSocket(SERVER_URL);&#xA;&#xA;  websocket.onopen = () => {&#xA;    console.log("WS connected");&#xA;&#xA;    const options = { mimeType: "video/mp4", videoBitsPerSecond: 1_000_000 };&#xA;    mediaRecorder = new MediaRecorder(mediaStream, options);&#xA;&#xA;    mediaRecorder.ondataavailable = async (event) => {&#xA;      // to measure latency I prepend timestamp to the actual video bytes chunk&#xA;      const timestamp = Date.now();&#xA;      const timestampBuffer = new ArrayBuffer(8);&#xA;      const dataView = new DataView(timestampBuffer);&#xA;      dataView.setBigUint64(0, BigInt(timestamp), true);&#xA;      const data = await event.data.bytes();&#xA;&#xA;      const result = new Uint8Array(data.byteLength &#x2B; 8);&#xA;      result.set(new Uint8Array(timestampBuffer), 0);&#xA;      result.set(data, 8);&#xA;&#xA;      websocket.send(result);&#xA;    };&#xA;&#xA;    mediaRecorder.start(100); // Collect 100ms chunks&#xA;  };&#xA;}&#xA;

    &#xA;

      &#xA;
    1. Server to process video chunks

      &#xA;

    2. &#xA;

    &#xA;

    import { serve } from "bun";&#xA;import { Readable } from "stream";&#xA;&#xA;const V4L2LOOPBACK_DEVICE = "/dev/video10";&#xA;&#xA;export const setupFFmpeg = (v4l2device) => {&#xA;  // prettier-ignore&#xA;  return spawn("ffmpeg", [&#xA;    &#x27;-i&#x27;, &#x27;pipe:0&#x27;,           // Read from stdin&#xA;    &#x27;-pix_fmt&#x27;, &#x27;yuv420p&#x27;,    // Pixel format&#xA;    &#x27;-r&#x27;, &#x27;30&#x27;,               // Target 30 fps&#xA;    &#x27;-f&#x27;, &#x27;v4l2&#x27;,             // Output format&#xA;    v4l2device, // Output to v4l2loopback device&#xA;  ]);&#xA;};&#xA;&#xA;export class FfmpegStream extends Readable {&#xA;  _read() {&#xA;    // This is called when the stream wants more data&#xA;    // We push data when we get chunks&#xA;  }&#xA;}&#xA;&#xA;function main() {&#xA;  const ffmpeg = setupFFmpeg(V4L2LOOPBACK_DEVICE);&#xA;  serve({&#xA;    port: 8000,&#xA;    fetch(req, server) {&#xA;      if (server.upgrade(req)) {&#xA;        return; // Upgraded to WebSocket&#xA;      }&#xA;    },&#xA;    websocket: {&#xA;      open(ws) {&#xA;        console.log("Client connected");&#xA;        const stream = new FfmpegStream();&#xA;        stream.pipe(ffmpeg?.stdin);&#xA;&#xA;        ws.data = {&#xA;          stream,&#xA;          received: 0,&#xA;        };&#xA;      },&#xA;      async message(ws, message) {&#xA;        const view = new DataView(message.buffer, 0, 8);&#xA;        const ts = Number(view.getBigUint64(0, true));&#xA;        ws.data.received &#x2B;= message.byteLength;&#xA;        const chunk = new Uint8Array(message.buffer, 8, message.byteLength - 8);&#xA;&#xA;        ws.data.stream.push(chunk);&#xA;&#xA;        console.log(&#xA;          [&#xA;            `latency: ${Date.now() - ts} ms`,&#xA;            `chunk: ${message.byteLength}`,&#xA;            `total: ${ws.data.received}`,&#xA;          ].join(" | "),&#xA;        );&#xA;      },&#xA;    },&#xA;  });&#xA;}&#xA;&#xA;main();&#xA;

    &#xA;

    After I try to open the v4l2loopback device

    &#xA;

    cvlc v4l2:///dev/video10&#xA;

    &#xA;

    picture is delayed for at least 1.5 sec which is unacceptable for my project.

    &#xA;

    Thoughts :

    &#xA;

      &#xA;
    • Problem doesn't seems to be with network latency
    • &#xA;

    &#xA;

    latency: 140 ms | chunk: 661 Bytes | total: 661 Bytes&#xA;latency: 206 ms | chunk: 16.76 KB | total: 17.41 KB&#xA;latency: 141 ms | chunk: 11.28 KB | total: 28.68 KB&#xA;latency: 141 ms | chunk: 13.05 KB | total: 41.74 KB&#xA;latency: 199 ms | chunk: 11.39 KB | total: 53.13 KB&#xA;latency: 141 ms | chunk: 16.94 KB | total: 70.07 KB&#xA;latency: 139 ms | chunk: 12.67 KB | total: 82.74 KB&#xA;latency: 142 ms | chunk: 13.14 KB | total: 95.88 KB&#xA;

    &#xA;

     150ms is actually too much for 15KB on LAN but there can some issue with my router

    &#xA;

      &#xA;
    • As far as I can tell it neither ties to ffmpeg throughput :
    • &#xA;

    &#xA;

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;pipe:0&#x27;:&#xA;  Metadata:&#xA;    major_brand     : iso5&#xA;    minor_version   : 1&#xA;    compatible_brands: isomiso5hlsf&#xA;    creation_time   : 2025-03-09T17:16:49.000000Z&#xA;  Duration: 00:00:01.38, start:&#xA;0.000000, bitrate: N/A&#xA;    Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuvj420p(pc), 1280x720, 4012 kb/s, 57.14 fps, 29.83 tbr, 600 tbn, 1200 tbc (default)&#xA;    Metadata:&#xA;      rotate          : 90&#xA;      creation_time   : 2025-03-09T17:16:49.000000Z&#xA;      handler_name    : Core Media Video&#xA;    Side data:&#xA;      displaymatrix: rotation of -90.00 degrees&#xA;&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))&#xA;&#xA;[swscaler @ 0x55d8d0b83100] deprecated pixel format used, make sure you did set range correctly&#xA;&#xA;Output #0, video4linux2,v4l2, to &#x27;/dev/video10&#x27;:&#xA;  Metadata:&#xA;    major_brand     : iso5&#xA;    minor_version   : 1&#xA;    compatible_brands: isomiso5hlsf&#xA;    encoder         : Lavf58.45.100&#xA;&#xA;Stream #0:0(und): Video: rawvideo (I420 / 0x30323449), yuv420p, 720x1280, q=2-31, 663552 kb/s, 60 fps, 60 tbn, 60 tbc (default)&#xA;    Metadata:&#xA;      encoder         : Lavc58.91.100 rawvideo&#xA;      creation_time   : 2025-03-09T17:16:49.000000Z&#xA;      handler_name    : Core Media Video&#xA;    Side data:&#xA;      displaymatrix: rotation of -0.00 degrees&#xA;&#xA;frame=   99 fps=0.0 q=-0.0 size=N/A time=00:00:01.65 bitrate=N/A dup=50 drop=0 speed=2.77x&#xA;frame=  137 fps=114 q=-0.0 size=N/A time=00:00:02.28 bitrate=N/A dup=69 drop=0 speed=1.89x&#xA;frame=  173 fps= 98 q=-0.0 size=N/A time=00:00:02.88 bitrate=N/A dup=87 drop=0 speed=1.63x&#xA;frame=  210 fps= 86 q=-0.0 size=N/A time=00:00:03.50 bitrate=N/A dup=105 drop=0 speed=1.44x&#xA;frame=  249 fps= 81 q=-0.0 size=N/A time=00:00:04.15 bitrate=N/A dup=125 drop=0 speed=1.36&#xA;frame=  279 fps= 78 q=-0.0 size=N/A time=00:00:04.65 bitrate=N/A dup=139 drop=0 speed=1.31x&#xA;

    &#xA;

      &#xA;
    • I also tried to write the video stream directly to video.mp4 file and immediately open it with vlc but it only can be successfully opened after 1.5 sec.

      &#xA;

    • &#xA;

    • I've tried to use OBS v4l2 input source instead of vlc but the latency is the same

      &#xA;

    • &#xA;

    &#xA;

    Update №1

    &#xA;

    When i try to stream actual .mp4 file to ffmpeg it works almost immediately with 0.2sec delay to spin up the ffmpeg itself :

    &#xA;

    cat video.mp4 | ffmpeg -re -i pipe:0 -pix_fmt yuv420p -f v4l2 /dev/video10 &amp; ; sleep 0.2 &amp;&amp; cvlc v4l2:///dev/video10&#xA;

    &#xA;

    So the problem is apparently with streaming process

    &#xA;