Recherche avancée

Médias (91)

Autres articles (21)

  • Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs

    12 avril 2011, par

    La manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
    Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras.

  • Other interesting software

    13 avril 2011, par

    We don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
    The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
    We don’t know them, we didn’t try them, but you can take a peek.
    Videopress
    Website : http://videopress.com/
    License : GNU/GPL v2
    Source code : (...)

  • Les statuts des instances de mutualisation

    13 mars 2010, par

    Pour des raisons de compatibilité générale du plugin de gestion de mutualisations avec les fonctions originales de SPIP, les statuts des instances sont les mêmes que pour tout autre objets (articles...), seuls leurs noms dans l’interface change quelque peu.
    Les différents statuts possibles sont : prepa (demandé) qui correspond à une instance demandée par un utilisateur. Si le site a déjà été créé par le passé, il est passé en mode désactivé. publie (validé) qui correspond à une instance validée par un (...)

Sur d’autres sites (4410)

  • 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;

  • Get blur effect inside a drawn box using ass format

    18 septembre 2024, par Armen Sanoyan

    I have Nodejs application which generates subtitles file for video editing. The editing is done by ffmpeg. For each word I also generate a backdrop with rounded corners using drawing command. Example of dialog for backdrop.

    &#xA;

    Dialogue: 0,00:00:38.60,00:00:42.10,Default,,0,0,0,,{\p1\1a&amp;HD8&amp;\c&amp;HE27FA4&amp;\pos(341.07421875,517.5)\an4}  {\p1}m 15 0 b 1202.8515625 .... {\p0}&#xA;

    &#xA;

    Now I want to make the backdrop blur.&#xA;(Text backdrop by ass formatting)

    &#xA;

    I have tried to use \blur or \be, but they are for other purpose. Below is reference from the doc

    &#xA;

    Enable or disable a subtle softening-effect for the edges of the text

    &#xA;

    Is there any other way to achieve the blurred backdrop. I am ready even to mix ffmpeg commands like boxblur and ass file. I mean separately paint the backdrops and then apply ass subtitles file. Here is an experiment to explain the idea.

    &#xA;

    [0:v]split=3[base][blur1_in][blur2_in];&#xA;&#xA;[blur1_in]crop=w=100:h=100:x=20:y=40[region1];&#xA;[region1]boxblur=luma_radius=10:luma_power=1[blurred_region1];&#xA;[base][blurred_region1]overlay=x=20:y=40:enable=&#x27;between(t,0,5)&#x27;[tmp1];&#xA;&#xA;[blur2_in]crop=w=30:h=30:x=20:y=40[region2];&#xA;[region2]boxblur=luma_radius=5:luma_power=1[blurred_region2];&#xA;[tmp1][blurred_region2]overlay=x=20:y=40:enable=&#x27;between(t,5,10)&#x27;[tmp2];&#xA;&#xA;[tmp2]ass=../logs/ass.ass:fontsdir=../fonts/Audiowide-Regular.ttf[final_video]&#xA;

    &#xA;

    The problem in this case is that the corners are not rounded. Could anyone explain to me what is the easiest way to get backdrop with rounded corners an blurred inside

    &#xA;

  • how to apostrophe with os.system in ffmpeg drawtext in python

    28 septembre 2023, par Ishu singh

    I just want to execute this code with os.system('command') in ffmpeg drawtext() but unable to execute it just because of ' (apostrophe) , it fails

    &#xA;

    The code goes here ->

    &#xA;

    the \f is working as \n but I'm using that for seprating word

    &#xA;

    from PIL import ImageFont&#xA;import os&#xA;&#xA;def create_lines(longline, start, end, fontsize=75, fontfile=&#x27;OpenSansCondensedBold.ttf&#x27;):&#xA;&#xA;    fit = fit_text(longline, 700, fontfile)&#xA;&#xA;    texts = []&#xA;    now = 0&#xA;    # breaking line on basis of &#x27;\f&#x27;&#xA;    for wordIndex in range(len(fit)):&#xA;        if fit[wordIndex] == &#x27;\f&#x27; or wordIndex == len(fit)-1:&#xA;            texts.append(fit[now:wordIndex&#x2B;1].strip(&#x27;\f&#x27;))&#xA;            now = wordIndex&#xA;&#xA;    # adding multiple lines to video&#xA;    string = &#x27;&#x27;&#xA;    count = 0&#xA;    for line in texts:&#xA;        string &#x2B;= f&#x27;&#x27;&#x27;,drawtext=fontfile={fontfile}:fontsize={fontsize}:text=&#x27;{line[enter image description here](https://i.stack.imgur.com/iuceq.png)}&#x27;:fontcolor=black:bordercolor=white:borderw=4:x=(w-text_w)/2:y=(h-text_h)/2-100&#x2B;{count}:&#x27;enable=between(t,{start},{end})&#x27; &#x27;&#x27;&#x27;&#xA;        count &#x2B;= 100&#xA;&#xA;    print(string)&#xA;    return string&#xA;&#xA;def createVideo(content):&#xA;    input_video = &#x27;video.mp4&#x27;&#xA;    output_video = &#x27;output.mp4&#x27;&#xA;    font_file = &#x27;BebasKai.ttf&#x27;&#xA;    text_file = &#x27;OpenSansCondensedBold.ttf&#x27;&#xA;    font_size = 75&#xA;    font_color = &#x27;white&#x27;&#xA;&#xA;    part1 = create_lines(content[1], 0.5, 7)&#xA;    part2 = create_lines(content[2], 7.5, 10)&#xA;&#xA;    os.system(&#xA;        f"""ffmpeg -i {} -vf "drawtext=fontfile={font_file}:fontsize={95}:text={content[0]}:fontcolor={font_color}:box=1:boxcolor=black@0.9:boxborderw=20:x=(w-text_w)/2:y=(h-text_h)/4-100{str(part1)}{str(part2)}" -c:v libx264 -c:a aac -t 10 {output_video} -y""")&#xA;&#xA;my_text =[&#x27;The Brain&#x27;, "Your brain can&#x27;t multitask effectively", "Multitasking is a myth,  it&#x27;s just rapid switching between tasks"]&#xA;&#xA;createVideo(my_text)&#xA;

    &#xA;

    enter image description here

    &#xA;

    what I want is that, I would able to execute this correctly

    &#xA;