
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (101)
-
Qu’est ce qu’un masque de formulaire
13 juin 2013, parUn masque de formulaire consiste en la personnalisation du formulaire de mise en ligne des médias, rubriques, actualités, éditoriaux et liens vers des sites.
Chaque formulaire de publication d’objet peut donc être personnalisé.
Pour accéder à la personnalisation des champs de formulaires, il est nécessaire d’aller dans l’administration de votre MediaSPIP puis de sélectionner "Configuration des masques de formulaires".
Sélectionnez ensuite le formulaire à modifier en cliquant sur sont type d’objet. (...) -
Configuration spécifique d’Apache
4 février 2011, parModules spécifiques
Pour la configuration d’Apache, il est conseillé d’activer certains modules non spécifiques à MediaSPIP, mais permettant d’améliorer les performances : mod_deflate et mod_headers pour compresser automatiquement via Apache les pages. Cf ce tutoriel ; mode_expires pour gérer correctement l’expiration des hits. Cf ce tutoriel ;
Il est également conseillé d’ajouter la prise en charge par apache du mime-type pour les fichiers WebM comme indiqué dans ce tutoriel.
Création d’un (...) -
Organiser par catégorie
17 mai 2013, parDans 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 (...)
Sur d’autres sites (5875)
-
python [WinError 2] the System Cannot Find the File Specified
15 août 2024, par user26831166Code cant create a certain file
The thing is code isn't mine a took it from a friend and my friend get it from another person
and this 2 person can run code without any problem
but i have.


import os
import random
import shutil
import subprocess

# Путь к папке с видео
video_folder = r'D:\bots\ttvidads\VID\Videorez'

# Путь к папке для сохранения результатов
output_folder = r'D:\bots\ttvidads\VID\ZAGOTOVKI\Videopod1'

# Очищаем содержимое конечной папки перед сохранением
for file in os.listdir(output_folder):
 file_path = os.path.join(output_folder, file)
 try:
 if os.path.isfile(file_path):
 os.unlink(file_path)
 except Exception as e:
 print(f"Failed to delete {file_path}. Reason: {e}")

# Получаем список видеофайлов
video_files = [os.path.join(video_folder, file) for file in os.listdir(video_folder) if file.endswith(('.mp4', '.avi'))]

# Выбираем случайное видео
random_video = random.choice(video_files)

# Получаем длительность видео в секундах
video_duration_command = f'ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "{random_video}"'
video_duration_process = subprocess.Popen(video_duration_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
video_duration_output, _ = video_duration_process.communicate()
video_duration = float(video_duration_output)

# Выбираем случайное начальное время для вырезания
random_start = random.randrange(0, int(video_duration) - 19, 8)

# Получаем ширину и высоту исходного видео
video_info_command = f'ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 "{random_video}"'
video_info_process = subprocess.Popen(video_info_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
video_info_output, _ = video_info_process.communicate()
video_width, video_height = map(int, video_info_output.strip().split(b'x'))

# Вычисляем новые координаты x1 и x2 для обрезки
max_x1 = video_width - int(video_height * 9 / 16)
random_x1 = random.randint(0, max_x1)
random_x2 = random_x1 + int(video_height * 9 / 16)

# Формируем команду для FFmpeg для выборки случайного отрезка видео с соотношением 9:16
ffmpeg_command = f'ffmpeg -hwaccel cuda -ss {random_start} -i "{random_video}" -t 19 -vf "crop={random_x2-random_x1}:{video_height}:{random_x1}:0" -c:v h264_nvenc -preset default -an -c:a aac -b:a 128k "{output_folder}\\temp.mp4"'

# Выполняем команду с помощью subprocess
subprocess.run(ffmpeg_command, shell=True)

# Изменяем яркость, контрастность и размываем видео
brightness_factor = random.uniform(-0.18, -0.12) # Случайный коэффициент яркости
contrast_factor = random.uniform(0.95, 1.05) # Случайный коэффициент контрастности
blur_factor = random.uniform(4, 5) # Случайный коэффициент размытия

# Формируем команду для FFmpeg для изменения яркости, контрастности и размытия видео
ffmpeg_modify_command = f'ffmpeg -hwaccel cuda -i "{output_folder}\\temp.mp4" -vf "eq=brightness={brightness_factor}:contrast={contrast_factor},boxblur={blur_factor}:{blur_factor}" -c:v h264_nvenc -preset default -an -c:a aac -b:a 128k "{output_folder}\\temp_modify.mp4"'

# Выполняем команду с помощью subprocess
subprocess.run(ffmpeg_modify_command, shell=True)

# Растягиваем видео до нужного разрешения (1080x1920)
ffmpeg_stretch_command = f'ffmpeg -hwaccel cuda -i "{output_folder}\\temp_modify.mp4" -vf "scale=1080:1920" -c:v h264_nvenc -preset default -an -c:a aac -b:a 128k -r 30 "{output_folder}\\final_output.mp4"'

# Выполняем команду с помощью subprocess
subprocess.run(ffmpeg_stretch_command, shell=True)

# Удаляем временные файлы
os.remove(os.path.join(output_folder, 'temp.mp4'))
os.remove(os.path.join(output_folder, 'temp_modify.mp4'))

print("Видеофайл успешно обработан и сохранен.")



Error i got after run the code


= RESTART: D:\Bots\2vidpod.py
Traceback (most recent call last):
 File "D:\Bots\2vidpod.py", line 71, in <module>
 os.remove(os.path.join(output_folder, 'temp.mp4'))
FileNotFoundError: [WinError 2] Не удается найти указанный файл: 'D:\\bots\\ttvidads\\VID\\ZAGOTOVKI\\Videopod1\\temp.mp4'
</module>


so things i checked is
path is right
programs is installed FFMPEG and PYTHON all additional libraries downloaded
i pretty sure error caused by regular path and i wanna know if absolute path can do the thing


-
What is Web Log Analytics and Why You Should Use It
26 juin 2024, par Erin -
SEO for Financial Services : The Ultimate Guide
26 juin 2024, par Erin