Recherche avancée

Médias (91)

Autres articles (31)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

Sur d’autres sites (3877)

  • ffmpeg transparent png frames to webm gets autocropped and opaque instead of showing the input frames

    26 mai 2022, par Regda

    i got a webm file that outputs transparency as black if transparency is not supported, but unpacking the webm file to png frames outputs the pngs with transparency.
I tried to repack the transparent png frames into a webm file that behaves like described above (transparent but black if not supported).

    


    The current issue (where i need help) is that it looks like ffmpeg applies some sort of optimization, which creates an area filled with an analyzed color, cropping it to the size of the opaque content/pixels and leaving the rest white.
    
And i don't want this.

    


    Related to VLC the metadata of the original says that Lavc58.65.102 libvpx-vp9 was used as encoder and that the Stream0 has the following informations :

    


    Codec: Google/On2's VP9 Video (VP90)
Language: English
Type: Video
Video resolution: 816x624
Buffer dimensions: 816x640
Frame rate: 30.000300
Decoded format: Planar 4:2:0 YUV
Orientation: Top left


    


    To reproduce the issue i created 2 transparent frames (a green and a blue cross) where the opaque content is smaller then the image size and copied them 10-times to be able to actually preview the webm file in vlc, the 2 frames do look like below :
shows the 2 different frames used for reproducing the transparency issue

    


    Then i clicked together the following ffmpeg command and executed it :
    
