Recherche avancée

Médias (91)

Autres articles (32)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

Sur d’autres sites (6451)

  • Anomalie #2972 : Suite du filtre ’minifier’

    8 avril 2013, par denisb -

    tous caches vidés (local/cache-js/ et tmp/cache/) ? et tu as bien le fichier plugins-dist/forum/prive/javascript/actiongroup.js ? si ’oui’ aux deux questions, ton problème est ailleurs...

  • How can i capture a screenshots from pictureBox1 every X milliseconds ?

    9 avril 2016, par Brubaker Haim

    The way it is now it’s capturing screenshots depending on on what screen I am in.
    For example if i’m in my desktop it will take screenshots of my desktop if I move to the form1 and see the pictureBox1 it will take screenshots of the pictureBox1.

    But how can I get directly screenshots from the pictureBox1 no matter on what screen I am ?

    Bitmap bmp1;
           public static int counter = 0;
           private void timer1_Tick(object sender, EventArgs e)
           {
               counter++;

               Rectangle rect = new Rectangle(0, 0, pictureBox1.ClientSize.Width, pictureBox1.ClientSize.Height);
               bmp1 = new Bitmap(rect.Width, rect.Height, PixelFormat.Format32bppArgb);
               Graphics g = Graphics.FromImage(bmp1);
               g.CopyFromScreen(rect.Left, rect.Top, 0, 0, bmp1.Size, CopyPixelOperation.SourceCopy);
               bmp1.Save(@"e:\screenshots\" + "screenshot" + counter.ToString("D6") + ".bmp", ImageFormat.Bmp);
               bmp1.Dispose();
               g.Dispose();
               if (counter == 500)//1200)
               {
                   timer1.Stop();
                   this.Close();
               }
           }

    The timer1 is set now to 100ms interval in the designer.
    But what is a reasonable speed to take screenshots from animation in the pictureBox1 ? In this case I have a game I show in the pictureBox1 and I want to take a screenshots of each frame from the pictureBox1 and in real time to create mp4 video file on the hard disk from each frame I took.

    So instead saving the bmp1 to the hard disk I need somehow to save each frame I capture in memory and build mp4 video file in real time.

    I created a ffmpeg class for that :

    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 ffmpeg
    {
       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 mpeg2video -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();
           }
       }
    }

    And using the ffmpeg class like this :

    public static Ffmpeg fmpeg;

    Then

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

    And

    fmpeg.PushFrame(_screenShot);

    My main question is first how to get the screenshots(frames) from the pictureBox1 directly no matter what screen i’m in now ?

    And how to use on each frame with the fmpeg to get a fine mp4 speed video file I mean that I will not miss a frame to capture all frames and also that the mp4 video file will when I play it later will not display a fast video or too slow ?

  • FFMPEG Incredibly Slow On Windows Server 2016

    1er août 2019, par Ben Gardner

    I have a t2.small (2GB RAM, 1 vCPU) Amazon EC2 instance running a process using FFMPEG. It runs just fine ( 30 fps) on my computer (i7, 12GB RAM), but at around 2 fps on the server. Here’s the command :

    rescale_command = f'ffmpeg -i {srcVideo} -filter_complex \"scale={owidth}:{oheight}, setsar=1:1, pad={dim[0]}:{dim[1]}:{oofx}:{oofy}\" {destVideo}'

    I’ve tried uninstalling and reinstalling ffmpeg/ffprobe

    Edited per llogan’s request, I’ve also discovered that it’s relatively speedy towards the beginning (I’m rescaling 100 times over the course of the program) and slows down towards the end.

    It utilizes 100% of the CPU even from the beginning, though.

    Example command/output :
    ffmpeg -i media/8-1-2019/hi/dl-107.mp4 -filter_complex "scale=607:1080, setsar=1:1, pad=1920:1080:656:0" media/8-1-2019/hi/sl-107.mp4

    ffmpeg version 3.2 Copyright (c) 2000-2016 the FFmpeg developers
     built with gcc 5.4.0 (GCC)
     configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
     libavutil      55. 34.100 / 55. 34.100
     libavcodec     57. 64.100 / 57. 64.100
     libavformat    57. 56.100 / 57. 56.100
     libavdevice    57.  1.100 / 57.  1.100
     libavfilter     6. 65.100 /  6. 65.100
     libswscale      4.  2.100 /  4.  2.100
     libswresample   2.  3.100 /  2.  3.100
     libpostproc    54.  1.100 / 54.  1.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'media/8-1-2019/hi/dl-107.mp4':
     Metadata:
       minor_version   : 512
       major_brand     : isom
       compatible_brands: isomiso2avc1mp41
       comment         : vid:v09044ce0000bks3802jqrog167l3rf0
       encoder         : Lavf58.20.100
     Duration: 00:00:15.12, start: 0.000000, bitrate: 1046 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 540x960 [SAR 1:1 DAR 9:16], 972 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 64 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
    [Parsed_setsar_1 @ 00000000023ac840] num:den syntax is deprecated, please use num/den or named options instead
    [Parsed_setsar_1 @ 00000000023ad2c0] num:den syntax is deprecated, please use num/den or named options instead
    [libx264 @ 00000000023ad800] using SAR=1/1
    [libx264 @ 00000000023ad800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 00000000023ad800] profile High, level 4.0
    [libx264 @ 00000000023ad800] 264 - core 148 r2721 72d53ab - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'media/8-1-2019/hi/sl-107.mp4':
     Metadata:
       minor_version   : 512
       major_brand     : isom
       compatible_brands: isomiso2avc1mp41
       comment         : vid:v09044ce0000bks3802jqrog167l3rf0
       encoder         : Lavf57.56.100
       Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc (default)
       Metadata:
         encoder         : Lavc57.64.100 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
       Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 128 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
         encoder         : Lavc57.64.100 aac
    Stream mapping:
     Stream #0:0 (h264) -> scale (graph 0)
     pad (graph 0) -> Stream #0:0 (libx264)
     Stream #0:1 -> #0:1 (aac (native) -> aac (native))
    Press [q] to stop, [?] for help
    frame=  453 fps=3.6 q=29.0 Lsize=    3016kB time=00:00:15.01 bitrate=1645.7kbits/s speed=0.12x
    video:2763kB audio:237kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.576820%
    [libx264 @ 00000000023ad800] frame I:6     Avg QP:20.93  size: 38467
    [libx264 @ 00000000023ad800] frame P:118   Avg QP:23.12  size: 11624
    [libx264 @ 00000000023ad800] frame B:329   Avg QP:25.19  size:  3725
    [libx264 @ 00000000023ad800] consecutive B-frames:  1.8%  2.6%  4.6% 90.9%
    [libx264 @ 00000000023ad800] mb I  I16..4: 16.4% 76.7%  6.9%
    [libx264 @ 00000000023ad800] mb P  I16..4:  2.3%  5.8%  0.9%  P16..4:  9.8%  3.8%  1.6%  0.0%  0.0%    skip:75.7%
    [libx264 @ 00000000023ad800] mb B  I16..4:  0.4%  0.7%  0.1%  B16..8:  9.5%  1.6%  0.3%  direct: 0.6%  skip:86.8%  L0:43.0% L1:50.8% BI: 6.2%
    [libx264 @ 00000000023ad800] 8x8 transform intra:67.4% inter:78.3%
    [libx264 @ 00000000023ad800] coded y,uvDC,uvAC intra: 32.5% 40.1% 9.4% inter: 2.7% 3.9% 0.1%
    [libx264 @ 00000000023ad800] i16 v,h,dc,p: 50% 25%  6% 19%
    [libx264 @ 00000000023ad800] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 38% 11% 27%  3%  3%  5%  3%  6%  3%
    [libx264 @ 00000000023ad800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 11% 12%  5%  7%  9%  4%  7%  3%
    [libx264 @ 00000000023ad800] i8c dc,h,v,p: 62% 11% 22%  5%
    [libx264 @ 00000000023ad800] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 00000000023ad800] ref P L0: 64.4% 14.3% 16.1%  5.2%
    [libx264 @ 00000000023ad800] ref B L0: 90.6%  7.5%  2.0%
    [libx264 @ 00000000023ad800] ref B L1: 97.7%  2.3%
    [libx264 @ 00000000023ad800] kb/s:1496.84
    [aac @ 0000000000628120] Qavg: 754.761