Recherche avancée

Médias (0)

Mot : - Tags -/organisation

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (64)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains 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, par

    Pré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 ) (...)

Sur d’autres sites (8361)

  • How to use the function expr in drawtext ffmpeg to add a text to video ?

    18 décembre 2013, par nhanpt

    I'm try to add a text to my video using FFmpeg.
    Sources : http://www.ffmpeg.org/ffmpeg-all.html#drawtext-1

    ffmpeg -i 1385363109.avi -vf "drawtext=fontfile=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf : text = %{localtime}: \x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000000@1" -an -y out11.avi

    I am trying to figure out how to add a timestamp in a formatable manner (specifically, I'd like to show mm:ss). I think this should be possible using a command like

    Code : Select all
    ffmpeg -i input.avi -vf "drawtext=fontfile=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf:expansion=normal:text='%expr=floor(t/60)~:%expr=floor(t)' : fontcolor=white " output.avi

    But I just get a lot of

    Code : Select all
    [Parsed_drawtext_0 @ 0x1a68a80] %expr=floor(t/60) is not known

    and no text is displayed.

    If I try

    Code : Select all
    ffmpeg -i input.avi -vf "drawtext=fontfile=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf:expansion=normal:text='%expr' : fontcolor=white " output.avi

    I get instead

    Code : Select all
    [Parsed_drawtext_0 @ 0x2d22be0] %expr requires at least 1 arguments

    so the version of drawtext I have definitely recognizes the expr function, but I can't figure out the syntax for giving it an argument. Does anyone know what the synatax is for the expr (or e) function ?

    Alternately, if there is another way to display the timecode as mm:ss that would be great too. I know that using the 'timecode' argument of drawtext you can get hh:mm:ss:ff, or using text='%pts' gives me decimal seconds to the microsecond, but I am sure that my advisor (who is very picky) will not accept either of these. Thanks in advance for any assistance !

  • FFMPEG Determine average color of an area of a video

    12 novembre 2019, par Naved Khan

    I have a use case where I’d want to insert one of two watermarks - one designed for a dark-ish background, the other for a light background into a video. Let’s say that I’d want to do this on the top right corner of the video.

    How do I determine the average color of the top right section of the video ? Post this, how do I determine which watermark to use by looking at the average color ?

    I have a solution right now where I am taking equally spaced screenshots and then measuring the average color, but it’s excruciatingly slow, especially for longer videos.

    # Calculate average color
       black_distances = []
       white_distances = []

       movie = FFMPEG::Movie.new(video_file)
       (0..movie.duration / 10).each do |second|

         # extract a frame
         filename = "tmp/watermark/#{SecureRandom.uuid}.jpg"
         movie.screenshot filename.to_s, seek_time: second

         # analyse frame for color distance
         frame = MiniMagick::Image.open(filename)
         frame.crop('20%x20%+80%+0')
         frame.resize('1x1')
         pixel = frame.get_pixels.flatten

         distance_from_black = Math.sqrt(((black[0] - pixel[0])**2 + (black[1] - pixel[1])**2 + (black[2] - pixel[2])**2))
         distance_from_white = Math.sqrt(((white[0] - pixel[0])**2 + (white[1] - pixel[1])**2 + (white[2] - pixel[2])**2))

         black_distances.push distance_from_black
         white_distances.push distance_from_white

         File.delete(filename) if File.exist?(filename)
       end

       average_black_distance = black_distances.reduce(:+).to_f / black_distances.size
       average_white_distance = white_distances.reduce(:+).to_f / white_distances.size

    I am also confused about how to use the resulting average_black_distance and average_white_distance to determine which watermark to use.

  • Evaluate function within ffmpeg drawtext

    22 juin 2022, par Dan Steingart

    I am looking to display a counter that is a multiple of the frame number on a video created with ffmpeg. Previous answers on SO taught me that a command of the form

    


    ffmpeg -y -r 25  -pattern_type glob -i '*.jpg' -vf "text='%{n}': start_number=0: x=0: y=0: fontcolor=black: fontsize=30: box=1: boxcolor=white: boxborderw=5" -c:a copy movie.mp4


    


    Will display the frame number, and this works nicely. But if I try to evaluate an expression within the %{}, e.g.

    


    ffmpeg -y -r 25  -pattern_type glob -i '*.jpg' -vf "text='%{n*50}': start_number=0: x=0: y=0: fontcolor=black: fontsize=30: box=1: boxcolor=white: boxborderw=5" -c:a copy movie.mp4


    


    Then I get the following error

    


    [Parsed_drawtext_0 @ 0x55683f9b00] %{n*50} is not known    


    


    on each frame. What is the proper syntax to evaluate n*50 and display in drawtext ? TIA.