
Recherche avancée
Médias (91)
-
DJ Z-trip - Victory Lap : The Obama Mix Pt. 2
15 septembre 2011
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Matmos - Action at a Distance
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
DJ Dolores - Oslodum 2004 (includes (cc) sample of “Oslodum” by Gilberto Gil)
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Danger Mouse & Jemini - What U Sittin’ On ? (starring Cee Lo and Tha Alkaholiks)
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Cornelius - Wataridori 2
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
The Rapture - Sister Saviour (Blackstrobe Remix)
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (105)
-
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...) -
Taille des images et des logos définissables
9 février 2011, parDans beaucoup d’endroits du site, logos et images sont redimensionnées pour correspondre aux emplacements définis par les thèmes. L’ensemble des ces tailles pouvant changer d’un thème à un autre peuvent être définies directement dans le thème et éviter ainsi à l’utilisateur de devoir les configurer manuellement après avoir changé l’apparence de son site.
Ces tailles d’images sont également disponibles dans la configuration spécifique de MediaSPIP Core. La taille maximale du logo du site en pixels, on permet (...) -
Emballe médias : à quoi cela sert ?
4 février 2011, parCe 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" ;
Sur d’autres sites (4563)
-
FFmpeg conversion RGB to YUV420 to RGB wrong result
29 août 2020, par sipwizI'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"

#include <libavcodec></libavcodec>avcodec.h>
#include <libavformat></libavformat>avformat.h>
#include <libavformat></libavformat>avio.h>
#include <libavutil></libavutil>imgutils.h>
#include <libswscale></libswscale>swscale.h>
#include <libavutil></libavutil>time.h>

#define WIDTH 32
#define HEIGHT 32
#define ERROR_LEN 128
#define SWS_FLAGS SWS_BICUBIC

char _errorLog[ERROR_LEN];
void CreateBitmapFile(LPCWSTR fileName, long width, long height, WORD bitsPerPixel, BYTE* bitmapData, DWORD bitmapDataLength);

int main()
{
 printf("FFmpeg Pixel Conversion Test\n");

 av_log_set_level(AV_LOG_DEBUG);

 int w = WIDTH;
 int h = HEIGHT;

 struct SwsContext* rgbToI420Context;
 struct SwsContext* i420ToRgbContext;

 rgbToI420Context = sws_getContext(w, h, AV_PIX_FMT_RGB24, w, h, AV_PIX_FMT_YUV420P, SWS_FLAGS, NULL, NULL, NULL);
 if (rgbToI420Context == NULL) {
 fprintf(stderr, "Failed to allocate RGB to I420 conversion context.\n");
 }

 i420ToRgbContext = sws_getContext(w, h, AV_PIX_FMT_YUV420P, w, h, AV_PIX_FMT_RGB24, SWS_FLAGS, NULL, NULL, NULL);
 if (i420ToRgbContext == NULL) {
 fprintf(stderr, "Failed to allocate I420 to RGB conversion context.\n");
 }

 // Create dummy bitmap.
 uint8_t rgbRaw[WIDTH * HEIGHT * 3];
 for (int row = 0; row < 32; row++)
 {
 for (int col = 0; col < 32; col++)
 {
 int index = row * WIDTH * 3 + col * 3;

 int red = (row < 16 && col < 16) ? 255 : 0;
 int green = (row < 16 && col > 16) ? 255 : 0;
 int blue = (row > 16 && col < 16) ? 255 : 0;

 rgbRaw[index] = (byte)red;
 rgbRaw[index + 1] = (byte)green;
 rgbRaw[index + 2] = (byte)blue;
 }
 }

 CreateBitmapFile(L"test-reference.bmp", WIDTH, HEIGHT, 24, rgbRaw, WIDTH * HEIGHT * 3);

 printf("Converting RGB to I420.\n");

 uint8_t* rgb[3];
 uint8_t* i420[3];
 int rgbStride[3], i420Stride[3];

 rgbStride[0] = w * 3;
 i420Stride[0] = w * h;
 i420Stride[1] = w * h / 4;
 i420Stride[2] = w * h / 4;

 rgb[0] = rgbRaw;
 i420[0] = (uint8_t*)malloc((size_t)i420Stride[0] * h);
 i420[1] = (uint8_t*)malloc((size_t)i420Stride[1] * h);
 i420[2] = (uint8_t*)malloc((size_t)i420Stride[2] * h);

 int toI420Res = sws_scale(rgbToI420Context, rgb, rgbStride, 0, h, i420, i420Stride);
 if (toI420Res < 0) {
 fprintf(stderr, "Conversion from RGB to I420 failed, %s.\n", av_make_error_string(_errorLog, ERROR_LEN, toI420Res));
 }

 printf("Converting I420 to RGB.\n");

 uint8_t* rgbOut[3];
 int rgbOutStride[3];

 rgbOutStride[0] = w * 3;
 rgbOut[0] = (uint8_t*)malloc((size_t)rgbOutStride[0] * h);

 int toRgbRes = sws_scale(i420ToRgbContext, i420, i420Stride, 0, h, rgbOut, rgbOutStride);
 if (toRgbRes < 0) {
 fprintf(stderr, "Conversion from RGB to I420 failed, %s.\n", av_make_error_string(_errorLog, ERROR_LEN, toRgbRes));
 }

 CreateBitmapFile(L"test-output.bmp", WIDTH, HEIGHT, 24, rgbOut, WIDTH * HEIGHT * 3);

 free(rgbOut[0]);

 for (int i = 0; i < 3; i++) {
 free(i420[i]);
 }

 sws_freeContext(rgbToI420Context);
 sws_freeContext(i420ToRgbContext);

 return 0;
}

