Recherche avancée

Médias (1)

Mot : - Tags -/musée

Autres articles (55)

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

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

Sur d’autres sites (4632)

  • Revision 30228 : Amélioration du formulaire de config

    26 juillet 2009, par kent1@… — Log

    Amélioration du formulaire de config

  • Why when using ffmpeg to create video file in real time the ffmpeg.exe take over 1GB of memory ?

    3 juillet 2015, par Brubaker Haim

    This is my class where i’m using the ffmpeg.exe.

    using System;
    using System.Windows.Forms;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Drawing;
    using System.IO.Pipes;
    using System.Runtime.InteropServices;
    using System.Diagnostics;
    using System.IO;
    using DannyGeneral;

    namespace Manager
    {
       public class Ffmpeg
       {
           NamedPipeServerStream p;
           String pipename = "mytestpipe";
           System.Diagnostics.Process process;
           string ffmpegFileName = "ffmpeg.exe";
           string workingDirectory;

           public Ffmpeg()
           {
               workingDirectory = Path.GetDirectoryName(Application.ExecutablePath);
               Logger.Write("workingDirectory: " + workingDirectory);
               if (!Directory.Exists(workingDirectory))
               {
                   Directory.CreateDirectory(workingDirectory);
               }
               ffmpegFileName = Path.Combine(workingDirectory, ffmpegFileName);
               Logger.Write("FfmpegFilename: " + ffmpegFileName);
           }

           public void Start(string pathFileName, int BitmapRate)
           {
               try
               {

                   string outPath = pathFileName;
                   p = new NamedPipeServerStream(pipename, PipeDirection.Out, 1, PipeTransmissionMode.Byte);

                   ProcessStartInfo psi = new ProcessStartInfo();
                   psi.WindowStyle = ProcessWindowStyle.Hidden;
                   psi.UseShellExecute = false;
                   psi.CreateNoWindow = false;
                   psi.FileName = ffmpegFileName;
                   psi.WorkingDirectory = workingDirectory;
                   psi.Arguments = @"-f rawvideo -pix_fmt bgra -video_size 1920x1080 -i \\.\pipe\mytestpipe -c:v libx264 -crf 20 -r " + BitmapRate + " " + outPath;
                   process = Process.Start(psi);
                   process.EnableRaisingEvents = false;
                   psi.RedirectStandardError = true;
                   p.WaitForConnection();
               }
               catch (Exception err)
               {
                   Logger.Write("Exception Error: " + err.ToString());
               }
           }

           public void PushFrame(Bitmap bmp)
           {
               try
               {
                   int length;
                   // Lock the bitmap's bits.
                   //bmp = new Bitmap(1920, 1080);
                   Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
                   //Rectangle rect = new Rectangle(0, 0, 1280, 720);
                   System.Drawing.Imaging.BitmapData bmpData =
                       bmp.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadOnly,
                       bmp.PixelFormat);

                   int absStride = Math.Abs(bmpData.Stride);
                   // Get the address of the first line.
                   IntPtr ptr = bmpData.Scan0;

                   // Declare an array to hold the bytes of the bitmap.
                   //length = 3 * bmp.Width * bmp.Height;
                   length = absStride * bmpData.Height;
                   byte[] rgbValues = new byte[length];

                   //Marshal.Copy(ptr, rgbValues, 0, length);
                   int j = bmp.Height - 1;
                   for (int i = 0; i < bmp.Height; i++)
                   {
                       IntPtr pointer = new IntPtr(bmpData.Scan0.ToInt32() + (bmpData.Stride * j));
                       System.Runtime.InteropServices.Marshal.Copy(pointer, rgbValues, absStride * (bmp.Height - i - 1), absStride);
                       j--;
                   }
                   p.Write(rgbValues, 0, length);
                   bmp.UnlockBits(bmpData);
               }
               catch(Exception err)
               {
                   Logger.Write("Error: " + err.ToString());
               }

           }

           public void Close()
           {
               p.Close();
           }
       }
    }

    ffmpegFileName contain the ffmpeg.exe

    Then i have a timer tick event in another form :

    ScreenShot shot = new ScreenShot();
       public static int counter = 0;
       private void timer1_Tick(object sender, EventArgs e)
       {
           counter++;
           shot.GetScreenShot(@"e:\screenshots\", "screenshot");
           if (counter == 1200)
           {
               timer1.Stop();
               ScreenShot.fmpeg.Close();
               this.Close();
               ScreenShotsPlayer ssp = new ScreenShotsPlayer();
               ssp.Show();
           }
       }

    This timer interval set to 100ms.
    So it’s taking a screenshot every 100ms.

    In the class ScreenShot i’m using the Ffmpeg class :
    In the top :

    public static Ffmpeg fmpeg;

    In the constructor :

    fmpeg = new Ffmpeg();
    fmpeg.Start(@"e:\screenshots\test.mp4", 25);

    Then in the GetScreenShot method i’m calling the Ffmpeg PushFrame method :

    public Bitmap GetScreenShot(string folder, string name)
       {
           _screenShot = new Bitmap(GetScreen());
           System.GC.Collect();
           System.GC.WaitForPendingFinalizers();
           string ingName = folder + name + Elgato_Video_Capture.counter.ToString("D6") + ".bmp";
           _screenShot.Save(ingName,System.Drawing.Imaging.ImageFormat.Bmp);
           fmpeg.PushFrame(_screenShot);
           _screenShot.Dispose();
           return _screenShot;
       }

    I can’t figure out why once i start the timer to take the screenshots the ffmpeg.exe eat so much memory also the hard disk is working about 53MB/s and the memory is over 90% and over 1GB.

    I’m doing the memory leak somehow ?

    ffmpeg memory

    In the ScreenShot class when i’m making an instance once for the Ffmpeg class the ffmpeg.exe is on very low memory usage and the hard disk usage is low.

    The ffmpeg.exe is about only 0.1MB of memory usage.

    fmpeg.Start(@"e:\screenshots\test.mp4", 25);

    But then when i’m clicking the button start the timer and taking screenshots every 100ms and calling PushFrame method the ffmpeg.exe very fast after few seconds getting to over 1GB of memory usage.

    EDIT

    I tried this arguments :

    psi.Arguments = @"-f rawvideo -pix_fmt bgra -video_size 1920x1080 -i \\.\pipe\mytestpipe -c:v libx264 -crf 20 -r 750k e:\screenshots\test.mp4";

    The memory usage was about 1gb of ffmpeg.exe and cpu usage 99-100%
    The hard disk was on 0 but now the cpu usage got to 100% and the memory over 1gb.

    And it didn’t create the video file I got this warnings/errors :

    Warnings/Errors

  • When using ffmpeg to compress and create in real time mpeg4 video file from bathc of images getting low quality video how can i improve quality ?

    30 juin 2015, par Brubaker Haim

    The goal here is to create a compressed mp4 video file in real time. I’m saving screenshots as bitmaps type on my hard disk. And i want to create mp4 file and compress the mp4 video file in real time.

    using System;
    using System.Windows.Forms;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Drawing;
    using System.IO.Pipes;
    using System.Runtime.InteropServices;
    using System.Diagnostics;
    using System.IO;
    using DannyGeneral;

    namespace Youtube_Manager
    {
       class Ffmpeg
       {
           NamedPipeServerStream p;
           String pipename = "mytestpipe";
           System.Diagnostics.Process process;
           string ffmpegFileName = "ffmpeg.exe";
           string workingDirectory;

           public Ffmpeg()
           {
               workingDirectory = Path.GetDirectoryName(Application.ExecutablePath);
               Logger.Write("workingDirectory: " + workingDirectory);
               if (!Directory.Exists(workingDirectory))
               {
                   Directory.CreateDirectory(workingDirectory);
               }
               ffmpegFileName = Path.Combine(workingDirectory, ffmpegFileName);
               Logger.Write("FfmpegFilename: " + ffmpegFileName);
           }

           public void Start(string pathFileName, int BitmapRate)
           {
               try
               {

                   string outPath = pathFileName;
                   p = new NamedPipeServerStream(pipename, PipeDirection.Out, 1, PipeTransmissionMode.Byte);

                   ProcessStartInfo psi = new ProcessStartInfo();
                   psi.WindowStyle = ProcessWindowStyle.Hidden;
                   psi.UseShellExecute = false;
                   psi.CreateNoWindow = false;
                   psi.FileName = ffmpegFileName;
                   psi.WorkingDirectory = workingDirectory;
                   psi.Arguments = @"-f rawvideo -vcodec rawvideo -pix_fmt rgb24 -video_size 1920x1080 -i \\.\pipe\mytestpipe -map 0 -c:v mpeg4 -r " + BitmapRate + " " + outPath;
                   process = Process.Start(psi);
                   process.EnableRaisingEvents = false;
                   psi.RedirectStandardError = true;
                   p.WaitForConnection();
               }
               catch (Exception err)
               {
                   Logger.Write("Exception Error: " + err.ToString());
               }
           }

           public void PushFrame(Bitmap bmp)
           {
               try
               {
                   int length;
                   // Lock the bitmap's bits.
                   //bmp = new Bitmap(1920, 1080);
                   Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
                   //Rectangle rect = new Rectangle(0, 0, 1280, 720);
                   System.Drawing.Imaging.BitmapData bmpData =
                       bmp.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadOnly,
                       bmp.PixelFormat);

                   int absStride = Math.Abs(bmpData.Stride);
                   // Get the address of the first line.
                   IntPtr ptr = bmpData.Scan0;

                   // Declare an array to hold the bytes of the bitmap.
                   //length = 3 * bmp.Width * bmp.Height;
                   length = absStride * bmpData.Height;
                   byte[] rgbValues = new byte[length];

                   //Marshal.Copy(ptr, rgbValues, 0, length);
                   int j = bmp.Height - 1;
                   for (int i = 0; i < bmp.Height; i++)
                   {
                       IntPtr pointer = new IntPtr(bmpData.Scan0.ToInt32() + (bmpData.Stride * j));
                       System.Runtime.InteropServices.Marshal.Copy(pointer, rgbValues, absStride * (bmp.Height - i - 1), absStride);
                       j--;
                   }
                   p.Write(rgbValues, 0, length);
                   bmp.UnlockBits(bmpData);
               }
               catch(Exception err)
               {
                   Logger.Write("Error: " + err.ToString());
               }

           }

           public void Close()
           {
               p.Close();
           }
       }
    }

    The Bitmaps images files on my hard disk each one is 1920x1080 and Bit depth 32.

    The video file is on the hard disk at size 1.24MB

    This is a screenshot i took from the video file when playing it.
    You can see how bad the quality is.

    screenshot from video bad quality

    This is a link for 10 images of the screenshots i’m using creating from the video file. They are Bitmaps.

    Screenshots rar

    Its something with the arguments :
    This line dosen’t work when i run the program the command prompt window close at once. I can’t even see if there is any erorr/s the command prompt window close too fast.

    psi.Arguments = @"-f libx264 -vcodec libx264 -pix_fmt bgra -video_size 1920x1080 -i \\.\pipe\mytestpipe -map 0 -c:v mpeg4 -r " + BitmapRate + " " + outPath;

    When i’m using this arguments it’s working but making bad quality video :

    psi.Arguments = @"-f rawvideo -pix_fmt bgra -video_size 1920x1080 -i \\.\pipe\mytestpipe -map 0 -c:v mpeg4 -r " + BitmapRate + " " + outPath;