Recherche avancée

Médias (1)

Mot : - Tags -/copyleft

Autres articles (69)

  • 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 (10905)

  • MOBILE FFMPEG filter complex with yup420 output issues

    9 avril 2021, par najam ulhassan

    I am creating video by images using mobile-ffmpeg using complex-filter and format yuv420, I am having problem width is not divisible by 2(601*900) like so.
This error is occuring for some video creations for many it is working fine.
My filter complex is scaling, rotating and overlaying the input images.
Here is ffmpeg command :

    


    ffmpeg -loop 1 -t 10 -i background.jpg -s 700x900 

-loop 1 -i img1.png -loop 1 -i img2.jpg 
-loop 1 -i img3.jpg

-filter_complex
[1]scale=eval=frame:w='72':h='72'[img1];
[2]scale=eval=frame:w='598':h='382',rotate=a=0*PI/180:c=black@0:oh='roth(0*PI/180)':ow='rotw(0*PI/180)':bilinear=1,fade=in:st=2:d=3:alpha=1[img2];
[3]scale=eval=frame:w='598':h='382',rotate=a=0*PI/180:c=black@0:oh='roth(0*PI/180)':ow='rotw(0*PI/180)':bilinear=1,fade=in:st=3:d=4:alpha=1[img3];
[0][img1]overlay=W-w-5:5:format=auto:shortest=1:format=auto[bg1];
[bg1][img2]overlay=44:500:shortest=1:format=auto[bg2];
[bg2][img3]overlay=44:22:shortest=1:format=auto,format=yuv420p" 

