Recherche avancée

Médias (17)

Mot : - Tags -/wired

Autres articles (51)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

Sur d’autres sites (9690)

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

  • unresolved external symbol of ffmpeg avutil.lib

    2 mai 2016, par Richard

    For some reason I can not get rid of this Linker error when using methods from ffmpeg libs !
    I built the ffmpeg libs myself with msys64 and linked the resulting libs to my current project. As soon as I want to use them I get about 10 LNK errors.
    I think I set all required linking right and also use the key word extern "C" without any success.
    When running dumpbin.exe it lists all used symbols, so those libs should be ok...
    Does anyone have a clue what´s going wrong ?

    #pragma once

    extern "C"
    {
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    }

    int main(int argc, char **argv[])
    {
    const char *output_type;
    /* register all the codecs */
    avcodec_register_all();

    return 0;
    }

    The error log looks like this :

    error LNK2019 : unresolved external symbol av_frame_free referenced in function "void __cdecl video_encoding(char const *,int)" (?video_encoding@@YAXPEBDH@Z)
    error LNK2019 : unresolved external symbol avcodec_register_all referenced in function main
    error LNK2019 : unresolved external symbol avcodec_alloc_context3 referenced in function "void __cdecl video_encoding(char const *,int)" (?video_encoding@@YAXPEBDH@Z)
    error LNK2019 : unresolved external symbol avcodec_open2 referenced in function "void __cdecl video_encoding(char const *,int)" (?video_encoding@@YAXPEBDH@Z)
    error LNK2019 : unresolved external symbol avcodec_close referenced in function "void __cdecl video_encoding(char const *,int)" (?video_encoding@@YAXPEBDH@Z)
    error LNK2019 : unresolved external symbol av_init_packet referenced in function "void __cdecl video_encoding(char const *,int)" (?video_encoding@@YAXPEBDH@Z)
    error LNK2019 : unresolved external symbol av_packet_unref referenced in function "void __cdecl video_encoding(char const *,int)" (?video_encoding@@YAXPEBDH@Z)
    error LNK2019 : unresolved external symbol avcodec_find_encoder referenced in function "void __cdecl video_encoding(char const *,int)" (?video_encoding@@YAXPEBDH@Z)
    error LNK2019 : unresolved external symbol avcodec_encode_video2 referenced in function "void __cdecl video_encoding(char const *,int)" (?video_encoding@@YAXPEBDH@Z)
    error LNK2019 : unresolved external symbol av_image_alloc referenced in function "void __cdecl video_encoding(char const *,int)" (?video_encoding@@YAXPEBDH@Z)
    oVideoRendererApp\x64\Debug_64\ImagesToVideoRendererApp.exe : fatal error LNK1120 : 14 unresolved externals

  • How to extract small video chunk with ffmpeg ?

    3 décembre 2017, par Édouard Lopez

    I’m writing a script to split a video in multiple small files based on subtitles timing. Each chunk illustrated how to sign a word LSF (French Sign Language).

    However, some file are blank once extracted and when converted to webm they are 0kb.

    Timing data

    I extract the timing from a .ass file to get this kind of file

    0:00:01.01 0:00:04.07
    0:00:04.09 0:00:07.00
    0:00:07.00 0:00:10.36
    0:00:10.36 0:00:13.28

    First column is start_time, second is end_time

    Extraction

    extract_word_chunk() {
     ffmpeg \
       -i "$INPUT_FILE" \
       -ss "$start" \
       -to "$end" \
       -vcodec copy \
       -acodec copy \
       -loglevel error \
       "$chunk" &lt; /dev/null
    }

    Conversion to webm

    convert_to_webm() {
     ffmpeg \
       -y \
       -i "$chunk" \
       -acodec libvorbis \
       -codec:v libvpx \
       -b:v 192k \
       -b:a 96k \
       -minrate 128k \
       -maxrate 256k \
       -bufsize 192k \
       -quality good \
       -cpu-used 2 \
       -deadline best \
       -loglevel error \
     "$chunk.webm" &lt; /dev/null
    }

    Output

    # extract_word_chunk
    ffmpeg \
     -i 'assets/raw/partie 1: Apprendre 300 mots du quotidien en LSF.jauvert laura.mkv' \
     -ss 0:00:01.01 \
     -to 0:00:04.07 \
     -vcodec copy \
     -acodec copy \
     -loglevel error \
     assets/raw/0:00:01.01.mkv

    # convert_to_webm
    ffmpeg -y \
     -i assets/raw/0:00:01.01.mkv \
     -acodec libvorbis \
     -codec:v libvpx \
     -b:v 192k \
     -b:a 96k \
     -minrate 128k \
     -maxrate 256k \
     -bufsize 192k \
     -quality good \
     -cpu-used 2 \
     -deadline best \
     -loglevel error \
     assets/raw/0:00:01.01.mkv.webm

    Error

    [buffer @ 0x16d8be0] Unable to parse option value "-1" as pixel format
       Last message repeated 1 times
    [buffer @ 0x16d8be0] Error setting option pix_fmt to value -1.
    [graph 0 input from stream 0:0 @ 0x16e6fc0] Error applying options to the filter.

    Question

    Only some chunk are blank/empty.

    How do I prevent my video to be blank/empty ?