Recherche avancée

Médias (0)

Mot : - Tags -/xmlrpc

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

Autres articles (82)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

Sur d’autres sites (6376)

  • Anomalie #2307 : md5_boutons_plugins()

    21 juillet 2014, par marcimat ☺☮☯♫

    Et les traces pour voir plus clairement les 2 créations du même define (_UPDATED_boutons_plugins) :

    Premier passage (constante non définie)

    array (size=5)
      0 => 
        array (size=4)
          ’file’ => string ’[...]spip/ecrire/inc/plugin.php’ (length=57)
          ’line’ => int 636
          ’function’ => string ’plugin_ongletbouton’ (length=19)
      1 => 
        array (size=4)
          ’file’ => string ’[...]spip/ecrire/inc/plugin.php’ (length=57)
          ’line’ => int 530
          ’function’ => string ’plugins_precompile_xxxtions’ (length=27)
      2 => 
        array (size=4)
          ’file’ => string ’[...]spip/ecrire/inc/plugin.php’ (length=57)
          ’line’ => int 431
          ’function’ => string ’ecrire_plugin_actifs’ (length=20)
      3 => 
        array (size=4)
          ’file’ => string ’[...]spip/ecrire/inc_version.php’ (length=58)
          ’line’ => int 391
          ’function’ => string ’actualise_plugins_actifs’ (length=24)
      4 => 
        array (size=4)
          ’file’ => string ’[...]spip/ecrire/index.php’ (length=52)
          ’line’ => int 21
          ’function’ => string ’include’ (length=7)
    

    Second passage (constante déjà définie)

    array (size=5)
      0 => 
        array (size=4)
          ’file’ => string ’[...]spip/ecrire/inc/plugin.php’ (length=57)
          ’line’ => int 636
          ’function’ => string ’plugin_ongletbouton’ (length=19)
      1 => 
        array (size=4)
          ’file’ => string ’[...]spip/ecrire/inc/plugin.php’ (length=57)
          ’line’ => int 530
          ’function’ => string ’plugins_precompile_xxxtions’ (length=27)
      2 => 
        array (size=4)
          ’file’ => string ’[...]spip/ecrire/inc/plugin.php’ (length=57)
          ’line’ => int 431
          ’function’ => string ’ecrire_plugin_actifs’ (length=20)
      3 => 
        array (size=4)
          ’file’ => string ’[...]spip/plugins-dist/svp/exec/admin_plugin.php’ (length=74)
          ’line’ => int 52
          ’function’ => string ’actualise_plugins_actifs’ (length=24)
      4 => 
        array (size=4)
          ’file’ => string ’[...]spip/ecrire/index.php’ (length=52)
          ’line’ => int 151
          ’function’ => string ’exec_admin_plugin_dist’ (length=22)
  • Can i limit CPU usage of my Script ? Raspberry pi cpu crashing - rebooting [duplicate]

    5 novembre 2024, par Mateus Coelho

    I have a script, in python, that converts a video of 11mb, 30fps, 1080p. the code puts 4 imagens into it, with overlay, and rotates 90.
When i run the script into the raspberry pi, it goes off CPU, all the 4 threads go to 100% and it suently reboots.

    


    Raspberry pi 4 b 4gb

    


    I want to limit the cpu to like 60% to the script... its not a problems to be longer in time.

    


    import subprocess
import sys
import time
import psutil
import os

