Recherche avancée

Médias (91)

Autres articles (64)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

  • Sélection de projets utilisant MediaSPIP

    29 avril 2011, par

    Les exemples cités ci-dessous sont des éléments représentatifs d’usages spécifiques de MediaSPIP pour certains projets.
    Vous pensez avoir un site "remarquable" réalisé avec MediaSPIP ? Faites le nous savoir ici.
    Ferme MediaSPIP @ Infini
    L’Association Infini développe des activités d’accueil, de point d’accès internet, de formation, de conduite de projets innovants dans le domaine des Technologies de l’Information et de la Communication, et l’hébergement de sites. Elle joue en la matière un rôle unique (...)

Sur d’autres sites (4999)

  • 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