
Recherche avancée
Autres articles (62)
-
Submit bugs and patches
13 avril 2011Unfortunately a software is never perfect.
If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
You may also (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Emballe médias : à quoi cela sert ?
4 février 2011, parCe plugin vise à gérer des sites de mise en ligne de documents de tous types.
Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;
Sur d’autres sites (9029)
-
Révision 19875 : Report de r19869 : Ferme #2793 : ne pas echapper les single quotes dans les flux...
7 septembre 2012, par cedric - -
Révision 19869 : Ferme #2793 : ne pas echapper les single quotes dans les flux RSS, certains outi...
7 septembre 2012, par cedric - -
FileNotFoundError : [WinError 2] The system cannot find the file specified when using moviepy
17 mars 2023, par HamidBeeI am trying to reduce the file size of a .mp4 file using the following code :


import os
import moviepy.editor as mp
import ffmpeg

def compress_video(input_file, output_file, target_size_ratio=0.5):
 if not os.path.exists(input_file):
 raise FileNotFoundError(f"Input file not found: {input_file}")

 if target_size_ratio <= 0 or target_size_ratio >= 1:
 raise ValueError("Target size ratio must be between 0 and 1")

 # Get input video information
 probe = ffmpeg.probe(input_file)
 video_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'video'), None)
 bitrate = int(video_stream['bit_rate'])

 # Calculate new bitrate to achieve the target file size
 new_bitrate = int(bitrate * target_size_ratio)

 # Load the video and compress
 input_video = mp.VideoFileClip(input_file)
 input_video.write_videofile(
 output_file,
 bitrate=f"{new_bitrate}k",
 codec="libx264",
 audio_codec="aac",
 threads=4,
 ffmpeg_params=["-strict", "-2"]
 )

input_file = r"C:\Users\Hamid\Downloads\A.mp4"
output_file = r"C:\Users\Hamid\Downloads\B.mp4"
compress_video(input_file, output_file, target_size_ratio=0.5)



But I am getting the following error :


FileNotFoundError: [WinError 2] The system cannot find the file specified



Just a note I have a file in that directory called A.mp4 but currently no file exists called B.mp4.