def overlay_images_on_video(input_file, image_files, output_file, positions, image_size=(100, 100), opacity=0.7):
    start_time = time.time()
    process = psutil.Process(os.getpid())

    inputs = ['-i', input_file]
    for image in image_files:
        if image:
            inputs += ['-i', image]
    filter_complex = "[0:v]transpose=2[rotated];"
    current_stream = "[rotated]"
    for i, (x_offset, y_offset) in enumerate(positions):
        filter_complex += f"[{i+1}:v]scale={image_size[0]}:{image_size[1]},format=rgba,colorchannelmixer=aa={opacity}[img{i}];"
        filter_complex += f"{current_stream}[img{i}]overlay={x_offset}:{y_offset}"
        if i < len(positions) - 1:
            filter_complex += f"[tmp{i}];"
            current_stream = f"[tmp{i}]"
        else:
            filter_complex += ""
    command = ['ffmpeg', '-threads', '1'] + inputs + ['-filter_complex', filter_complex, output_file]
    
    try:
        subprocess.run(command, check=True)
        print(f"Vídeo processado com sucesso: {output_file}")
    except subprocess.CalledProcessError as e:
        print(f"Erro ao processar o vídeo: {e}")
    
    # Monitoramento de tempo, memória e CPU
    elapsed_time = time.time() - start_time
    memory_info = process.memory_info()
    cpu_usage = process.cpu_percent(interval=1)
    print(f"Tempo de execução: {elapsed_time:.2f} segundos")
    print(f"Memória usada: {memory_info.rss / (1024 * 1024):.2f} MB")
    print(f"Uso de CPU: {cpu_usage}%")
    
    # Monitoramento de GPU (se disponível)
    try:
        gpu_usage = subprocess.check_output(
            ["nvidia-smi", "--query-gpu=utilization.gpu", "--format=csv,noheader,nounits"]
        ).decode("utf-8").strip()
        print(f"Uso de GPU: {gpu_usage}%")
    except FileNotFoundError:
        print("GPU não detectada ou `nvidia-smi` não está disponível.")

if __name__ == "__main__":
    input_video = sys.argv[1]
    image_files = sys.argv[2:5]
    output_video = sys.argv[5]
    
    positions = [(10, 10), (35, 1630), (800, 1630)]
    overlay_images_on_video(input_video, image_files, output_video, positions, image_size=(250, 250), opacity=0.8)


    


    EDITED :

    


    The 4 cores of the CPU goes to 100%, i can see in another ssh terminal via htop, and it sudently reboots.
I have other 9 scripts running on the back, 6 ffmpeg stremas and 3 others to caputre the videos. When i add this logic to the other 3 that captures the video or i try to run directly one time, it reboots

    


  • How to save ffmpeg segmets to disk immediately with sub-second intervals ?

    20 octobre 2023, par amfast

    I'm trying to record video on a raspberry and have it save as much as possible (sub-second resolution) in case of a power cutoff.

    


    I use -f segment to save the encoded stream in 100ms segments with the hope that all but the interrupted (by power cutoff) segment will be saved in memory. Unfortunately, when cutting off power, all the destination files (output_0001.mp4, output_0002.mp4, ...) are created, but empty.

    


    To save the files to disk immediately, I added the -strftime 1 option that allows formatting the output filename as time. It seems weird that this is the (only ?) way to trigger immediate saving of files, but it works - untill I try to have segments smaller than 1 second. The problem seems to be that the format string %d, that previously added a sequence number in my output filenames, now represents "day" (i.e. date) and the smallest resolution time format string is %S for second. I saw %f suggested somewhere for smaller resolutions, but it only prints "%f".

    


    The result is that the segmentation part of ffmpeg does create 100ms segments and save them to disk immediately, but the strftime feature gives the output files names that only change every second, so all the interim files are overwritten.

    


    Example of the failing command below. Without the -strftime option this creates nice segments, but does not save them to disk immediately.

    


    libcamera-vid --flush \
    --framerate ${FRAMERATE} \
    --width ${WIDTH} \
    --height ${HEIGHT} \
    -n \
    -t ${TIMEOUT} \
    --codec yuv420 \
    -o - | 
ffmpeg \
    -fflags nobuffer \
    -strict experimental \
    -loglevel debug \
    -flags low_delay \
    -f rawvideo \
    -pix_fmt yuv420p \
    -s:v ${WIDTH}x${HEIGHT} \
    -r ${FRAMERATE} \
    -i - \
    -c:v h264_v4l2m2m \
    -f segment \
    -segment_time 0.1 \
    -segment_format mp4 \
    -reset_timestamps 1 \
    -strftime 1 \
    -b:v ${ENCODING_BITRATE} \
    -g 1 \
    "output_%04d.mp4"


    


    Question :
    
Is there another way besides -strftime to trigger immediate saving ? Or is there a mechanism to feed finer resolution format strings to the output filename ?