Slide 21
Slide 21 text
Use the python code interpreter to convert mp4 to mp3 and then download it.
You can lower the sound quality if you want to process it faster.
Below is a code sample.
---
import subprocess
# Define input and output paths
input_path = "/mnt/data/test.mp4"
output_path = "/mnt/data/test_audio_ffmpeg.mp3"
# Run ffmpeg command to extract audio
# -y: overwrite without asking
# -vn: no video
# -ab 64k: audio bitrate (lower for faster, smaller file)
command = [
"ffmpeg",
"-i", input_path,
"-vn",
"-ab", "64k",
"-ar", "44100", # sample rate
"-y",
output_path
]
# Execute the command
subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# Return output path
output_path
mp4をmp3にして
/mnt/dataでやりとりして
ffmpegつかって
中知ってる前提で
プロンプトを書く