
Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (17)
-
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 ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir
Sur d’autres sites (4055)
-
ffmpeg command to add moving text watermark to video [closed]
13 octobre 2023, par Imran Khan

// Constants for watermark movement, direction change intervals, fade intervals, and overlap duration
 const MOVE_SPEED = 3;
 const DIRECTION_CHANGE_MIN = 3000;
 const DIRECTION_CHANGE_MAX = 6000;
 const FADE_INTERVAL_MIN = 10000;
 const FADE_INTERVAL_MAX = 20000;
 const OVERLAP_DURATION = 2000;

 // Get references to the video container and watermarks
 const container = document.querySelector('.video-container');
 const watermark1 = document.getElementById('watermark1');
 const watermark2 = document.getElementById('watermark2');

 // Helper function to get a random integer between min and max (inclusive)
 function getRandomInt(min, max) {
 return Math.floor(Math.random() * (max - min + 1)) + min;
 }

 // Helper function to get a random direction (either 1 or -1)
 function getRandomDirection() {
 return Math.random() > 0.5 ? 1 : -1;
 }

 // Set the initial position of the watermark inside the video container
 function setInitialPosition(watermark) {
 const x = getRandomInt(0, container.offsetWidth - watermark.offsetWidth);
 const y = getRandomInt(0, container.offsetHeight - watermark.offsetHeight);
 watermark.style.left = `${x}px`;
 watermark.style.top = `${y}px`;
 watermark.style.opacity = 1;
 }

 // Function to handle continuous movement of the watermark
 function continuousMove(watermark) {
 let dx = getRandomDirection() * MOVE_SPEED;
 let dy = getRandomDirection() * MOVE_SPEED;

 // Inner function to handle the actual movement logic
 function move() {
 let x = parseInt(watermark.style.left || 0) + dx;
 let y = parseInt(watermark.style.top || 0) + dy;

 // Check boundaries and reverse direction if necessary
 if (x < 0 || x > container.offsetWidth - watermark.offsetWidth) {
 dx = -dx;
 }
 if (y < 0 || y > container.offsetHeight - watermark.offsetHeight) {
 dy = -dy;
 }

 // Apply the new position
 watermark.style.left = `${x}px`;
 watermark.style.top = `${y}px`;

 // Continue moving
 setTimeout(move, 100);
 }

 move();

 // Change direction at random intervals
 setInterval(() => {
 const randomChoice = Math.random();
 if (randomChoice < 0.33) {
 dx = getRandomDirection() * MOVE_SPEED;
 dy = 0;
 } else if (randomChoice < 0.66) {
 dy = getRandomDirection() * MOVE_SPEED;
 dx = 0;
 } else {
 dx = getRandomDirection() * MOVE_SPEED;
 dy = getRandomDirection() * MOVE_SPEED;
 }
 }, getRandomInt(DIRECTION_CHANGE_MIN, DIRECTION_CHANGE_MAX));
 }

 // Handle the fading out of the old watermark and fading in of the new watermark
 function fadeOutAndIn(oldWatermark, newWatermark) {
 setTimeout(() => {
 setInitialPosition(newWatermark);
 newWatermark.style.opacity = 1;
 }, 0);

 setTimeout(() => {
 oldWatermark.style.opacity = 0;
 }, OVERLAP_DURATION);

 // Continue the cycle
 setTimeout(() => fadeOutAndIn(newWatermark, oldWatermark), getRandomInt(FADE_INTERVAL_MIN, FADE_INTERVAL_MAX));
 }

 // Initialize the watermarks
 setInitialPosition(watermark1);
 continuousMove(watermark1);
 setTimeout(() => fadeOutAndIn(watermark1, watermark2), getRandomInt(FADE_INTERVAL_MIN, FADE_INTERVAL_MAX));
 continuousMove(watermark2);



body, html {
 height: 100%;
 margin: 0;
 font-family: Arial, sans-serif;
 display: flex;
 justify-content: center;
 align-items: center;
 background-color: #eee;
 }

 .video-container {
 width: 50vw;
 height: 50vh;
 background-color: black;
 position: relative;
 overflow: hidden;
 }

 .watermark {
 font-size: 22px;
 position: absolute;
 color: white;
 opacity: 0;
 transition: opacity 2s;
 }





 
 
 


 <div class="video-container">
 <span class="watermark">watermark</span>
 <span class="watermark">watermark</span>
 </div>
 









