
Recherche avancée
Autres articles (111)
-
Les statuts des instances de mutualisation
13 mars 2010, parPour des raisons de compatibilité générale du plugin de gestion de mutualisations avec les fonctions originales de SPIP, les statuts des instances sont les mêmes que pour tout autre objets (articles...), seuls leurs noms dans l’interface change quelque peu.
Les différents statuts possibles sont : prepa (demandé) qui correspond à une instance demandée par un utilisateur. Si le site a déjà été créé par le passé, il est passé en mode désactivé. publie (validé) qui correspond à une instance validée par un (...) -
Pas question de marché, de cloud etc...
10 avril 2011Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
sur le web 2.0 et dans les entreprises qui en vivent.
Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains 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 ;
Sur d’autres sites (5547)
-
why video conversion from avi to mp4 in php using exec function not working ?
28 avril 2019, par Amir farouki tried to convert any video type to mp4 on the server because the html video tag dose not support any type except mp4. so i used exec function to convert the video on the server but it is not working.
note :
exec function is not in the disabled function in php.inimy code :
<?php
if(isset($_POST['submit']))
{
$vidname=$_FILES["vid"]["name"];
$videotype=$_FILES["vid"]["type"];
$time = time();
$vidname2=$time.$_FILES["vid"]["name"];
move_uploaded_file($_FILES["vid"]["tmp_name"], 'videos/' . $time.$_FILES["vid"]["name"]);
if($videotype!="video/mp4")
{
exec("ffmpeg -i videos/$vidname2 -an videos/$vidname2.mp4"); // Convert .avi to mp4
unlink("videos/$vidname2");
}
}
else
{
?>
<form method="post" action="" enctype="multipart/form-data">
<input type="file" />
<input type="submit" value="upload" />
</form>
<?php
}
?> -
Queue in Python processing more than one video at a time ? [closed]
12 novembre 2024, par Mateus CoelhoI have an raspberry pi, that i proccess videos, rotate and put 4 water marks, but, when i run into the raspberry pi, it uses 100% of 4CPUS threads and it reboots. I solved this using -threads 1, to prevent the usage of just one of the 4 CPUS cores, it worked.


I made a Queue to procces one at a time, because i have 4 buttons that trigger the videos. But, when i send more then 3 videos to the Queue, the rasp still reboots, and im monitoring the CPU usage, is 100% for only one of the four CPUS



But, if i send 4 or 5 videos to the thread folder, it completly reboots, and the most awkward, its after the reboot, it made its way to proceed all the videos.



import os
import time
import subprocess
from google.cloud import storage
import shutil

QUEUE_DIR = "/home/abidu/Desktop/ApertaiRemoteClone"
ERROR_VIDEOS_DIR = "/home/abidu/Desktop/ApertaiRemoteClone/ErrorVideos"
CREDENTIALS_PATH = "/home/abidu/Desktop/keys.json"
BUCKET_NAME = "videos-283812"

def is_valid_video(file_path):
 try:
 result = subprocess.run(
 ['ffprobe', '-v', 'error', '-show_entries', 'format=duration', '-of', 'default=noprint_wrappers=1:nokey=1', file_path],
 stdout=subprocess.PIPE,
 stderr=subprocess.PIPE
 )
 return result.returncode == 0
 except Exception as e:
 print(f"Erro ao verificar o vídeo: {e}")
 return False

def overlay_images_on_video(input_file, image_files, output_file, positions, image_size=(100, 100), opacity=0.7):
 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', '-y', '-threads', '1'] + inputs + ['-filter_complex', filter_complex, '-threads', '1', output_file]

 try:
 result = subprocess.run(command, check=True)
 result.check_returncode() # Verifica se o comando foi executado com sucesso
 print(f"Vídeo processado com sucesso: {output_file}")
 except subprocess.CalledProcessError as e:
 print(f"Erro ao processar o vídeo: {e}")
 if "moov atom not found" in str(e):
 print("Vídeo corrompido ou sem o moov atom. Pulando o arquivo.")
 raise # Relança a exceção para ser tratada no nível superior

def process_and_upload_video():
 client = storage.Client.from_service_account_json(CREDENTIALS_PATH)
 bucket = client.bucket(BUCKET_NAME)
 
 while True:
 # Aguarda 10 segundos antes de verificar novos vídeos
 time.sleep(10)

 # Verifica se há arquivos no diretório de fila
 queue_files = [f for f in os.listdir(QUEUE_DIR) if f.endswith(".mp4")]
 
 if queue_files:
 video_file = os.path.join(QUEUE_DIR, queue_files[0]) # Pega o primeiro vídeo na fila
 
 # Define o caminho de saída após o processamento com o mesmo nome do arquivo de entrada
 output_file = os.path.join(QUEUE_DIR, "processed_" + os.path.basename(video_file))
 if not is_valid_video(video_file):
 print(f"Arquivo de vídeo inválido ou corrompido: {video_file}. Pulando.")
 os.remove(video_file) # Remove arquivo corrompido
 continue

 # Processa o vídeo com a função overlay_images_on_video
 try:
 overlay_images_on_video(
 video_file,
 ["/home/abidu/Desktop/ApertaiRemoteClone/Sponsor/image1.png", 
 "/home/abidu/Desktop/ApertaiRemoteClone/Sponsor/image2.png", 
 "/home/abidu/Desktop/ApertaiRemoteClone/Sponsor/image3.png", 
 "/home/abidu/Desktop/ApertaiRemoteClone/Sponsor/image4.png"],
 output_file,
 [(10, 10), (35, 1630), (800, 1630), (790, 15)],
 image_size=(250, 250),
 opacity=0.8
 )
 
 if os.path.exists(output_file):
 blob = bucket.blob(os.path.basename(video_file).replace("-", "/"))
 blob.upload_from_filename(output_file, content_type='application/octet-stream')
 print(f"Uploaded {output_file} to {BUCKET_NAME}")
 os.remove(video_file)
 os.remove(output_file)
 print(f"Processed and deleted {video_file} and {output_file}.")
 
 except subprocess.CalledProcessError as e:
 print(f"Erro ao processar {video_file}: {e}")
 
 move_error_video_to_error_directory(video_file)

 continue # Move para o próximo vídeo na fila após erro

def move_error_video_to_error_directory(video_file):
 print(f"Movendo arquivo de vídeo com erro {video_file} para {ERROR_VIDEOS_DIR}")

 if not os.path.exists(ERROR_VIDEOS_DIR):
 os.makedirs(ERROR_VIDEOS_DIR)
 
 shutil.move(video_file, ERROR_VIDEOS_DIR)

if __name__ == "__main__":
 process_and_upload_video()




-
Anomalie #4598 (Fermé) : PHP 8 : Resource vs GdImage object problem.
4 novembre 2020GD ne retourne plus une "resource", mais une instance de GdImage.
Ça fait planter une partie des filtres images dans SPIP.
Notamment s’il y a des tests avecis_resource()
Exemple :
Warning : Trying to access array offset on value of type bool in [...]ecrire/inc/filtres_images_lib_mini.php on line 1607 à 1610
Qui provient de grosso modo :
[(#CHEMINun_fichier.png|image_applatirico)]Docs¶
- https://php.watch/versions/8.0/gdimage
- La correction chez WP : https://core.trac.wordpress.org/ticket/50833Avec la solution proposée :
Note that in PHP 7.2 and older, instanceOf operator requires an object. If you need to make your code function across PHP versions older than 7.3 through PHP 8.0, you will need an additional is_object() check :
- if (is_resource($image))
+ if (is_resource($image) || (is_object($image) && $image instanceOf \GdImage))