
Recherche avancée
Médias (16)
-
#7 Ambience
16 octobre 2011, par
Mis à jour : Juin 2015
Langue : English
Type : Audio
-
#6 Teaser Music
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#5 End Title
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#3 The Safest Place
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#4 Emo Creates
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#2 Typewriter Dance
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
Autres articles (72)
-
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...) -
Encodage et transformation en formats lisibles sur Internet
10 avril 2011MediaSPIP transforme et ré-encode les documents mis en ligne afin de les rendre lisibles sur Internet et automatiquement utilisables sans intervention du créateur de contenu.
Les vidéos sont automatiquement encodées dans les formats supportés par HTML5 : MP4, Ogv et WebM. La version "MP4" est également utilisée pour le lecteur flash de secours nécessaire aux anciens navigateurs.
Les documents audios sont également ré-encodés dans les deux formats utilisables par HTML5 :MP3 et Ogg. La version "MP3" (...) -
Problèmes fréquents
10 mars 2010, parPHP et safe_mode activé
Une des principales sources de problèmes relève de la configuration de PHP et notamment de l’activation du safe_mode
La solution consiterait à soit désactiver le safe_mode soit placer le script dans un répertoire accessible par apache pour le site
Sur d’autres sites (5140)
-
Segmentation Analytics : How to Leverage It on Your Site
27 octobre 2023, par Erin — Analytics Tips -
What is Audience Segmentation ? The 5 Main Types & Examples
16 novembre 2023, par Erin — Analytics Tips -
Could anyone help me understand why moviepy is rendering at 2.5 it/s ?
23 décembre 2023, par tristanI'm writing a program that uses moviepy to make those weird reddit thread videos with mc parkour playing in the background (real original ik), and everything is good except for when im rendering video which seems to consume a ton of memory and moves really... really slow, like 2.5 it/s. could anyone help ? also im a novice programmer that has no bearing on what is conventional or proper, so sorry if my code is very bad.


from moviepy.video.fx.all import resize
from moviepy.video.tools.subtitles import SubtitlesClip
from moviepy.editor import (
 CompositeVideoClip,
 AudioFileClip,
 VideoFileClip,
 ImageClip,
 TextClip
)
import random
import moviepy.config as cfg
import librosa
from imagegenerator import draw_title
from audioeditor import concatenate_audios
import soundfile as sf
import numpy as np

# Constants
VIDEO_FADE_DURATION = 0.4
SPEED_FACTOR = 1.1
TEXT_WIDTH = 600
MINIMUM_FONT_SIZE = 60
FONT_COLOR = "white"
OUTLINE_COLOR = "black"
TITLE_ANIMATION_DURATION = 0.25
ANIMATION_DURATION = 0.2

# Configure imagemagick binary
cfg.change_settings(
 {
 "IMAGEMAGICK_BINARY": "magick/magick.exe"
 }
)

# Ease-out function
def ease_out(t):
 return 1 - (1 - t) ** 2

# Overlap audio files
def overlap_audio_files(audio_path1, audio_path2):
 # Load the first audio file
 audio1, sr1 = librosa.load(audio_path1, sr=None)

 # Load the second audio file
 audio2, sr2 = librosa.load(audio_path2, sr=None)

 # Ensure both audio files have the same sample rate
 if sr1 != sr2:
 raise ValueError("Sample rates of the two audio files must be the same.")

 # Calculate the duration of audio2
 audio2_duration = len(audio2)

 # Tile audio1 to match the duration of audio2
 audio1 = np.tile(audio1, int(np.ceil(audio2_duration / len(audio1))))

 # Trim audio1 to match the duration of audio2
 audio1 = audio1[:audio2_duration]

 # Combine the audio files by superimposing them
 combined_audio = audio1 + audio2

 # Save the combined audio to a new file
 output_path = "temp/ttsclips/combined_audio.wav"
 sf.write(output_path, combined_audio, sr1)

 return output_path

# Generator function for subtitles with centered alignment and outline
def centered_text_generator_white(txt):
 return TextClip(
 txt,
 font=r"fonts/Invisible-ExtraBold.otf",
 fontsize=86,
 color=FONT_COLOR,
 bg_color='transparent', # Use a transparent background
 align='center', # Center the text
 size=(1072, 1682),
 method='caption', # Draw a caption instead of a title
 )

# Generator function for subtitles with centered alignment and blurred outline
def centered_text_generator_black_blurred_outline(txt, blur_factor=3):
 outline_clip = TextClip(
 txt,
 font=r"fonts/Invisible-ExtraBold.otf",
 fontsize=86,
 color=OUTLINE_COLOR,
 bg_color='transparent', # Use a transparent background
 align='center', # Center the text
 size=(1080, 1688),
 method='caption', # Draw a caption instead of a title
 )

 # Blur the black text (outline)
 blurred_outline_clip = outline_clip.fx(resize, 1.0 / blur_factor)
 blurred_outline_clip = blurred_outline_clip.fx(resize, blur_factor)

 return blurred_outline_clip