/**
* Creates a bitmap file and writes to disk.
* @param[in] fileName: the path to save the file at.
* @param[in] width: the width of the bitmap.
* @param[in] height: the height of the bitmap.
* @param[in] bitsPerPixel: colour depth of the bitmap pixels (typically 24 or 32).
* @param[in] bitmapData: a pointer to the bytes containing the bitmap data.
* @param[in] bitmapDataLength: the number of pixels in the bitmap.
*/
void CreateBitmapFile(LPCWSTR fileName, long width, long height, WORD bitsPerPixel, BYTE* bitmapData, DWORD bitmapDataLength)
{
 HANDLE file;
 BITMAPFILEHEADER fileHeader;
 BITMAPINFOHEADER fileInfo;
 DWORD writePosn = 0;

 file = CreateFile(fileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); //Sets up the new bmp to be written to

 fileHeader.bfType = 19778; //Sets our type to BM or bmp
 fileHeader.bfSize = sizeof(fileHeader.bfOffBits) + sizeof(RGBTRIPLE); //Sets the size equal to the size of the header struct
 fileHeader.bfReserved1 = 0; //sets the reserves to 0
 fileHeader.bfReserved2 = 0;
 fileHeader.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER); //Sets offbits equal to the size of file and info header
 fileInfo.biSize = sizeof(BITMAPINFOHEADER);
 fileInfo.biWidth = width;
 fileInfo.biHeight = height;
 fileInfo.biPlanes = 1;
 fileInfo.biBitCount = bitsPerPixel;
 fileInfo.biCompression = BI_RGB;
 fileInfo.biSizeImage = width * height * (bitsPerPixel / 8);
 fileInfo.biXPelsPerMeter = 2400;
 fileInfo.biYPelsPerMeter = 2400;
 fileInfo.biClrImportant = 0;
 fileInfo.biClrUsed = 0;

 WriteFile(file, &fileHeader, sizeof(fileHeader), &writePosn, NULL);

 WriteFile(file, &fileInfo, sizeof(fileInfo), &writePosn, NULL);

 WriteFile(file, bitmapData, bitmapDataLength, &writePosn, NULL);

 CloseHandle(file);
}



The source bitmap is :




The output bmp after the two conversions is :




-
unresolved external symbol of ffmpeg avutil.lib
2 mai 2016, par RichardFor 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 LopezI’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 are0kb
.Timing data
I extract the timing from a
.ass
file to get this kind of file0: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.28First column is
start_time
, second isend_time
Extraction
extract_word_chunk() {
ffmpeg \
-i "$INPUT_FILE" \
-ss "$start" \
-to "$end" \
-vcodec copy \
-acodec copy \
-loglevel error \
"$chunk" < /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" < /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.webmError
[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 ?