
Recherche avancée
Autres articles (88)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
Creating farms of unique websites
13 avril 2011, parMediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)
Sur d’autres sites (9500)
-
avcodec/ffv1dec : Limit size of fltmap* to pixel number
3 avril, par Michael Niedermayer -
avcodec/aac/aacdec_lpd : Limit get_unary()
8 février, par Michael Niedermayeravcodec/aac/aacdec_lpd : Limit get_unary()
The limit is based on later code storing 32bits
Fixes : signed integer overflow : 2147483647 + 1 cannot be represented in type 'int'
Fixes : 393164866/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-4606798354513920Found-by : continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by : Michael Niedermayer <michael@niedermayer.cc> -
Can i limit CPU usage of my Script ? Raspberry pi cpu crashing - rebooting [duplicate]
5 novembre 2024, par Mateus CoelhoI 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