I am trying to achieve an animation effect using ffmpeg. I am adding text watermark to an input video and animate the text diagonally, horizontally or vertically changed randomly. Here is what I have achieved so far.


ffmpeg -i video.mp4 -c:v libx264 -preset veryfast -crf 25 -tune zerolatency -vendor ap10 -pix_fmt yuv420p -filter:v "drawtext=fontfile=./fonts/Roboto/Roboto-Light.ttf:text='Watermark':fontcolor=white:alpha=0.5:fontsize=60:y=h/10*mod(t\,10):x=w/10*mod(t\,10):enable=1" -c:a copy watermark.mp4


Here is what I want it to work.


Initial Position :
The watermark randomly placed in the video the first time they appear.


Continuous Movement :
The watermark continuously moves within the video.
The direction and speed of the watermark's movement are random. It can move diagonally, purely horizontally, or purely vertically.
When the watermark reaches the boundaries of the video, it bounces back, changing its direction.


Direction Change :
During its continuous movement, the watermark will suddenly change its direction at random intervals between 3 to 6 seconds.
When changing direction, the watermark can randomly determined move diagonally, purely horizontally, or purely vertically.


Fade In and Out :
Every 10 to 20 seconds (randomly determined), the current watermark begins to fade out.
As the old watermark starts to fade out, a new watermark fades in at a random position, ensuring that there's always a visible watermark on the screen.
These two watermarks (the fading old one and the emerging new one) overlap on the screen for a duration of 2 seconds, after which the old watermark completely disappears.
These patterns and characteristics together provide a dynamic, constantly moving, and changing watermark for the video


To achieve the result I think we can use the
drawtext
multiple times. I have attached the HTML and JavaScript variant just for the reference to understand the result but I am trying to do this using ffmpeg.

-
What is Funnel Analysis ? A Complete Guide for Quick Results
25 janvier 2024, par Erin -
Random Fatal signal 11 (SIGSEGV) error in app using ffmpeg through ndk
20 janvier 2015, par grzebykI am getting a nasty but well known error while working with FFmpeg and NDK :
A/libc(9845): Fatal signal 11 (SIGSEGV), code 1, fault addr 0xa0a9f000 in tid 9921 (AsyncTask #4)
What am I doing ?
I am developing an application that streams live video feed from a webcam and enables user to pan and tilt the remote camera. I am using FFmpeg library built with NDK to achieve smooth playback with little delay.
I am using FFMpeg library to connect to the video stream. Then the ndk part creates bitmap, does the image processing and render frames on the
SurfaceView videoSurfaceView
object which is located in the android activity (java part).To move the webcam I created a separate class -
public class CameraMover implements Runnable{/**/}
. This class is a separate thread that connects through sockets with the remote camera and manages tasks connected ONLY with pan-tilt movement.Next in the main activity i created a touch listener
videoSurfaceView.setOnTouchListener(new View.OnTouchListener() {/**/
cameraMover.setPanTilt(some parameters);
/**/}which reads user’s finger movement and sends commands to the camera.
All tasks - moving camera around, touch interface and video playback are working perfectly when the one of the others is disabled, i.e. when I disable possibility to move camera, I can watch video streaming and register touch events till the end of time (or battery at least). The problem occurs only when task are configured to work simultaneously.
I am unable to find steps to reproduce the problem. It just happens, but only after user touches the screen to move camera. It can be 15 seconds after first interaction, but sometimes it takes app 10 or more minutes to crash. Usually it is something around a minute.
What have I done ?
- I tried to display millions of logs in logcat to find an error but
the last log was always different. - I created a transparent surface, that I put over the
videoSurfaceView
and assigned touch listener to it. It all ended in the same error. - As I mentioned before, I turned off some functionalities to find which one produces the error, but it appears that error occurs only when everything is working simultaneously.
Types of the error
Almost every time the error looks like this :
A/libc(11528): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x9aa9f00c in tid 11637 (AsyncTask #4)
the difference between two errors is the number right after libc, addr number and tid number. Rarely the AsyncTask number varies - i received #1 couple times but I was unable to reproduce it.
Question
How can i avoid this error ? What can be the source of it ?
- I tried to display millions of logs in logcat to find an error but