
Recherche avancée
Autres articles (36)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Les formats acceptés
28 janvier 2010, parLes commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
ffmpeg -codecs ffmpeg -formats
Les format videos acceptés en entrée
Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
Les formats vidéos de sortie possibles
Dans un premier temps on (...) -
De l’upload à la vidéo finale [version standalone]
31 janvier 2010, parLe 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 (4366)
-
Using SDL2 Render Pixels to create video using ffmpeg
7 juillet 2024, par RiptideI made a small animation using SDL2 and I want to use ffmpeg to convert it to an h264 encoded video. I'm getting the texture RGBA pixels using
SDL_RenderReadPixels
and sending them to ffmpeg for rendering. The video does render, but is all messed up. The following is my code

Spawning ffmpeg


int child_pipe[2];

if (pipe(child_pipe) < 0) {
 perror("child_pipe");
}

printf("child_pipe[0]: %d, child_pipe[1]: %d\n", child_pipe[0], child_pipe[1]);

args.ffmpeg = &(FFMpeg){.std_in = child_pipe[WRITE_END]};

child_pid = fork();

printf("child: %d\n", child_pid);

if (child_pid == 0) {
 close(child_pipe[WRITE_END]);

 if (dup2(child_pipe[READ_END], STDIN_FILENO) < 0) {
 perror("dup2");
 return -1;
 }

 char *argv[] = {"ffmpeg", "-loglevel", "verbose", "-y", "-f", "rawvideo", "-pixel_format", "rgba", "-s",
 "894x702", "-i", "-", "-c:v", "libx264", "-pix_fmt", "yuv420p", "thing.mp4", NULL};

 int x = execvp("ffmpeg", argv);

 if (x != 0) {
 perror("execv");
 return x;
 }

 return -1;
}





Here's how I render into SDL2 renderer. The rendering on SDL2 has no issues. In here I get the render pixels and send them to ffmpeg.


void render_image(SDL_Renderer *renderer, int array[], size_t array_size, Image *image, FFMpeg *ffmpeg) {
 SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
 SDL_RenderClear(renderer);

 for (int i = 0; i < array_size; i++) {
 paint_image_strip(renderer, image, i, array[i]);
 }

 if (ANIMATION_DELAY_MS > 0) {
 SDL_Delay(ANIMATION_DELAY_MS);
 }

 if (ffmpeg != NULL) {
 int size = image->width * image->height * sizeof(Uint32);
 Uint32 *pixels = (Uint32 *)malloc(size);

 if (pixels == NULL) {
 printf("Malloc failed. Buy more ram\n");
 return;
 }

 int ret = SDL_RenderReadPixels(renderer, NULL, SDL_PIXELFORMAT_RGBA8888, pixels, image->width * sizeof(Uint32));

 if (ret != 0) {
 fprintf(stderr, "SDL_RenderReadPixels failed: %s\n", SDL_GetError());
 free(pixels);
 }

 int n = write(ffmpeg->std_in, image->img_data, size);

 if (n < 0) {
 perror("write failed");
 }

 free(pixels);
 }

 SDL_RenderPresent(renderer);
}




Here's the issue. Here is what I see in SDL2 window




and this is what ffmpeg renders



there are inklings of the original image here. I thought it was an issue with RGBA vs ARGB but on double checking that wasn't the case.


Expecting proper ffmpeg rendering.


-
vf_colorchannelmixer : round lut entries to nearest
14 mai 2013, par Michael Niedermayer -
Round number of bits read to next byte
4 décembre 2014, par watwat2014I have a header that can be any number of bits, and there is a variable called ByteAlign that’s calculated by subtracting the current file position from the file position at the beginning of the file, the point of this variable is to pad the header to the next complete byte. so if the header is taking up 57 bits, the ByteAlign variable needs to be 7 bits in length to pad the header to 64 bits total, or 8 bytes.
Solutions that don’t work :
Variable % 8 - 8, the result is the answer, but negative.
8 % Variable ; this is completely inaccurate, and gives answers like 29, which is blatantly wrong, the largest number it should be is 7.
how exactly do I do this ?