# Compile video function
def compile_video(title_content, upvotes, comments, tone, subreddit, video_num):
 # Set the dimensions of the video (720x1280 in this case)
 height = 1280

 # Concatenate the audios
 concatenate_audios()

 concatenated_audio_path = r"temp/ttsclips/concatenated_audio.mp3"
 title_audio_path = r"temp/ttsclips/title.mp3"

 title_audio = AudioFileClip(title_audio_path)
 concatenated_audio = AudioFileClip(concatenated_audio_path)

 # Calculate for video duration
 title_duration = title_audio.duration
 duration = concatenated_audio.duration

 # Set background
 background_path = f"saved_videos/newmcparkour.mp4"
 background = VideoFileClip(background_path)
 background_duration = background.duration
 random_start = random.uniform(0, background_duration - duration)
 background = background.subclip(random_start, random_start + duration)

 # Apply fade-out effect to both background clips
 background = background.crossfadeout(VIDEO_FADE_DURATION)

 # Generate the background image with rounded corners
 background_image_path = draw_title(title_content, upvotes, comments, subreddit)

 # Load the background image with rounded corners
 background_image = ImageClip(background_image_path)

 # Set the start of the animated title clip
 animated_background_clip = background_image.set_start(0)

 # Set the initial position of the text at the bottom of the screen
 initial_position = (90, height)

 # Calculate the final position of the text at the center of the screen
 final_position = [90, 630]

 # Animate the title clip to slide up over the course of the animation duration
 animated_background_clip = animated_background_clip.set_position(
 lambda t: (
 initial_position[0],
 initial_position[1]
 - (initial_position[1] - final_position[1])
 * ease_out(t / TITLE_ANIMATION_DURATION),
 )
 )

 # Set the duration of the animated title clip
 animated_background_clip = animated_background_clip.set_duration(
 TITLE_ANIMATION_DURATION
 )

 # Assign start times to title image
 stationary_background_clip = background_image.set_start(TITLE_ANIMATION_DURATION)

 # Assign positions to stationary title image
 stationary_background_clip = stationary_background_clip.set_position(final_position)

 # Assign durations to stationary title image
 stationary_background_clip = stationary_background_clip.set_duration(
 title_duration - TITLE_ANIMATION_DURATION
 )

 # Select background music
 if tone == "normal":
 music_options = [
 "Anguish",
 "Garden",
 "Limerence",
 "Lost",
 "NoWayOut",
 "Summer",
 "Never",
 "Miss",
 "Touch",
 "Stellar"
 ]
 elif tone == "eerie":
 music_options = [
 "Creepy",
 "Scary",
 "Spooky",
 "Space",
 "Suspense"
 ]
 background_music_choice = random.choice(music_options)
 background_music_path = f"music/eeriemusic/{background_music_choice}.mp3"

 # Create final audio by overlapping background music and concatenated audio
 final_audio = AudioFileClip(
 overlap_audio_files(background_music_path, concatenated_audio_path)
 )

 # Release the concatenated audio
 concatenated_audio.close()

 # Create subtitles clip using the centered_text_generator
 subtitles = SubtitlesClip("temp/ttsclips/content_speechmarks.srt",
 lambda txt: centered_text_generator_white(txt))
 subtitles_outline = SubtitlesClip("temp/ttsclips/content_speechmarks.srt",
 lambda txt: centered_text_generator_black_blurred_outline(txt))

 # Overlay subtitles on the blurred background
 final_clip = CompositeVideoClip(
 [background, animated_background_clip, stationary_background_clip, subtitles_outline, subtitles]
 )

 # Set the final video dimensions and export the video
 final_clip = final_clip.set_duration(duration)
 final_clip = final_clip.set_audio(final_audio)

 final_clip.write_videofile(
 f"temp/videos/{video_num}.mp4",
 codec="libx264",
 fps=60,
 bitrate="8000k",
 audio_codec="aac",
 audio_bitrate="192k",
 preset="ultrafast",
 threads=8
 )

 # Release the concatenated audio
 concatenated_audio.close()

 # Release the title audio
 title_audio.close()

 # Release the background video and image
 background.close()
 background_image.close()

 # Release the final audio
 final_audio.close()

 # Release the subtitle clips
 subtitles.close()
 subtitles_outline.close()

 # Release the final video clip
 final_clip.close()



ive tried turning down my settings, like setting it to "ultrafast" and dropping the bitrate, but nothing seems to work. the only thing I can think of now is that there is something Im doing wrong with moviepy.