Recherche avancée

Médias (91)

Autres articles (25)

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

  • 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 (...)

Sur d’autres sites (7015)

  • Python asyncio subprocess code returns "pipe closed by peer or os.write(pipe, data) raised exception."

    4 novembre 2022, par Duke Dougal

    I am trying to convert a synchronous Python process to asyncio. Any ideas what I am doing wrong ?

    


    This is the synchronous code which successfully starts ffmpeg and converts a directory of webp files into a video.

    


    import subprocess
import shlex
from os import listdir
from os.path import isfile, join

output_filename = 'output.mp4'
process = subprocess.Popen(shlex.split(f'ffmpeg -y -framerate 60 -i pipe: -vcodec libx265 -pix_fmt yuv420p -crf 24 output.mp4'), stdin=subprocess.PIPE)

thepath = '/home/ubuntu/webpfiles/'
thefiles = [f for f in listdir(thepath) if isfile(join(thepath, f))]
for filename in thefiles:
    absolute_path = f'{thepath}{filename}'
    with open(absolute_path, 'rb') as f:
        process.stdin.write(f.read())

process.stdin.close()
process.wait()
process.terminate()


    


    This async code fails :

    


    from os import listdir
from os.path import isfile, join
import shlex
import asyncio

outputfilename = 'output.mp4'

async def write_stdin(proc):
    thepath = '/home/ubuntu/webpfiles/'
    thefiles = [f for f in listdir(thepath) if isfile(join(thepath, f))]
    thefiles.sort()
    for filename in thefiles:
        absolute_path = f'{thepath}{filename}'
        with open(absolute_path, 'rb') as f:
            await proc.communicate(input=f.read())

async def create_ffmpeg_subprocess():
    bin = f'/home/ubuntu/bin/ffmpeg'
    params = f'-y -framerate 60 -i pipe: -vcodec libx265 -pix_fmt yuv420p -crf 24 {outputfilename}'
    proc = await asyncio.create_subprocess_exec(
        bin,
        *shlex.split(params),
        stdin=asyncio.subprocess.PIPE,
        stdout=asyncio.subprocess.PIPE,
        stderr=asyncio.subprocess.PIPE,
    )
    return proc

async def start():
    loop = asyncio.get_event_loop()
    proc = await create_ffmpeg_subprocess()
    task_stdout = loop.create_task(write_stdin(proc))
    await asyncio.gather(task_stdout)

if __name__ == '__main__':
    asyncio.run(start())


    


    The output for the async code is :

    


    pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.
pipe closed by peer or os.write(pipe, data) raised exception.


    


    etc - one line for each webp file

    


  • Revision 26b6318de8 : Make get_coef_context() branchless. This should significantly speedup cost_coef

    1er juillet 2013, par Ronald S. Bultje

    Changed Paths :
     Modify /vp9/common/vp9_entropy.c


     Modify /vp9/common/vp9_entropy.h


     Modify /vp9/decoder/vp9_detokenize.c


     Modify /vp9/encoder/vp9_encodemb.c


     Modify /vp9/encoder/vp9_rdopt.c


     Modify /vp9/encoder/vp9_tokenize.c



    Make get_coef_context() branchless.

    This should significantly speedup cost_coeffs(). Basically what the
    patch does is to make the neighbour arrays padded by one item to
    prevent an eob check in get_coef_context(), then it populates each
    col/row scan and left/top edge coefficient with two times the same
    neighbour - this prevents a single/double context branch in
    get_coef_context(). Lastly, it populates neighbour arrays in pixel
    order (rather than scan order), so we don't have to dereference the
    scantable to get the correct neighbours.

    Total encoding time of first 50 frames of bus (speed 0) at 1500kbps
    goes from 2min10.1 to 2min5.3, i.e. a 2.6% overall speed increase.

    Change-Id : I42bcd2210fd7bec03767ef0e2945a665b851df56

  • ffmpeg - overlay a video with rounded corners

    4 novembre 2019, par asi

    I am successfully using overlaying a scaled (smaller) video on top of a larger one but am struggling to understand how could I give the small video a rounded corners mask.

    Edit

    thanks to @loogan comment I’ve managed to get a working command that created applies a circular mask :

    ffmpeg
       -i main.mp4
       -i vignette.mp4
       -filter_complex
         [1:v]scale=300:-1[scaled];
         [scaled]split [scaled0][scaled11];
         [scaled0]trim=end_frame=1,geq='st(3,pow(X-(W/2),2)+pow(Y-(H/2),2));if(lte(ld(3),780*780),255,0)':3:3,loop=-1:1,setpts=N/FRAME_RATE/TB[mask];
       [scaled1][mask]alphamerge[cutout];
       [0][cutout]overlay=x=W-w:y=0[v];
       -map [v]
       -map [a]  
       output.mp4

    but how to get from a circle to a rounded rect still eludes me. cant quite get what are the params that geq expects and the math to generate them.

    assuming that the video that needs masking is 200 * 300 and the corners should have a 5px radius, is there a geq command that can create this mask ? maybe en ellipse ?

    or maybe a better way would be to use a pre-made png as a mask ?

    any insights welcome