
Recherche avancée
Médias (1)
-
La conservation du net art au musée. Les stratégies à l’œuvre
26 mai 2011
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (40)
-
Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs
12 avril 2011, parLa 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. -
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
Personnaliser les catégories
21 juin 2013, parFormulaire de création d’une catégorie
Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
On peut modifier ce formulaire dans la partie :
Administration > Configuration des masques de formulaire.
Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)
Sur d’autres sites (5907)
-
Edge of text clipped a few pixels in ffmpeg
18 mai 2024, par THEMOUNTAINSANDTHESKIESTrying to make a short video of a background image with text and some background audio. It's functional, but the right side of each line of my text is always clipped a few pixels. What am I missing ?


Here's my python code (which includes the ffmpeg command) :


font_size = 100
text='Example Text Example Text \n Example Text'
font_path = 'Bangers-Regular.ttf'
image_path = 'background.jpg'
audio_path = 'audio.wav'
duration = 15 #or whatever the audio's length is
output_path = 'output.mp4'

font_path_escaped = font_path.replace("\\", "\\\\\\\\").replace("C:", "C\\:")

lines = text.split('\n')
num_lines = len(lines)
line_height = font_size + 10
start_y = (1080 - line_height * num_lines) // 2

filter_complex = []
for i, line in enumerate(lines):
 y_position = start_y + i * line_height
 filter_complex.append(
 f"drawtext=text='{line}':fontfile='{font_path_escaped}':fontsize={font_size}:"
 f"x=((w-text_w)/2):y={y_position}:"
 "fontcolor=white:borderw=6:bordercolor=black"
 )

filter_complex_string = ','.join(filter_complex)

command = [
 'ffmpeg',
 '-loop', '1',
 '-i', image_path,
 '-i', audio_path,
 '-filter_complex', filter_complex_string,
 '-map', '[v]',
 '-map', '1:a',
 '-c:v', 'hevc_nvenc',
 '-c:a', 'aac',
 '-pix_fmt', 'yuv420p',
 '-t', str(duration),
 '-shortest',
 '-loglevel', 'debug',
 '-y',
 output_path
]


subprocess.run(command, check=True)
print(f"Video created successfully: {output_path}")



and a frame from the outputted video :




-
Decoded YUV shows green edge when rendered with OpenGL
2 février 2023, par AlexAny idea, why decoded YUV -> RGB(shader conversion) has that extra green edge on the right side ?

Almost any 1080X1920 video seems to have this issue.



A screen recording of the issue is uploaded here https://imgur.com/a/JtUZq4h


Once I manually scale up the texture width, I can see it fills up to the viewport, but it would be nice if I could fix the actual cause. Is it some padding that's part of YUV colorspace ? What else could it be ?


My model is -1 to 1, filling the entire width

The texture coordinates are also 0 to 1 ratio

float vertices[] = {
 -1.0, 1.0f, 0.0f, 0.0, // top left
 1.0f, 1.0f, 1.0, 0.0, // top right
 -1.0f, -1.0f, 0.0f, 1.0f, // bottom left
 1.0f, -1.0f, 1.0f, 1.0f // bottom right
};



Fragment Shader


#version 330 core

in vec2 TexCoord;

out vec4 FragColor;
precision highp float;
uniform sampler2D textureY;
uniform sampler2D textureU;
uniform sampler2D textureV;
uniform float alpha;
uniform vec2 texScale;


void main()
{
 float y = texture(textureY, TexCoord / texScale).r;
 float u = texture(textureU, TexCoord / texScale).r - 0.5; 
 float v = texture(textureV, TexCoord / texScale).r - 0.5;
 
 vec3 rgb;
 
 //yuv - 709
 rgb.r = clamp(y + (1.402 * v), 0, 255);
 rgb.g = clamp(y - (0.2126 * 1.5748 / 0.7152) * u - (0.0722 * 1.8556 / 0.7152) * v, 0, 255);
 rgb.b = clamp(y + (1.8556 * u), 0,255);

 FragColor = vec4(rgb, 1.0);
} 



Texture Class


class VideoTexture {
 public:
 VideoTexture(Decoder *dec) : decoder(dec) {
 glGenTextures(1, &texture1);
 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 glBindTexture(GL_TEXTURE_2D, texture1);
 glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, decoder->frameQueue.first().linesize[0], decoder->frameQueue.first().height, 0, format, GL_UNSIGNED_BYTE, 0);
 glGenerateMipmap(GL_TEXTURE_2D);

 glGenTextures(1, &texture2);
 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 glBindTexture(GL_TEXTURE_2D, texture2);
 glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, decoder->frameQueue.first().linesize[1], decoder->frameQueue.first().height / 2, 0, format, GL_UNSIGNED_BYTE, 0);
 glGenerateMipmap(GL_TEXTURE_2D);

 glGenTextures(1, &texture3);
 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 glBindTexture(GL_TEXTURE_2D, texture3);
 glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, decoder->frameQueue.first().linesize[2], decoder->frameQueue.first().height / 2, 0, format, GL_UNSIGNED_BYTE, 0);
 glGenerateMipmap(GL_TEXTURE_2D);
 }

 void Render(Shader *shader, Gui *gui) {
 if (decoder->frameQueue.isEmpty()) {
 return;
 }

 glActiveTexture(GL_TEXTURE0);
 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, decoder->frameQueue.first().linesize[0], decoder->frameQueue.first().height, format, GL_UNSIGNED_BYTE, decoder->frameQueue.at(currentFrame).data[0]);
 glBindTexture(GL_TEXTURE_2D, texture1);
 shader->setInt("textureY", 0);

 glActiveTexture(GL_TEXTURE1);
 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, decoder->frameQueue.first().linesize[1], decoder->frameQueue.first().height / 2, format, GL_UNSIGNED_BYTE, decoder->frameQueue.at(currentFrame).data[1]);
 glBindTexture(GL_TEXTURE_2D, texture2);
 shader->setInt("textureU", 1);

 glActiveTexture(GL_TEXTURE2);
 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, decoder->frameQueue.first().linesize[2], decoder->frameQueue.first().height / 2, format, GL_UNSIGNED_BYTE, decoder->frameQueue.at(currentFrame).data[2]);
 glBindTexture(GL_TEXTURE_2D, texture3);
 shader->setInt("textureV", 2);
 }

 ~VideoTexture() {
 printf("\nVideo texture destructor");
 glDeleteTextures(1, &texture1);
 glDeleteTextures(1, &texture2);
 glDeleteTextures(1, &texture3);
 }

 private:
 GLuint texture1;
 GLuint texture2;
 GLuint texture3;
 GLint internalFormat = GL_RG8;
 GLint format = GL_RED;
 int currentFrame = 0;
 Decoder *decoder;
}



-
Questions about license of ffmpeg in Android [on hold]
23 décembre 2016, par SeasonI want to make an video editing app(may include advertisement or even earn money).
And I found that ffmpeg is a great library for my app.
And I can use it for compress video, trim video and change video format.
The commands that the app may use :
Reducing video size with same format and reducing frame size
Cutting the videos based on start and end time using ffmpeg
I found that ffmpeg is using LGPL and partially GPL licenses but I do not familiar with these two terms.
What should I do so that I can use ffmpeg legally ?