Recherche avancée

Médias (1)

Mot : - Tags -/ticket

Autres articles (93)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Le plugin : Gestion de la mutualisation

    2 mars 2010, par

    Le plugin de Gestion de mutualisation permet de gérer les différents canaux de mediaspip depuis un site maître. Il a pour but de fournir une solution pure SPIP afin de remplacer cette ancienne solution.
    Installation basique
    On installe les fichiers de SPIP sur le serveur.
    On ajoute ensuite le plugin "mutualisation" à la racine du site comme décrit ici.
    On customise le fichier mes_options.php central comme on le souhaite. Voilà pour l’exemple celui de la plateforme mediaspip.net :
    < ?php (...)

  • Gestion de la ferme

    2 mars 2010, par

    La ferme est gérée dans son ensemble par des "super admins".
    Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
    Dans un premier temps il utilise le plugin "Gestion de mutualisation"

Sur d’autres sites (10948)

  • Creating buttons with Imagick

    9 juin 2010, par Mikko Koppanen — Imagick, PHP stuff

    A fellow called kakapo asked me to create a button with Imagick. He had an image of the button and a Photoshop tutorial but unfortunately the tutorial was in Chinese. My Chinese is a bit rusty so it will take a little longer to create that specific button ;)

    The button in this example is created after this tutorial http://xeonfx.com/tutorials/easy-button-tutorial/ (yes, I googled “easy button tutorial”). The code and the button it creates are both very simple but the effect looks really nice.

    Here we go with the code :

    1. < ?php
    2.  
    3. /* Create a new Imagick object */
    4. $im = new Imagick() ;
    5.  
    6. /* Create empty canvas */
    7. $im->newImage( 200, 200, "white", "png" ) ;
    8.  
    9. /* Create the object used to draw */
    10. $draw = new ImagickDraw() ;
    11.  
    12. /* Set the button color.
    13.   Changing this value changes the color of the button */
    14. $draw->setFillColor( "#4096EE" ) ;
    15.  
    16. /* Create the outer circle */
    17. $draw->circle( 50, 50, 70, 70 ) ;
    18.  
    19. /* Create the smaller circle on the button */
    20. $draw->setFillColor( "white" ) ;
    21.  
    22. /* Semi-opaque fill */
    23. $draw->setFillAlpha( 0.2 ) ;
    24.  
    25. /* Draw the circle */
    26. $draw->circle( 50, 50, 68, 68 ) ;
    27.  
    28. /* Set the font */
    29. $draw->setFont( "./test1.ttf" ) ;
    30.  
    31. /* This is the alpha value used to annotate */
    32. $draw->setFillAlpha( 0.17 ) ;
    33.  
    34. /* Draw a curve on the button with 17% opaque fill */
    35. $draw->bezier( array(
    36.           array( "x" => 10 , "y" => 25 ),
    37.           array( "x" => 39, "y" => 49 ),
    38.           array( "x" => 60, "y" => 55 ),
    39.           array( "x" => 75, "y" => 70 ),
    40.           array( "x" => 100, "y" => 70 ),
    41.           array( "x" => 100, "y" => 10 ),
    42.          ) ) ;
    43.  
    44. /* Render all pending operations on the image */       
    45. $im->drawImage( $draw ) ;
    46.  
    47. /* Set fill to fully opaque */
    48. $draw->setFillAlpha( 1 ) ;
    49.  
    50. /* Set the font size to 30 */
    51. $draw->setFontSize( 30 ) ;
    52.  
    53. /* The text on the */
    54. $draw->setFillColor( "white" ) ;
    55.  
    56. /* Annotate the text */
    57. $im->annotateImage( $draw, 38, 55, 0, "go" ) ;
    58.  
    59. /* Trim extra area out of the image */
    60. $im->trimImage( 0 ) ;
    61.  
    62. /* Output the image */
    63. header( "Content-Type : image/png" ) ;
    64. echo $im ;
    65.  
    66.  ?>

    And here is a few buttons I created by changing the fill color value :

    red

    green

    blue

  • ffmpeg command to add moving text watermark to video [closed]

    13 octobre 2023, par Imran Khan
    &#xD;&#xA;
    &#xD;&#xA;
            // Constants for watermark movement, direction change intervals, fade intervals, and overlap duration&#xA;        const MOVE_SPEED = 3;&#xA;        const DIRECTION_CHANGE_MIN = 3000;&#xA;        const DIRECTION_CHANGE_MAX = 6000;&#xA;        const FADE_INTERVAL_MIN = 10000;&#xA;        const FADE_INTERVAL_MAX = 20000;&#xA;        const OVERLAP_DURATION = 2000;&#xA;&#xA;        // Get references to the video container and watermarks&#xA;        const container = document.querySelector(&#x27;.video-container&#x27;);&#xA;        const watermark1 = document.getElementById(&#x27;watermark1&#x27;);&#xA;        const watermark2 = document.getElementById(&#x27;watermark2&#x27;);&#xA;&#xA;        // Helper function to get a random integer between min and max (inclusive)&#xA;        function getRandomInt(min, max) {&#xA;            return Math.floor(Math.random() * (max - min &#x2B; 1)) &#x2B; min;&#xA;        }&#xA;&#xA;        // Helper function to get a random direction (either 1 or -1)&#xA;        function getRandomDirection() {&#xA;            return Math.random() > 0.5 ? 1 : -1;&#xA;        }&#xA;&#xA;        // Set the initial position of the watermark inside the video container&#xA;        function setInitialPosition(watermark) {&#xA;            const x = getRandomInt(0, container.offsetWidth - watermark.offsetWidth);&#xA;            const y = getRandomInt(0, container.offsetHeight - watermark.offsetHeight);&#xA;            watermark.style.left = `${x}px`;&#xA;            watermark.style.top = `${y}px`;&#xA;            watermark.style.opacity = 1;&#xA;        }&#xA;&#xA;        // Function to handle continuous movement of the watermark&#xA;        function continuousMove(watermark) {&#xA;            let dx = getRandomDirection() * MOVE_SPEED;&#xA;            let dy = getRandomDirection() * MOVE_SPEED;&#xA;&#xA;            // Inner function to handle the actual movement logic&#xA;            function move() {&#xA;                let x = parseInt(watermark.style.left || 0) &#x2B; dx;&#xA;                let y = parseInt(watermark.style.top || 0) &#x2B; dy;&#xA;&#xA;                // Check boundaries and reverse direction if necessary&#xA;                if (x &lt; 0 || x > container.offsetWidth - watermark.offsetWidth) {&#xA;                    dx = -dx;&#xA;                }&#xA;                if (y &lt; 0 || y > container.offsetHeight - watermark.offsetHeight) {&#xA;                    dy = -dy;&#xA;                }&#xA;&#xA;                // Apply the new position&#xA;                watermark.style.left = `${x}px`;&#xA;                watermark.style.top = `${y}px`;&#xA;&#xA;                // Continue moving&#xA;                setTimeout(move, 100);&#xA;            }&#xA;&#xA;            move();&#xA;&#xA;            // Change direction at random intervals&#xA;            setInterval(() => {&#xA;                const randomChoice = Math.random();&#xA;                if (randomChoice &lt; 0.33) {&#xA;                    dx = getRandomDirection() * MOVE_SPEED;&#xA;                    dy = 0;&#xA;                } else if (randomChoice &lt; 0.66) {&#xA;                    dy = getRandomDirection() * MOVE_SPEED;&#xA;                    dx = 0;&#xA;                } else {&#xA;                    dx = getRandomDirection() * MOVE_SPEED;&#xA;                    dy = getRandomDirection() * MOVE_SPEED;&#xA;                }&#xA;            }, getRandomInt(DIRECTION_CHANGE_MIN, DIRECTION_CHANGE_MAX));&#xA;        }&#xA;&#xA;        // Handle the fading out of the old watermark and fading in of the new watermark&#xA;        function fadeOutAndIn(oldWatermark, newWatermark) {&#xA;            setTimeout(() => {&#xA;                setInitialPosition(newWatermark);&#xA;                newWatermark.style.opacity = 1;&#xA;            }, 0);&#xA;&#xA;            setTimeout(() => {&#xA;                oldWatermark.style.opacity = 0;&#xA;            }, OVERLAP_DURATION);&#xA;&#xA;            // Continue the cycle&#xA;            setTimeout(() => fadeOutAndIn(newWatermark, oldWatermark), getRandomInt(FADE_INTERVAL_MIN, FADE_INTERVAL_MAX));&#xA;        }&#xA;&#xA;        // Initialize the watermarks&#xA;        setInitialPosition(watermark1);&#xA;        continuousMove(watermark1);&#xA;        setTimeout(() => fadeOutAndIn(watermark1, watermark2), getRandomInt(FADE_INTERVAL_MIN, FADE_INTERVAL_MAX));&#xA;        continuousMove(watermark2);&#xA;    

    &#xD;&#xA;

    body, html {&#xA;            height: 100%;&#xA;            margin: 0;&#xA;            font-family: Arial, sans-serif;&#xA;            display: flex;&#xA;            justify-content: center;&#xA;            align-items: center;&#xA;            background-color: #eee;&#xA;        }&#xA;&#xA;        .video-container {&#xA;            width: 50vw;&#xA;            height: 50vh;&#xA;            background-color: black;&#xA;            position: relative;&#xA;            overflow: hidden;&#xA;        }&#xA;&#xA;        .watermark {&#xA;            font-size: 22px;&#xA;            position: absolute;&#xA;            color: white;&#xA;            opacity: 0;&#xA;            transition: opacity 2s;&#xA;        }

    &#xD;&#xA;

    &#xA;&#xA;&#xA;    &#xA;    &#xA;    &#xA;&#xA;&#xA;    <div class="video-container">&#xA;        <span class="watermark">watermark</span>&#xA;        <span class="watermark">watermark</span>&#xA;    </div>&#xA;    &#xA;&#xA;

    &#xD;&#xA;

    &#xD;&#xA;

    &#xD;&#xA;&#xA;

    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.

    &#xA;

    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=&#x27;Watermark&#x27;: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

    &#xA;

    Here is what I want it to work.

    &#xA;

    Initial Position :&#xA;The watermark randomly placed in the video the first time they appear.

    &#xA;

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

    &#xA;

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

    &#xA;

    Fade In and Out :&#xA;Every 10 to 20 seconds (randomly determined), the current watermark begins to fade out.&#xA;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.&#xA;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.&#xA;These patterns and characteristics together provide a dynamic, constantly moving, and changing watermark for the video

    &#xA;

    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.

    &#xA;

  • PHP - Upload video convert mp4 and upload to Amazon S3

    31 octobre 2019, par Kadir Geçit

    I’m using amazon s3 as video storage for my website. I’m having problems for some videos. black screen or sound problems etc.

    I want to convert the video to mp4 format after uploading the video to my server and then upload it to amazon. Is it possible with FFMPEG ?

    I’m using this code for uploading files now :

    $file1 = $_FILES['file']['name'];
    $videoFileType = strtolower(pathinfo($file1,PATHINFO_EXTENSION));
    $file_name = sprintf('%s_%s', uniqid(),uniqid().".".$videoFileType);
    $temp_file_location = $_FILES["file"]["tmp_name"];

    require 'application/libraries/Amazon/aws-autoloader.php';
           $s3 = new Aws\S3\S3Client([
               'region'  => $amazon_region,
               'version' => 'latest',
               'credentials' => [
               'key'    => $amazon_key,
               'secret' => $amazon_secret,
               ]
           ]);    

           $result = $s3->putObject([
               'Bucket' => $amazon_bucket,
               'Key'    => $file_name,
               'SourceFile' => $temp_file_location,
               'ACL'    => 'public-read',
               'CacheControl' => 'max-age=3153600',
           ]);
               $filepath = $result['ObjectURL'] . PHP_EOL;

               echo json_encode([
                   'status' => 'ok',
                   'path' => $filepath

               ]);