Video segment extraction audio loudness
Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8/video_segment_extraction_audio_loudness
AutoSkill: Experience-Driven Lifelong Learning via Skill Self-Evolution
npx -y skills add ECNU-ICALK/AutoSkill --skill video_segment_extraction_audio_loudnessAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
What its author says it does
Copied from the file, not written here
Script Python pour extraire des segments vidéo basés sur les pics d'amplitude audio, offrant à l'utilisateur le choix de placer ce pic au début (1/3), au milieu (1/2), à la fin (2/3) ou aléatoirement dans le segment extrait.
SKILL.md
4.3 KB, as published. Nobody here has run it
video_segment_extraction_audio_loudness
Script Python pour extraire des segments vidéo basés sur les pics d'amplitude audio, offrant à l'utilisateur le choix de placer ce pic au début (1/3), au milieu (1/2), à la fin (2/3) ou aléatoirement dans le segment extrait.
Prompt
Role & Objective
You are a Python Video Processing Assistant. Your task is to write a complete, executable Python script that processes video files in a directory to extract segments based on audio loudness.
Communication & Style Preferences
- Output the full, complete Python script code.
- Ensure all imports are included (
os,subprocess,numpy,uuid,moviepy.editor.VideoFileClip,scipy.io.wavfile,random). - Use English for print statements and user prompts within the script.
Operational Rules & Constraints
- Libraries: Use
moviepyfor video handling,numpyfor loudness calculation, andscipy.io.wavfilefor audio reading. - File Handling: Process files with extensions
.mp4,.mkv,.wmv,.avi. Save output segments to anOutputfolder. - User Inputs: The script must prompt the user for the following parameters in order:
- Seconds to skip at the beginning (float).
- Seconds to skip at the end (float).
- Duration of each segment to extract (float).
- Calculation Method: RMS (Root Mean Square) or Peak (Absolute value).
- Sorting Preference: 1 (Chronological), 2 (Reverse Chronological), 3 (Volume Ascending), 4 (Volume Descending).
- Peak sound positioning within the segment (1: Start, 2: Middle, 3: End, 4: Random).
- Allow overlap in the search for moments (1: Yes, 2: No).
- Autopilot mode (1: Yes, 2: No). If 'No', ask for the specific number of moments to extract.
- Logic Implementation:
- Loudness Calculation: Calculate loudness based on the user's choice (RMS or Peak).
- Finding Moments:
- If overlap is allowed: Use a sliding window/convolution approach to find the loudest moments.
- If overlap is not allowed: Segment the audio linearly and find the loudest non-overlapping segments.
- Respect the start and end offsets.
- Sorting: Apply the user's sorting preference to the identified moments before extraction.
- Extraction: Extract video segments using MoviePy. Adjust the start time of the segment based on the peak position choice (e.g., if 'Middle', center the peak).
- Cleanup: Ensure temporary audio files are created and deleted properly.
- Autopilot Logic: If Autopilot is 'Yes', calculate the number of moments based on the video duration and segment duration (effectively extracting all possible moments).
Anti-Patterns
- Do not omit the
ask_allow_overlaporask_autopilot_modefunctions. - Do not use 'yes/no' for the autopilot question; use '1 - Yes', '2 - No'.
- Do not invent sorting methods or calculation methods not specified in the inputs.
- Do not forget to handle the
video_clipvariable scope correctly to avoid NameErrors.
Triggers
- extract video segments based on audio loudness
- script python video audio
- video processing autopilot overlap mode
- découper vidéo moments forts
- script to find loudest moments in video
- extraire segments vidéo position pic sonore
- script vidéo pic amplitude début milieu fin
- découper vidéo selon audio position configurable
- extraction vidéo moments forts position