
Recherche avancée
Médias (1)
-
La conservation du net art au musée. Les stratégies à l’œuvre
26 mai 2011
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (72)
-
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 (...) -
Récupération d’informations sur le site maître à l’installation d’une instance
26 novembre 2010, parUtilité
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 (...) -
Contribute to a better visual interface
13 avril 2011MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.
Sur d’autres sites (5706)
-
Why does ffmpeg return "No such file or directory"
4 juillet 2020, par JackNewmanI'm trying to split a video file into 2 second increments and then merge the video back together.


source_vid_path = r"C:\SplitAndMergeVids\Before\before.mp4"
ffcat_path = r'C:\SplitAndMergeVids\Chunk\video.ffcat'
chunks_path = r'C:\SplitAndMergeVids\Chunk\chunk-%03d.mp4'
segments_time = '2'
cmd_input = rf'ffmpeg -fflags +genpts -i {source_vid_path} -map 0 -c copy -f segment -segment_format mp4 -segment_time {segments_time} -segment_list {ffcat_path} -reset_timestamps 1 -v error {chunks_path}'
output = str(subprocess.run(cmd_input, shell=True, capture_output=True))
print(output)

output_path = r'C:\SplitAndMergeVids\Output\output.mp4'
second_input = rf'ffmpeg -y -v error -i {ffcat_path} -map 0 -c copy {output_path}'
output = str(subprocess.run(second_input, shell=True, capture_output=True))
print(output)



First subprocess runs perfectly although the second outputs returns


"Impossible to open 'chunk-000.mp4'\r\nC:\\SplitAndMergeVids\\Chunk\\video.ffcat: No such file or directory".



Full output looks like


CompletedProcess(args='ffmpeg -fflags +genpts -i C:\\SplitAndMergeVids\\Before\\before.mp4 -map 0 -c copy -f segment -segment_format mp4 -segment_time 2 -segment_list C:\\SplitAndMergeVids\\Chunk\\video.ffcat -reset_timestamps 1 -v error C:\\SplitAndMergeVids\\Chunk\\chunk-%03d.mp4', returncode=0, stdout=b'', stderr=b'')
CompletedProcess(args='ffmpeg -y -v error -i C:\\SplitAndMergeVids\\Chunk\\video.ffcat -map 0 -c copy C:\\SplitAndMergeVids\\Output\\output.mp4', returncode=1, stdout=b'', stderr=b"[concat @ 0000028691a6c6c0] Impossible to open 'chunk-000.mp4'\r\nC:\\SplitAndMergeVids\\Chunk\\video.ffcat: No such file or directory\r\n")



When I run cmd_input and second_input manually in cmd, everything functions perfectly. I don't understand how in the first command I am making a file at "ffcat_path", then in the second command I'm using the same "ffcat_path" and it returns "No such file or directory" when it certainly does exist.


-
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


-
PHP exec() Not Working With ffmpeg
28 juillet 2016, par DodinasI’m attempting to run the following command in PHP (on Ubuntu) :
<?php
if (exec("/home/johnboy/ffmpeg/ffmpeg -i test1.mp4 -acodec aac -ab 128kb -vcodec mpeg4 -b 1220kb -mbd 1 -s 320x180 final_video.mov"))
{ echo "Success"; }
else { echo "No good"; }And I always get "No good" echoed back, and no file created.
Interestingly, if I run the same exact command in Shell, it works, no problems.
Also, when I run the same code above, but subsitute "whoami" instead of the ffmpeg stuff, it works. (It echoes back "Success")
Any ideas on why this wouldn’t be working ? Thanks.