Recherche avancée

Médias (91)

Autres articles (71)

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

  • Diogene : création de masques spécifiques de formulaires d’édition de contenus

    26 octobre 2010, par

    Diogene est un des plugins ? SPIP activé par défaut (extension) lors de l’initialisation de MediaSPIP.
    A quoi sert ce plugin
    Création de masques de formulaires
    Le plugin Diogène permet de créer des masques de formulaires spécifiques par secteur sur les trois objets spécifiques SPIP que sont : les articles ; les rubriques ; les sites
    Il permet ainsi de définir en fonction d’un secteur particulier, un masque de formulaire par objet, ajoutant ou enlevant ainsi des champs afin de rendre le formulaire (...)

Sur d’autres sites (7379)

  • C# get dominant color in an image

    22 janvier 2017, par CK13

    I’m building a program that makes screenshots from a video.
    It extracts frames from the video (with ffmpeg) and then combines them into one file.

    All works fine, except sometimes I get (almost) black images, mostly in the beginning and ending of the video.

    A possible solution I can think of is to detect if the extracted frame is dark. If it is dark, extract another frame from a slightly different time.

    How can I detect if the extracted frame is dark/black ? Or is there another way I can solve this ?

    private void getScreenshots_Click(object sender, EventArgs e)
    {
       int index = 0;
       foreach (string value in this.filesList.Items)
       {
           string file = selectedFiles[index] + "\\" + value;

           // ------------------------------------------------
           //   MediaInfo
           // ------------------------------------------------
           // https://github.com/Nicholi/MediaInfoDotNet
           //
           // get file width, height, and frame count
           //
           // get aspect ratio of the video
           // and calculate height of thumbnail
           // using width and aspect ratio
           //
           MediaInfo MI = new MediaInfo();
           MI.Open(file);
           var width = MI.Get(StreamKind.Video, 0, "Width");
           var height = MI.Get(StreamKind.Video, 0, "Height");
           decimal d = Decimal.Parse(MI.Get(StreamKind.Video, 0, "Duration"));
           decimal frameCount = Decimal.Parse(MI.Get(StreamKind.Video, 0, "FrameCount"));
           MI.Close();
           decimal ratio = Decimal.Divide(Decimal.Parse(width), Decimal.Parse(height));
           int newHeight = Decimal.ToInt32(Decimal.Divide(newWidth, ratio));
           decimal startTime = Decimal.Divide(d, totalImages);
           //totalImages - number of thumbnails the final image will have
           for (int x = 0; x < totalImages; x++)
           {
               // increase the time where the thumbnail is taken on each iteration
               decimal newTime = Decimal.Multiply(startTime, x);
               string time = TimeSpan.FromMilliseconds(double.Parse(newTime.ToString())).ToString(@"hh\:mm\:ss");

               string outputFile = this.tmpPath + "img-" + index + x + ".jpg";

               // create individual thumbnails with ffmpeg
               proc = new Process();
               proc.StartInfo.FileName = "ffmpeg.exe";
               proc.StartInfo.Arguments = "-y -seek_timestamp 1 -ss " + time + " -i \"" + file + "\" -frames:v 1 -qscale:v 3 \"" + outputFile + "\"";
               proc.Start();
               proc.WaitForExit();
           }

           // set width and height of final image
           int w = (this.cols * newWidth) + (this.spacing * this.cols + this.spacing);
           int h = (this.rows * newHeight) + (this.spacing * this.rows + this.spacing);

           int left, top, i = 0;
           // combine individual thumbnails into one image
           using (Bitmap bmp = new Bitmap(w, h))
           {
               using (Graphics g = Graphics.FromImage(bmp))
               {
                   g.Clear(this.backgroundColor);
                   // this.rows - number of rows
                   for (int y = 0; y < this.rows; y++)
                   {
                       // put images on a column
                       // this.cols - number of columns
                       // when x = number of columns go to next row
                       for (int x = 0; x < this.cols; x++)
                       {
                           Image imgFromFile = Image.FromFile(this.tmpPath + "img-" + index + i + ".jpg");
                           MemoryStream imgFromStream = new MemoryStream();
                           imgFromFile.Save(imgFromStream, imgFromFile.RawFormat);
                           imgFromFile.Dispose();

                           left = (x * newWidth) + ((x + 1) * this.spacing);
                           top = (this.spacing * (y + 1)) + (newHeight * y);
                           g.DrawImage(Image.FromStream(imgFromStream), left, top, newWidth, newHeight);
                           i++;
                       }
                   }
               }

               // save the final image
               bmp.Save(selectedFiles[index] + "\\" + value + ".jpg");
           }
           index++;
       }
    }
  • Getting log line for each extracted frame from FFMPEG

    3 février 2016, par wpfwannabe

    I am using FFMPEG.exe to extract frames from various videos. As this is a programmatic solution and getting the total frame count and/or duration can prove tricky (with ffprobe), I am thinking I could use the console output to detect individual frames’ timestamps but I am getting a single output line every N frames like this :

    frame=   20 fps=0.0 q=0.0 size=       0kB time=00:00:01.72 bitrate=   0.0kbits/s
    frame=   40 fps= 38 q=0.0 size=       0kB time=00:00:04.02 bitrate=   0.0kbits/s
    frame=   60 fps= 39 q=0.0 size=       0kB time=00:00:06.14 bitrate=   0.0kbits/s
    frame=   70 fps= 38 q=0.0 Lsize=       0kB time=00:00:07.86 bitrate=   0.0kbits/s

    Is there a command line option to force output for each and every frame ? If so, I could extract the time= portion. This is the command line currently used :

    ffmpeg.exe -i video.avi -y -threads 0 -vsync 2 %10d.jpeg

    Ideally, replacing %10d.jpeg with some other format that writes frame’s timestamp but I don’t think this exists.

  • Recording application output to video using FFmpeg (or similar)

    15 décembre 2011, par John

    We have a requirement to lets users record a video of our 3D application. I can already grab the individual rendered frames so this question is specifically about how to write frames into a video file.

    I don't think writing each frame as a separate file and post-processing is a workable option.

    I can look at options to record to a simple video file for later optimising/encoding, or writing directly to a sensibly encoded format.

    FFmpeg was suggested in another post but it looks a bit daunting to me. Is it the best option, if not what can be suggested ? We can work with LGPL but not full GPL.

    We're working on Windows (Win32 not MFC) in C++. Sample/pseudo code with your recommended library is very much appreciated... basically after how to do 3 functions :

    • startRecording() does whatever initialization is needed
    • recordFrame() takes pointer to frame data and encodes it, ideally with timing data
    • endRecording() finalizes the video file, shuts down video system, etc