
Recherche avancée
Autres articles (39)
-
Dépôt de média et thèmes par FTP
31 mai 2013, parL’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...) -
Changer le statut par défaut des nouveaux inscrits
26 décembre 2015, parPar défaut, lors de leur inscription, les nouveaux utilisateurs ont le statut de visiteur. Ils disposent de certains droits mais ne peuvent pas forcément publier leurs contenus eux-même etc...
Il est possible de changer ce statut par défaut. en "rédacteur".
Pour ce faire, un administrateur webmestre du site doit aller dans l’espace privé de SPIP en ajoutant ecrire/ à l’url de son site.
Une fois dans l’espace privé, il lui faut suivre les menus configuration > Interactivité et activer (...) -
MediaSPIP v0.2
21 juin 2013, parMediaSPIP 0.2 est la première version de MediaSPIP stable.
Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)
Sur d’autres sites (4828)
-
What Are Website KPIs (10 KPIs and Best Ways to Track Them)
3 mai 2024, par Erin -
What Is Ethical SEO & Why Does It Matter ?
7 mai 2024, par Erin -
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