output.mp4


    


    Having some searches about it and found -vf filter can adjust the width:height but it is restricted not to use with filter-complex...

    


    My error logs :

    


     E/mobile-ffmpeg: [libx264 @ 0xbd8c8800] 
 E/mobile-ffmpeg: width not divisible by 2 (601x901)
 E/mobile-ffmpeg: Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height


    


  • Video Frame Skipping Issues During Chunking and Uploading in React Native App

    24 février 2024, par Kishore J

    To create a social media platform like Instagram and Facebook, we have incorporated the functionality for users to upload reels-style videos. To enhance the viewing experience, we have implemented a strategy to segment these videos and upload them to the backend.

    


    To achieve this, we have employed the ffmpeg-kit-react-native and rn-fetch-blob libraries to segment videos efficiently. We've written an asynchronous function, chunkVideo, which chunks the input video file into segments of a specified duration. Here's a snippet of the code :

    


    async function chunkVideo(inputVideoFile, fileName, segmentDuration = 3) {
try {
  // Define the cache directory path
  const cacheDir = RNFetchBlob.fs.dirs.CacheDir;
  const outputTSFilePattern = `${cacheDir}/${fileName}_video%d.ts`;
  await FFmpegKit.execute(
   `-i ${inputVideoFile} -codec: copy -start_number 0 -hls_time ${segmentDuration} -hls_list_size 0 -hls_segment_filename ${outputTSFilePattern} -f hls ${cacheDir}/index.m3u8`,
  );
} catch (err) {
  logEvent("chunkVideoError", {error: err?.message});
  errorToast(err, true);
  }
}


    


    While this approach works well for segmenting videos, we encountered an issue where some frames are skipping during the chunking process, leading to a compromised viewing experience for the end-users.

    


    How to mitigate the frame skipping problems ?

    


  • Issues with video frame dropout using Accord.NET VideoFileWriter and FFMPEG

    9 janvier 2018, par David

    I am testing out writing video files using the Accord.Video library. I have a WPF project created in Visual Studio 2017, and I have installed Accord.Video.FFMPEG as well as Accord.Video.VFW using Nuget, as well as their dependencies.

    I have created a very simple video to test basic file output. However, I am running into some issues. My goal is to be able to output videos with a variable frame rate, because in the future I will be using this code to input images from a webcam device that will then be saved to a video file, and video from webcams typically has variable frame rates.

    For now, in this example, I am not inputting video from a webcam, but rather I am generating a simple "moving box" image and outputting the frames to a video file. The box changes color every 20 frames : red, green, blue, yellow, and finally white. I also set the frame rate to be 20 fps.

    When I use Accord.Video.VFW, the frame rate is correctly set, and all the frames are correctly outputted to the video file. The resulting video looks like this (see the YouTube link) : https://youtu.be/K8E9O7bJIbg

    This is just a reference, however. I don’t intend on using Accord.Video.VFW because it outputs uncompressed data to an AVI file, and it doesn’t support variable frame rates. I would like to use Accord.Video.FFMPEG because it is supposed to support variable frame rates.

    When I attempt to use the Accord.Video.FFMPEG library, however, the video does not result in how I would expect it to look. Here is a YouTube link : https://youtu.be/cW19yQFUsLI

    As you can see, in that example, the box remains the first color for a longer amount of time than the other colors. It also never reaches the final color (white). When I inspect the video file, 100 frames were not outputted to the file. There are 69 or 73 frames typically. And the expected frame rate and duration obviously do not match up.

    Here is the code that generates both these videos :

    public MainWindow()
    {
       InitializeComponent();

       Accord.Video.VFW.AVIWriter avi_writer = new Accord.Video.VFW.AVIWriter();
       avi_writer.FrameRate = 20;
       avi_writer.Open("test2.avi", 640, 480);

       Accord.Video.FFMPEG.VideoFileWriter k = new Accord.Video.FFMPEG.VideoFileWriter();
       k.FrameRate = 20;
       k.Width = 640;
       k.Height = 480;
       k.Open("test.mp4");
       for (int i = 0; i < 100; i++)
       {
           TimeSpan t = new TimeSpan(0, 0, 0, 0, 50 * i);
           var b = new System.Drawing.Bitmap(640, 480);
           var g = Graphics.FromImage(b);
           var br = System.Drawing.Brushes.Blue;
           if (t.TotalMilliseconds < 1000)
               br = System.Drawing.Brushes.Red;
           else if (t.TotalMilliseconds < 2000)
               br = System.Drawing.Brushes.Green;
           else if (t.TotalMilliseconds < 3000)
               br = System.Drawing.Brushes.Blue;
           else if (t.TotalMilliseconds < 4000)
               br = System.Drawing.Brushes.Yellow;
           else
               br = System.Drawing.Brushes.White;

           g.FillRectangle(br, 50 + i, 50, 100, 100);
           System.Console.WriteLine("Frame: " + (i + 1).ToString() + ", Millis: " + t.TotalMilliseconds.ToString());

           #region This is the code in question

           k.WriteVideoFrame(b, t);
           avi_writer.AddFrame(b);

           #endregion
       }

       avi_writer.Close();
       k.Close();
       System.Console.WriteLine("Finished writing video");
    }

    I have tried changing a few things under the assumption that maybe the "WriteVideoFrame" function isn’t able to finish in time, and so I need to slow down the program so it can complete itself. Under that assumption, I have replaced the "WriteVideoFrame" call with the following code :

    Task taskA = new Task(() => k.WriteVideoFrame(b, t));
    taskA.Start();
    taskA.Wait();

    And I have tried the following code :

    Task.WaitAll(
       Task.Run( () =>
       {
           lock(syncObj)
           {
               k.WriteVideoFrame(b, t);
           }
       }
    ));

    And even just a standard call where I don’t specify a timestamp :

    k.WriteVideoFrame(b);

    None of these work. They all result in something similar.

    Any suggestions on getting the WriteVideoFrame function to work that is a part of the Accord.Video.FFMPEG.VideoFileWriter class ?

    Thanks for any and all help !

    [edits below]

    I have done some more investigating. I still haven’t found a good solution, but here is what I have found so far. After declaring my VideoFileWriter object, I have tried setting up some options for the video.

    When I use an H264 codec with the following options, it correctly saves 100 frames at a frame-rate of 20 fps, however any normal media player (both VLC and Windows Media Player) end up playing a 10-second video instead of a 5-second video. Essentially, it seems like they play it at half-speed. Here is the code that gives that result :

    k.VideoCodec = Accord.Video.FFMPEG.VideoCodec.H264;
    k.VideoOptions["crf"] = "18";
    k.VideoOptions["preset"] = "veryfast";
    k.VideoOptions["tune"] = "zerolatency";
    k.VideoOptions["x264opts"] = "no-mbtree:sliced-threads:sync-lookahead=0";

    Additionally, if I use an Mpeg4 codec, I get the same "half-speed" result :

    k.VideoCodec = Accord.Video.FFMPEG.VideoCodec.Mpeg4;

    However, if I use a WMV codec, then it correctly results in 100 frames at 20 fps, and a 5 second video that is correctly played by both media players :

    k.VideoCodec = Accord.Video.FFMPEG.VideoCodec.Wmv1;

    Although this is good news, this still doesn’t solve the problem because WMV doesn’t support variable frame rates. Also, this still doesn’t answer the question as to why the problem is happening in the first place.

    As always, any help would be appreciated !