ffmpeg -framerate 30 -t 7.2 -i frames/%04d.png -b:v 1307k -c:v libvpx-vp9 -color_range 1 -pix_fmt yuva420p -metadata:s:v:0 alpha_mode="1" out.webm
(changing the pixel format e.g. from yuv to yuva doesn't seem to change anything)

    


    ffmpeg console output :

    


    ffmpeg version N-102605-g4c705a2775 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10-win32 (GCC) 20210408
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-version3 --disable-debug --enable-shared --disable-static --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libvmaf --enable-vulkan --enable-amf --enable-libaom --disable-avisynth --enable-libdav1d --disable-libdavs2 --enable-ffnvcodec --enable-cuda-llvm --enable-libglslang --enable-libgme --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librav1e --disable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libvidstab --disable-libx264 --disable-libx265 --disable-libxavs2 --disable-libxvid --enable-libzimg --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp
  libavutil      57.  0.100 / 57.  0.100
  libavcodec     59.  1.100 / 59.  1.100
  libavformat    59.  2.101 / 59.  2.101
  libavdevice    59.  0.100 / 59.  0.100
  libavfilter     8.  0.101 /  8.  0.101
  libswscale      6.  0.100 /  6.  0.100
  libswresample   4.  0.100 /  4.  0.100
Input #0, image2, from 'frames/%04d.png':
  Duration: 00:00:00.67, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: png, rgba(pc), 816x624 [SAR 2835:2835 DAR 17:13], 30 fps, 30 tbr, 30 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (png (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help
[libvpx-vp9 @ 000001c97b52b000] v1.10.0
Output #0, webm, to 'out.webm':
  Metadata:
    encoder         : Lavf59.2.101
  Stream #0:0: Video: vp9, yuv420p(tv, progressive), 816x624 [SAR 1:1 DAR 17:13], q=2-31, 1307 kb/s, 30 fps, 1k tbn
    Metadata:
      alpha_mode      : 1
      encoder         : Lavc59.1.100 libvpx-vp9
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame=   20 fps=0.0 q=0.0 Lsize=       2kB time=00:00:00.63 bitrate=  21.5kbits/s speed=1.09x
video:1kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 68.316833%


    


    an playback of the webm file in vlc shows something totaly different, the area of the cross is filled in its color and the rest is white where it all should be black and transparent if possible (yes i know in vlc it's not possible...) :
    
out.webm in vlc shows an block instead of the a green or blue cross

    


    It would be nice to have an ffmpeg command that does produce the expected result (webm video showing a cross on black/transparent background)

    


    PS : Related to the Title of this post : I don't know how this issue is called, so feel free to edit the Title, im out of ideas.

    


  • FFmpeg conversion RGB to YUV420 to RGB wrong result

    29 août 2020, par sipwiz

    I'm attempting to sort out a video encoding issue and along the way making sure I can convert between pixel formats with FFmpeg. I'm having a problem converting a dummy RGB24 bitmap to YUV420 and back again.

    


    Below is my test program :

    


    #include "Windows.h"&#xA;&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libavformat></libavformat>avio.h>&#xA;#include <libavutil></libavutil>imgutils.h>&#xA;#include <libswscale></libswscale>swscale.h>&#xA;#include <libavutil></libavutil>time.h>&#xA;&#xA;#define WIDTH 32&#xA;#define HEIGHT 32&#xA;#define ERROR_LEN 128&#xA;#define SWS_FLAGS SWS_BICUBIC&#xA;&#xA;char _errorLog[ERROR_LEN];&#xA;void CreateBitmapFile(LPCWSTR fileName, long width, long height, WORD bitsPerPixel, BYTE* bitmapData, DWORD bitmapDataLength);&#xA;&#xA;int main()&#xA;{&#xA;  printf("FFmpeg Pixel Conversion Test\n");&#xA;&#xA;  av_log_set_level(AV_LOG_DEBUG);&#xA;&#xA;  int w = WIDTH;&#xA;  int h = HEIGHT;&#xA;&#xA;  struct SwsContext* rgbToI420Context;&#xA;  struct SwsContext* i420ToRgbContext;&#xA;&#xA;  rgbToI420Context = sws_getContext(w, h, AV_PIX_FMT_RGB24, w, h, AV_PIX_FMT_YUV420P, SWS_FLAGS, NULL, NULL, NULL);&#xA;  if (rgbToI420Context == NULL) {&#xA;    fprintf(stderr, "Failed to allocate RGB to I420 conversion context.\n");&#xA;  }&#xA;&#xA;  i420ToRgbContext = sws_getContext(w, h, AV_PIX_FMT_YUV420P, w, h, AV_PIX_FMT_RGB24, SWS_FLAGS, NULL, NULL, NULL);&#xA;  if (i420ToRgbContext == NULL) {&#xA;    fprintf(stderr, "Failed to allocate I420 to RGB conversion context.\n");&#xA;  }&#xA;&#xA;  // Create dummy bitmap.&#xA;  uint8_t rgbRaw[WIDTH * HEIGHT * 3];&#xA;  for (int row = 0; row &lt; 32; row&#x2B;&#x2B;)&#xA;  {&#xA;    for (int col = 0; col &lt; 32; col&#x2B;&#x2B;)&#xA;    {&#xA;      int index = row * WIDTH * 3 &#x2B; col * 3;&#xA;&#xA;      int red = (row &lt; 16 &amp;&amp; col &lt; 16) ? 255 : 0;&#xA;      int green = (row &lt; 16 &amp;&amp; col > 16) ? 255 : 0;&#xA;      int blue = (row > 16 &amp;&amp; col &lt; 16) ? 255 : 0;&#xA;&#xA;      rgbRaw[index] = (byte)red;&#xA;      rgbRaw[index &#x2B; 1] = (byte)green;&#xA;      rgbRaw[index &#x2B; 2] = (byte)blue;&#xA;    }&#xA;  }&#xA;&#xA;  CreateBitmapFile(L"test-reference.bmp", WIDTH, HEIGHT, 24, rgbRaw, WIDTH * HEIGHT * 3);&#xA;&#xA;  printf("Converting RGB to I420.\n");&#xA;&#xA;  uint8_t* rgb[3];&#xA;  uint8_t* i420[3];&#xA;  int rgbStride[3], i420Stride[3];&#xA;&#xA;  rgbStride[0] = w * 3;&#xA;  i420Stride[0] = w * h;&#xA;  i420Stride[1] = w * h / 4;&#xA;  i420Stride[2] = w * h / 4;&#xA;&#xA;  rgb[0] = rgbRaw;&#xA;  i420[0] = (uint8_t*)malloc((size_t)i420Stride[0] * h);&#xA;  i420[1] = (uint8_t*)malloc((size_t)i420Stride[1] * h);&#xA;  i420[2] = (uint8_t*)malloc((size_t)i420Stride[2] * h);&#xA;&#xA;  int toI420Res = sws_scale(rgbToI420Context, rgb, rgbStride, 0, h, i420, i420Stride);&#xA;  if (toI420Res &lt; 0) {&#xA;    fprintf(stderr, "Conversion from RGB to I420 failed, %s.\n", av_make_error_string(_errorLog, ERROR_LEN, toI420Res));&#xA;  }&#xA;&#xA;  printf("Converting I420 to RGB.\n");&#xA;&#xA;  uint8_t* rgbOut[3];&#xA;  int rgbOutStride[3];&#xA;&#xA;  rgbOutStride[0] = w * 3;&#xA;  rgbOut[0] = (uint8_t*)malloc((size_t)rgbOutStride[0] * h);&#xA;&#xA;  int toRgbRes = sws_scale(i420ToRgbContext, i420, i420Stride, 0, h, rgbOut, rgbOutStride);&#xA;  if (toRgbRes &lt; 0) {&#xA;    fprintf(stderr, "Conversion from RGB to I420 failed, %s.\n", av_make_error_string(_errorLog, ERROR_LEN, toRgbRes));&#xA;  }&#xA;&#xA;  CreateBitmapFile(L"test-output.bmp", WIDTH, HEIGHT, 24, rgbOut, WIDTH * HEIGHT * 3);&#xA;&#xA;  free(rgbOut[0]);&#xA;&#xA;  for (int i = 0; i &lt; 3; i&#x2B;&#x2B;) {&#xA;    free(i420[i]);&#xA;  }&#xA;&#xA;  sws_freeContext(rgbToI420Context);&#xA;  sws_freeContext(i420ToRgbContext);&#xA;&#xA;  return 0;&#xA;}&#xA;&#xA;/**&#xA;* Creates a bitmap file and writes to disk.&#xA;* @param[in] fileName: the path to save the file at.&#xA;* @param[in] width: the width of the bitmap.&#xA;* @param[in] height: the height of the bitmap.&#xA;* @param[in] bitsPerPixel: colour depth of the bitmap pixels (typically 24 or 32).&#xA;* @param[in] bitmapData: a pointer to the bytes containing the bitmap data.&#xA;* @param[in] bitmapDataLength: the number of pixels in the bitmap.&#xA;*/&#xA;void CreateBitmapFile(LPCWSTR fileName, long width, long height, WORD bitsPerPixel, BYTE* bitmapData, DWORD bitmapDataLength)&#xA;{&#xA;  HANDLE file;&#xA;  BITMAPFILEHEADER fileHeader;&#xA;  BITMAPINFOHEADER fileInfo;&#xA;  DWORD writePosn = 0;&#xA;&#xA;  file = CreateFile(fileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);  //Sets up the new bmp to be written to&#xA;&#xA;  fileHeader.bfType = 19778;                                                                    //Sets our type to BM or bmp&#xA;  fileHeader.bfSize = sizeof(fileHeader.bfOffBits) &#x2B; sizeof(RGBTRIPLE);                         //Sets the size equal to the size of the header struct&#xA;  fileHeader.bfReserved1 = 0;                                                                   //sets the reserves to 0&#xA;  fileHeader.bfReserved2 = 0;&#xA;  fileHeader.bfOffBits = sizeof(BITMAPFILEHEADER) &#x2B; sizeof(BITMAPINFOHEADER);                                           //Sets offbits equal to the size of file and info header&#xA;  fileInfo.biSize = sizeof(BITMAPINFOHEADER);&#xA;  fileInfo.biWidth = width;&#xA;  fileInfo.biHeight = height;&#xA;  fileInfo.biPlanes = 1;&#xA;  fileInfo.biBitCount = bitsPerPixel;&#xA;  fileInfo.biCompression = BI_RGB;&#xA;  fileInfo.biSizeImage = width * height * (bitsPerPixel / 8);&#xA;  fileInfo.biXPelsPerMeter = 2400;&#xA;  fileInfo.biYPelsPerMeter = 2400;&#xA;  fileInfo.biClrImportant = 0;&#xA;  fileInfo.biClrUsed = 0;&#xA;&#xA;  WriteFile(file, &amp;fileHeader, sizeof(fileHeader), &amp;writePosn, NULL);&#xA;&#xA;  WriteFile(file, &amp;fileInfo, sizeof(fileInfo), &amp;writePosn, NULL);&#xA;&#xA;  WriteFile(file, bitmapData, bitmapDataLength, &amp;writePosn, NULL);&#xA;&#xA;  CloseHandle(file);&#xA;}&#xA;

    &#xA;

    The source bitmap is :

    &#xA;

    Reference bitmap

    &#xA;

    The output bmp after the two conversions is :

    &#xA;

    Output bitmap

    &#xA;

  • `sage -pip install —user ffmpeg` did not make the "`OSError : Error : ffmpeg does not appear to be installed.`" message go away

    2 septembre 2019, par SomeoneElse

    I am running a Docker instance of Cocalc on a Ubuntu 16 server. Everything seems to be working but I am trying to debug why sage -pip install --user ffmpeg did not make the "OSError: Error: ffmpeg does not appear to be installed." message go away, even though it said it had been installed. Here is the full message.

    Error in lines 9-9
    Traceback (most recent call last):
     File "/usr/local/sage/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1188, in execute
       flags=compile_flags) in namespace, locals
     File "", line 1, in <module>
     File "/usr/local/sage/local/lib/python2.7/site-packages/smc_sagews/sage_salvus.py", line 2944, in show
       s = show0(objs, combine_all=True)
     File "/usr/local/sage/local/lib/python2.7/site-packages/smc_sagews/sage_salvus.py", line 2903, in show0
       b = show0(a)
     File "/usr/local/sage/local/lib/python2.7/site-packages/smc_sagews/sage_salvus.py", line 2868, in show0
       show_animation(obj, **kwds)
     File "/usr/local/sage/local/lib/python2.7/site-packages/smc_sagews/sage_salvus.py", line 2642, in show_animation
       obj.ffmpeg(t, delay=delay, **kwds)
     File "/usr/local/sage/local/lib/python2.7/site-packages/sage/plot/animate.py", line 885, in ffmpeg
       raise OSError(msg)
    OSError: Error: ffmpeg does not appear to be installed. Saving an animation to
    a movie file in any format other than GIF requires this software, so
    please install it and try again.
    </module>

    For reference, here is the code that gives the error :

    n = var("n")
    frames = []
    xr = (x, 0, 1)
    for k in srange(1, 50):
       g = plot((sum((-1)^(n-1)*sin(n*x)/n,n,1,k)), xr, color="blue", legend_label='k = %d' % k)
       g += plot(x/2, xr, color="green", legend_label="x/2")
       frames.append(g)

    a = animate(frames, ymin=0.0, ymax=1.0, legend_loc=(0.2,0.8))
    a.show()