Recherche avancée

Médias (0)

Mot : - Tags -/auteurs

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (58)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

    Dans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
    Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)

  • Script d’installation automatique de MediaSPIP

    25 avril 2011, par

    Afin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
    Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
    La documentation de l’utilisation du script d’installation (...)

Sur d’autres sites (6345)

  • ffmpeg intensity histogram adjustment

    30 septembre 2016, par jlarsch

    I am using ffmpeg for background correction of a video and I would like to improve the intensity scaling of the output.

    My gray scale videos have dark moving objects on a light background. In 8 bit pixel intensities, the light background has pixel values around 240, the dark objects have intensities of around 120.

    outside of ffmpeg, I generate a background image by taking the median frame over some number of frames.
    Then, I use ffmpeg to blend/divide each frame by the background image. (I want to use division, not subtraction of the background).
    [there is also some cropping in my ffmpeg command, but it is irrelevant to my question]

    'ffmpeg.exe', '-i', u'inputVideo.avi', '-i', u'bgMed.tif', '-y', '-r', '160', '-filter_complex', "[1:0] setsar=sar=1 [1sared]; [0:0][1sared] blend=all_mode='divide':repeatlast=1,format=gray,split=1 [int1];[int1]crop=1097:1097:12:11:[out1]", '-map', '[out1]', '-c:v', 'libxvid', '-q:v', '5', '-g', '10', u'outputVideo'

    This procedure is basically working but the resulting video frames look too washed out. This is probably expected ? I am guessing ffmpeg does the division and produces an internal float result which it then maps back to an 8 bit output. I would like to stretch the histogram of the result from the division. It would be preferable to stretch before the mapping to 8 bit for a finer dynamic range.

    In my example, I am assuming that the background division produces a result frame that has a value close to 1 for the background, and values close to 0.5 for the dark objects. Then, ffmpeg seems to be mapping the full range 0-1 into 8 bit 0-255. I would like it to map the range 0.5-1 of the division result into the 8 bit range of the output. is this possible somehow ? Or how else can I achieve a similar result ?

  • 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++;
       }
    }
  • FFmpeg programming : assign color transfer characteristics

    8 juillet 2017, par Francis Tesla

    When using ffmpeg library to load an EXR file it appears to dark.

    This seems to be the same problem as this one :

    ffmpeg - getting a dark output when converting .exr sequence to .mp4

    The EXR decoder has a parameter to assign color transfer
    characteristics.

    For sRGB, it is

    ffmpeg -apply_trc iec61966_2_1 -start_frame 1100 -i input.$04d.exr
    output.mp4

    But how to achieve the same result programmatically ?

    Here is my code :

    AVFrame *frame = av_frame_alloc();
    avcodec_decode_video2(codecCtx, frame, &frameFinished, &packet);

    ...

    AVPicture       picture;
    avpicture_alloc(&picture, dest_format, dest_width, dest_height);

    SwsContext *swsCtx = NULL;

    swsCtx = sws_getContext(source_width, source_height, source_format, dest_width, dest_height, dest_format, SWS_POINT, NULL, NULL, NULL);

    if (swsCtx == NULL) {
       qDebug() << "error calling sws_getContext";
    }

    sws_scale(swsCtx, frame->data, frame->linesize, 0, frame->height, picture.data, picture.linesize);

    QImage image(dest_width, dest_height, QImage::Format_ARGB32);

    for (int y = 0; y < dest_height; ++y) {
       memcpy(image.scanLine(y), picture.data[0] + y * picture.linesize[0], picture.linesize[0]);
    }

    av_frame_free(&frame);
    sws_freeContext(swsCtx);

    Thank you,
    Francis