Recherche avancée

Médias (0)

Mot : - Tags -/images

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

Autres articles (55)

  • Monitoring de fermes de MediaSPIP (et de SPIP tant qu’à faire)

    31 mai 2013, par

    Lorsque l’on gère plusieurs (voir plusieurs dizaines) de MediaSPIP sur la même installation, il peut être très pratique d’obtenir d’un coup d’oeil certaines informations.
    Cet article a pour but de documenter les scripts de monitoring Munin développés avec l’aide d’Infini.
    Ces scripts sont installés automatiquement par le script d’installation automatique si une installation de munin est détectée.
    Description des scripts
    Trois scripts Munin ont été développés :
    1. mediaspip_medias
    Un script de (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Les notifications de la ferme

    1er décembre 2010, par

    Afin d’assurer une gestion correcte de la ferme, il est nécessaire de notifier plusieurs choses lors d’actions spécifiques à la fois à l’utilisateur mais également à l’ensemble des administrateurs de la ferme.
    Les notifications de changement de statut
    Lors d’un changement de statut d’une instance, l’ensemble des administrateurs de la ferme doivent être notifiés de cette modification ainsi que l’utilisateur administrateur de l’instance.
    À la demande d’un canal
    Passage au statut "publie"
    Passage au (...)

Sur d’autres sites (4584)

  • FFmpeg - feed raw frames via pipe - FFmpeg does not detect pipe closure

    8 septembre 2018, par Rumble

    Im trying to follow these examples from C++ in Windows. Phyton Example C# Example

    I have an application that produces raw frames that shall be encoded with FFmpeg.
    The raw frames are transfered via IPC pipe to FFmpegs STDIN. That is working as expected, FFmpeg even displays the number of frames currently available.

    The problem occours when we are done sending frames. When I close the write end of the pipe I would expect FFmpeg to detect that, finish up and output the video. But that does not happen. FFmpeg stays open and seems to wait for more data.

    I made a small test project in VisualStudio.

    #include "stdafx.h"
    //// stdafx.h
    //#include "targetver.h"
    //#include
    //#include
    //#include <iostream>

    #include "Windows.h"
    #include <cstdlib>

    using namespace std;

    bool WritePipe(void* WritePipe, const UINT8 *const Buffer, const UINT32 Length)
    {
       if (WritePipe == nullptr || Buffer == nullptr || Length == 0)
       {
           cout &lt;&lt; __FUNCTION__ &lt;&lt; ": Some input is useless";
           return false;
       }

       // Write to pipe
       UINT32 BytesWritten = 0;
       UINT8 newline = '\n';
       bool bIsWritten = WriteFile(WritePipe, Buffer, Length, (::DWORD*)&amp;BytesWritten, nullptr);
       cout &lt;&lt; __FUNCTION__ &lt;&lt; " Bytes written to pipe " &lt;&lt; BytesWritten &lt;&lt; endl;
       //bIsWritten = WriteFile(WritePipe, &amp;newline, 1, (::DWORD*)&amp;BytesWritten, nullptr); // Do we need this? Actually this should destroy the image.

       FlushFileBuffers(WritePipe); // Do we need this?

       return bIsWritten;
    }

    #define PIXEL 80 // must be multiple of 8. Otherwise we get warning: Bytes are not aligned

    int main()
    {
       HANDLE PipeWriteEnd = nullptr;
       HANDLE PipeReadEnd = nullptr;
       {
           // create us a pipe for inter process communication
           SECURITY_ATTRIBUTES Attr = { sizeof(SECURITY_ATTRIBUTES), NULL, true };
           if (!CreatePipe(&amp;PipeReadEnd, &amp;PipeWriteEnd, &amp;Attr, 0))
           {
               cout &lt;&lt; "Could not create pipes" &lt;&lt; ::GetLastError() &lt;&lt; endl;
               system("Pause");
               return 0;
           }
       }

       // Setup the variables needed for CreateProcess
       // initialize process attributes
       SECURITY_ATTRIBUTES Attr;
       Attr.nLength = sizeof(SECURITY_ATTRIBUTES);
       Attr.lpSecurityDescriptor = NULL;
       Attr.bInheritHandle = true;

       // initialize process creation flags
       UINT32 CreateFlags = NORMAL_PRIORITY_CLASS;
       CreateFlags |= CREATE_NEW_CONSOLE;

       // initialize window flags
       UINT32 dwFlags = 0;
       UINT16 ShowWindowFlags = SW_HIDE;

       if (PipeWriteEnd != nullptr || PipeReadEnd != nullptr)
       {
           dwFlags |= STARTF_USESTDHANDLES;
       }

       // initialize startup info
       STARTUPINFOA StartupInfo = {
           sizeof(STARTUPINFO),
           NULL, NULL, NULL,
           (::DWORD)CW_USEDEFAULT,
           (::DWORD)CW_USEDEFAULT,
           (::DWORD)CW_USEDEFAULT,
           (::DWORD)CW_USEDEFAULT,
           (::DWORD)0, (::DWORD)0, (::DWORD)0,
           (::DWORD)dwFlags,
           ShowWindowFlags,
           0, NULL,
           HANDLE(PipeReadEnd),
           HANDLE(nullptr),
           HANDLE(nullptr)
       };

       LPSTR ffmpegURL = "\"PATHTOFFMPEGEXE\" -y -loglevel verbose -f rawvideo -vcodec rawvideo -framerate 1 -video_size 80x80 -pixel_format rgb24 -i - -vcodec mjpeg -framerate 1/4 -an \"OUTPUTDIRECTORY\"";

       // Finally create the process
       PROCESS_INFORMATION ProcInfo;
       if (!CreateProcessA(NULL, ffmpegURL, &amp;Attr, &amp;Attr, true, (::DWORD)CreateFlags, NULL, NULL, &amp;StartupInfo, &amp;ProcInfo))
       {
           cout &lt;&lt; "CreateProcess failed " &lt;&lt; ::GetLastError() &lt;&lt; endl;
       }
       //CloseHandle(ProcInfo.hThread);


           // Create images and write to pipe
    #define MYARRAYSIZE (PIXEL*PIXEL*3) // each pixel has 3 bytes

       UINT8* Bitmap = new UINT8[MYARRAYSIZE];

       for (INT32 outerLoopIndex = 9; outerLoopIndex >= 0; --outerLoopIndex)   // frame loop
       {
           for (INT32 innerLoopIndex = MYARRAYSIZE - 1; innerLoopIndex >= 0; --innerLoopIndex) // create the pixels for each frame
           {
               Bitmap[innerLoopIndex] = (UINT8)(outerLoopIndex * 20); // some gray color
           }
           system("pause");
           if (!WritePipe(PipeWriteEnd, Bitmap, MYARRAYSIZE))
           {
               cout &lt;&lt; "Failed writing to pipe" &lt;&lt; endl;
           }
       }

       // Done sending images. Tell the other process. IS THIS NEEDED? HOW TO TELL FFmpeg WE ARE DONE?
       //UINT8 endOfFile = 0xFF; // EOF = -1 == 1111 1111 for uint8
       //if (!WritePipe(PipeWriteEnd, &amp;endOfFile, 1))
       //{
       //  cout &lt;&lt; "Failed writing to pipe" &lt;&lt; endl;
       //}
       //FlushFileBuffers(PipeReadEnd); // Do we need this?

       delete Bitmap;


       system("pause");

       // clean stuff up
       FlushFileBuffers(PipeWriteEnd); // Do we need this?

       if (PipeWriteEnd != NULL &amp;&amp; PipeWriteEnd != INVALID_HANDLE_VALUE)
       {
           CloseHandle(PipeWriteEnd);
       }

       // We do not want to destroy the read end of the pipe? Should not as that belongs to FFmpeg
       //if (PipeReadEnd != NULL &amp;&amp; PipeReadEnd != INVALID_HANDLE_VALUE)
       //{
       //  ::CloseHandle(PipeReadEnd);
       //}


       return 0;

    }
    </cstdlib></iostream>

    And here the output of FFmpeg

    ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers
     built with gcc 7.2.0 (GCC)
     configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx
     libavutil      55. 78.100 / 55. 78.100
     libavcodec     57.107.100 / 57.107.100
     libavformat    57. 83.100 / 57. 83.100
     libavdevice    57. 10.100 / 57. 10.100
     libavfilter     6.107.100 /  6.107.100
     libswscale      4.  8.100 /  4.  8.100
     libswresample   2.  9.100 /  2.  9.100
     libpostproc    54.  7.100 / 54.  7.100
    [rawvideo @ 00000221ff992120] max_analyze_duration 5000000 reached at 5000000 microseconds st:0
    Input #0, rawvideo, from 'pipe:':
     Duration: N/A, start: 0.000000, bitrate: 153 kb/s
       Stream #0:0: Video: rawvideo, 1 reference frame (RGB[24] / 0x18424752), rgb24, 80x80, 153 kb/s, 1 fps, 1 tbr, 1 tbn, 1 tbc
    Stream mapping:
     Stream #0:0 -> #0:0 (rawvideo (native) -> mjpeg (native))
    [graph 0 input from stream 0:0 @ 00000221ff999c20] w:80 h:80 pixfmt:rgb24 tb:1/1 fr:1/1 sar:0/1 sws_param:flags=2
    [auto_scaler_0 @ 00000221ffa071a0] w:iw h:ih flags:'bicubic' interl:0
    [format @ 00000221ffa04e20] auto-inserting filter 'auto_scaler_0' between the filter 'Parsed_null_0' and the filter 'format'
    [swscaler @ 00000221ffa0a780] deprecated pixel format used, make sure you did set range correctly
    [auto_scaler_0 @ 00000221ffa071a0] w:80 h:80 fmt:rgb24 sar:0/1 -> w:80 h:80 fmt:yuvj444p sar:0/1 flags:0x4
    Output #0, mp4, to 'c:/users/vr3/Documents/Guenni/sometest.mp4':
     Metadata:
       encoder         : Lavf57.83.100
       Stream #0:0: Video: mjpeg, 1 reference frame (mp4v / 0x7634706D), yuvj444p(pc), 80x80, q=2-31, 200 kb/s, 1 fps, 16384 tbn, 1 tbc
       Metadata:
         encoder         : Lavc57.107.100 mjpeg
       Side data:
         cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
    frame=   10 fps=6.3 q=1.6 size=       0kB time=00:00:09.00 bitrate=   0.0kbits/s speed=5.63x

    As you can see in the last line of te FFmpeg output, the images got trough. 10 frames are available. But after closing the pipe, FFmpeg does not close, still expecting input.

    As the linked examples show, this should be a valid method.

    Trying for a week now...

  • How to encode with ffmpeg if number of images smaller than GOP size

    10 avril 2013, par theateist

    The code bellow creates mp4 video file from jpeg images. When number of images is greater than GOP size the encoding success and after 10th image gotPacket that returned by avcodec_encode_video2 is > 0.

    BUT when number of images is smaller than GOP size gotPacket is always = 0 and therefore no images written to the file.

    My guess is that avcodec_encode_video2 allocates buffer with length equals to GOP size and until it won't be full gotPacket will be 0.

    My question is how to force avcodec_encode_video2 to encode even if it's buffer is not full ?

    ...
    _outStream->codec.gop_size = 10;
    _outStream->codec.keyint_min = 10;
    ...

    AVFrame* frame = getFrame();


    AVPacket packet;
    av_init_packet(&amp;packet);
    packet.data = NULL;
    packet.size = 0;

    int gotPacket = 0;
    if (avcodec_encode_video2(_outStream->codec, &amp;packet, frame, &amp;gotPacket) &lt; 0)
       throw std::runtime_error("failed to encode frame");

    if (gotPacket)
    {
       ...
       if (av_write_frame(_outContainer.get(), &amp;packet) &lt; 0)
           throw std::runtime_error("failed to write frame");      
       av_free_packet(&amp;packet);
    }
  • FFmpeg returning an error - What does it mean ?

    19 mars 2013, par user1031947

    I am using FFmpeg, libmp3lame & libx264 along with the node fluent-ffmpeg module. This is my first foray into processing uploaded videos.

    From node, I use the following code to process an uploaded video :

    var proc = new ffmpeg({ source: src, nolog: true })
       .usingPreset( "podcast" )
       .withAudioCodec( "libmp3lame" )
       .saveToFile( dest, function( retcode, err ){
            if( err ) throw err;
            ...
       });

    When I try to process a video, this fails with the following error, which I don't understand. I am hoping someone here can help point me in the right direction. Thanks !

    > ffmpeg version 0.8.5-6:0.8.5-1, Copyright (c) 2000-2012 the Libav
    > developers   built on Jan 13 2013 12:05:48 with gcc 4.7.2
    > *** THIS PROGRAM IS DEPRECATED *** This program is only provided for compatibility and will be removed in a future release. Please use
    > avconv instead.
    >
    > Seems stream 0 codec frame rate differs from container frame rate:
    > 5994.00 (5994/1) -> 29.97 (2997/100) Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
    > &#39;/home/ssp/resources/tmp/32111bf4217e87c23328ec81c56c7d02&#39;:  
    > Metadata:
    >     major_brand     : M4VP
    >     minor_version   : 1
    >     compatible_brands: M4VPM4A mp42isom
    >     creation_time   : 2008-08-26 17:28:47   Duration: 00:00:08.01, start: 0.000000, bitrate: 944 kb/s
    >     Stream #0.0(eng): Video: h264 (Constrained Baseline), yuv420p, 480x272, 815 kb/s, 29.97 fps, 29.97 tbr, 2997 tbn, 5994 tbc
    >     Metadata:
    >       creation_time   : 2008-08-26 17:28:47
    >     Stream #0.1(eng): Audio: aac, 44100 Hz, stereo, s16, 124 kb/s
    >     Metadata:
    >       creation_time   : 2008-08-26 17:28:47 [buffer @ 0xb685a0] w:480 h:272 pixfmt:yuv420p [scale @ 0xb63280] w:480 h:272 fmt:yuv420p ->
    > w:320 h:176 fmt:yuv420p flags:0x4 [libx264 @ 0xb67c20] VBV maxrate
    > unspecified, assuming CBR [libx264 @ 0xb67c20] using cpu capabilities:
    > MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX [libx264 @ 0xb67c20]
    > profile Main, level 1.3 Output #0, m4v, to
    > &#39;/home/ssp/resources/users/11/026468c8f4ea1beee0a585ebc2208137.m4v&#39;:  
    > Metadata:
    >     major_brand     : M4VP
    >     minor_version   : 1
    >     compatible_brands: M4VPM4A mp42isom
    >     creation_time   : 2008-08-26 17:28:47
    >     encoder         : Lavf53.21.1
    >     Stream #0.0(eng): Video: libx264, yuv420p, 320x176, q=10-51, 512 kb/s, 90k tbn, 29.97 tbc
    >     Metadata:
    >       creation_time   : 2008-08-26 17:28:47
    >     Stream #0.1(eng): Audio: libmp3lame, 44100 Hz, 1 channels, s16, 128 kb/s
    >     Metadata:
    >       creation_time   : 2008-08-26 17:28:47 Stream mapping:   Stream #0.0 -> #0.0   Stream #0.1 -> #0.1 Press ctrl-c to stop encoding frame=  240 fps=154 q=11.0 Lsize=     642kB time=7.97 bitrate=
    > 659.3kbits/s     video:516kB audio:126kB global headers:0kB muxing overhead 0.000000% frame I:1     Avg QP:15.35  size:  9995 [libx264 @
    > 0xb67c20] frame P:77    Avg QP:13.25  size:  5419 [libx264 @ 0xb67c20]
    > frame B:162   Avg QP:18.31  size:   625 [libx264 @ 0xb67c20]
    > consecutive B-frames:  2.5% 12.5% 30.0% 55.0% [libx264 @ 0xb67c20] mb
    > I  I16..4:  9.1%  0.0% 90.9% [libx264 @ 0xb67c20] mb P  I16..4:  2.1%
    > 0.0%  2.8%  P16..4: 18.0% 29.9% 44.8%  0.0%  0.0%    skip: 2.3% [libx264 @ 0xb67c20] mb B  I16..4:  0.1%  0.0%  0.0%  B16..8: 35.2%
    > 20.2%  1.9%  direct:14.5%  skip:28.1%  L0:26.3% L1:38.1% BI:35.6% [libx264 @ 0xb67c20] coded y,uvDC,uvAC intra: 83.7% 91.7% 84.7% inter:
    > 27.7% 43.4% 13.9% [libx264 @ 0xb67c20] i16 v,h,dc,p: 20% 29% 42%  9% [libx264 @ 0xb67c20] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 29% 20%  4%
    > 8%  6%  9%  3%  4% [libx264 @ 0xb67c20] i8c dc,h,v,p: 60% 19% 16%  5%
    > [libx264 @ 0xb67c20] Weighted P-Frames: Y:2.6% UV:0.0% [libx264 @
    > 0xb67c20] ref P L0: 75.6% 13.5%  8.0%  2.8%  0.1% [libx264 @ 0xb67c20]
    > ref B L0: 94.5%  5.5% [libx264 @ 0xb67c20] kb/s:528.00