
Recherche avancée
Autres articles (55)
-
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
-
Selection of projects using MediaSPIP
2 mai 2011, parThe examples below are representative elements of MediaSPIP specific uses for specific projects.
MediaSPIP farm @ Infini
The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...) -
Sélection de projets utilisant MediaSPIP
29 avril 2011, parLes exemples cités ci-dessous sont des éléments représentatifs d’usages spécifiques de MediaSPIP pour certains projets.
Vous pensez avoir un site "remarquable" réalisé avec MediaSPIP ? Faites le nous savoir ici.
Ferme MediaSPIP @ Infini
L’Association Infini développe des activités d’accueil, de point d’accès internet, de formation, de conduite de projets innovants dans le domaine des Technologies de l’Information et de la Communication, et l’hébergement de sites. Elle joue en la matière un rôle unique (...)
Sur d’autres sites (4662)
-
ffmpeg : pad filter with transparent background for GIF input/output ?
23 janvier 2023, par Yami OdymelI'm trying to pad the GIF source to a square thumbnail and the extended area should be transparent.


(image source : https://store.steampowered.com/app/2113680/The_Dot/)




To achieve the goal, I used the following command :


ffmpeg -i ./test/source.gif -filter_complex "[0]scale=255:144[s1];[s1]pad=256:256:0:-56:blue[s2];[s2]split[s3][s4];[s3]palettegen=reserve_transparent=on:transparency_color=blue[p];[s4][p]paletteuse[s5]" -map [s5] -loop 0 ./test/output.gif -y



- 

-
[0]scale=255:144[s1]
First I scale down the image.

-
[s1]pad=256:256:0:-56:blue[s2]
Then pad the image with an uncommon background color :blue


-
[s2]split[s3][s4]
And I split to two streams. One forpalettegen
and another forpaletteuse
.

-
[s3]palettegen=reserve_transparent=on:transparency_color=blue[p]
Generate the color palette that indicatesblue
as thetransparency_color


-
[s4][p]paletteuse[s5]
Use the new color palette for output. The padded image withblue
background color should be treated as a transparent background.













But the output animated GIF still has a visible blue background color no matter if I put the
paletteuse
at first or in the end.



Related posts :


- 

- Making GIFs with ffmpeg : what does "transparency_color" do ?
- How do I resize an animated GIF and keep transparency ?
- Transparency is gone while resizing (scaling) gif using ffmpeg








-
-
How can I record a rectangle centered around the mouse cursor when it last moved
28 décembre 2022, par VesoripiI would like an ffmpeg incantation that will do A, or B, or C where


A is…
The ffmpeg incantation will record a rectangle that is centered around the caret (the "text cursor") when text is being typed.


B is…
The ffmpeg incantation will record a rectangle that is centered around the mouse cursor when the mouse cursor is actually moving or when the mouse cursor had been moving less than, say, 2 seconds ago.


C is…
The ffmpeg incantation will stop recording video, yet continue to record audio, if the mouse cursor had not been moving for 2 seconds or longer and the caret (the "text cursor") had not been moving for 2 seconds or longer.


On Linux Mint 21.1 Cinnamon, although both of the following incantations…


ffmpeg -f x11grab -follow_mouse centered -framerate 25 -video_size cif -i :0.0 -preset slow output.mkv



and


ffmpeg -f x11grab -follow_mouse centered -show_region 1 -framerate 25 -video_size cif -i :0.0 -c:v libx264 -crf 0 -preset slow output.mp4



successfully record the mouse cursor as I would like, obviously both incantations fail to record the caret (the "text cursor") when text is being typed.


Here’s my use case…


As a form of documentation, I intend to create screencasts of my coding sessions which I will narrate. I realize that this unusual form of documentation would normally result in large video files. Therefore, instead of recording the entire screen, I would like to record a small rectangle around either the area where I am typing text or—when I am using my mouse—around the area my mouse cursor is located. As a result I hope to create video files which take up less storage space, yet are still useful to me.


For example, I hope that when I review my coding sessions I will be able to quickly be reminded that, for example, "Oh, yeah, that's what I was thinking when I wrote that line of code. Yes. Now I remember : I was stuck, then went to Stackoverflow, did some research, and found solution XYZ to solve my problem.”


In other words, I won’t exclusively be coding during my coding sessions ; sometimes I will be doing research on, for example, Stackoverflow. When I am doing research on—for example, Stackoverflow—I want my mouse cursor recorded.


For your information,
follow_mouse
at 3.21.1 Options.

-
Turn off sw_scale conversion to planar YUV 32 byte alignment requirements
8 novembre 2022, par flanselI am experiencing artifacts on the right edge of scaled and converted images when converting into planar YUV pixel formats with sw_scale. I am reasonably sure (although I can not find it anywhere in the documentation) that this is because sw_scale is using an optimization for 32 byte aligned lines, in the destination. However I would like to turn this off because I am using sw_scale for image composition, so even though the destination lines may be 32 byte aligned, the output image may not be.


Example.


Full output frame is 1280x720 yuv422p10le. (this is 32 byte aligned)
However into the top left corner I am scaling an image with an outwidth of 1280 / 3 = 426.
426 in this format is not 32 byte aligned, but I believe sw_scale sees that the output linesize is 32 byte aligned and overwrites the width of 426 putting garbage in the next 22 bytes of data thinking this is simply padding when in my case this is displayable area.


This is why I need to actually disable this optimization or somehow trick sw_scale into believing it does not apply while keeping intact the way the program works, which is otherwise fine.


I have tried adding extra padding to the destination lines so they are no longer 32 byte aligned,
this did not help as far as I can tell.


Edit with code Example. Rendering omitted for ease of use.
Also here is a similar issue, unfortunately as I stated there fix will not work for my use case. https://github.com/obsproject/obs-studio/pull/2836


Use the commented line of code to swap between a output width which is and isnt 32 byte aligned.


#include "libswscale/swscale.h"
#include "libavutil/imgutils.h"
#include "libavutil/pixelutils.h"
#include "libavutil/pixfmt.h"
#include "libavutil/pixdesc.h"
#include 
#include 
#include 

int main(int argc, char **argv) {

/// Set up a 1280x720 window, and an item with 1/3 width and height of the window.
int window_width, window_height, item_width, item_height;
window_width = 1280;
window_height = 720;
item_width = (window_width / 3);
item_height = (window_height / 3);

int item_out_width = item_width;
/// This line sets the item width to be 32 byte aligned uncomment to see uncorrupted results
/// Note %16 because outformat is 2 bytes per component
//item_out_width -= (item_width % 16);

enum AVPixelFormat outformat = AV_PIX_FMT_YUV422P10LE;
enum AVPixelFormat informat = AV_PIX_FMT_UYVY422;
int window_lines[4] = {0};
av_image_fill_linesizes(window_lines, outformat, window_width);

uint8_t *window_planes[4] = {0};
window_planes[0] = calloc(1, window_lines[0] * window_height);
window_planes[1] = calloc(1, window_lines[1] * window_height);
window_planes[2] = calloc(1, window_lines[2] * window_height); /// Fill the window with all 0s, this is green in yuv.


int item_lines[4] = {0};
av_image_fill_linesizes(item_lines, informat, item_width);

uint8_t *item_planes[4] = {0};
item_planes[0] = malloc(item_lines[0] * item_height);
memset(item_planes[0], 100, item_lines[0] * item_height);

struct SwsContext *ctx;
ctx = sws_getContext(item_width, item_height, informat,
 item_out_width, item_height, outformat, SWS_FAST_BILINEAR, NULL, NULL, NULL);

/// Check a block in the normal region
printf("Pre scale normal region %d %d %d\n", (int)((uint16_t*)window_planes[0])[0], (int)((uint16_t*)window_planes[1])[0],
 (int)((uint16_t*)window_planes[2])[0]);

/// Check a block in the corrupted region (should be all zeros) These values should be out of the converted region
int corrupt_offset_y = (item_out_width + 3) * 2; ///(item_width + 3) * 2 bytes per component Y PLANE
int corrupt_offset_uv = (item_out_width + 3); ///(item_width + 3) * (2 bytes per component rshift 1 for horiz scaling) U and V PLANES

printf("Pre scale corrupted region %d %d %d\n", (int)(*((uint16_t*)(window_planes[0] + corrupt_offset_y))),
 (int)(*((uint16_t*)(window_planes[1] + corrupt_offset_uv))), (int)(*((uint16_t*)(window_planes[2] + corrupt_offset_uv))));
sws_scale(ctx, (const uint8_t**)item_planes, item_lines, 0, item_height,window_planes, window_lines);

/// Preform same tests after scaling
printf("Post scale normal region %d %d %d\n", (int)((uint16_t*)window_planes[0])[0], (int)((uint16_t*)window_planes[1])[0],
 (int)((uint16_t*)window_planes[2])[0]);
printf("Post scale corrupted region %d %d %d\n", (int)(*((uint16_t*)(window_planes[0] + corrupt_offset_y))),
 (int)(*((uint16_t*)(window_planes[1] + corrupt_offset_uv))), (int)(*((uint16_t*)(window_planes[2] + corrupt_offset_uv))));

return 0;



}


Example Output:

//No alignment
Pre scale normal region 0 0 0
Pre scale corrupted region 0 0 0
Post scale normal region 400 400 400
Post scale corrupted region 512 36865 36865

//With alignment
Pre scale normal region 0 0 0
Pre scale corrupted region 0 0 0
Post scale normal region 400 400 400
Post scale corrupted region 0 0 0