⎗ ✓ 1 2 3 4!pip install moviepy !pip install pydub !pip3 install imageio==2.4.1 !pip install --upgrade imageio-ffmpeg ⎗ ✓ 1urltext = "" ⎗ ✓ 1 2 3!rm -rf e*.wav !python3 -m pip install -U yt-dlp !yt-dlp -x --audio-format wav --output "extract.%(ext)s" {urltext) ⎗ ✓ 1 2 3 4 5 6 7 8 9 10 11 12 13 14from moviepy.editor import * import IPython from pydub import AudioSegment from moviepy.editor import * audio_path = r'/content/180713交渉録音.mp3' image_path = r'/content/IMG_9724_00001.jpg' #画像ファイル 720*480 audio = AudioSegment.from_file(audio_path, 'mp3') video = ImageClip(image_path).set_duration(audio.duration_seconds) video.write_videofile(rf"test_movie.mp4", fps=30, audio=audio_path) IPython.display.Video(r'/content/test_movie.mp4' ⎗ ✓ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22from urllib.parse import urlparse, parse_qs args = [urltext] video_id = '' def extract_video_id(url): query = urlparse(url) if query.hostname == 'youtu.be': return query.path[1:] if query.hostname in {'www.youtube.com', 'youtube.com'}: if query.path == '/watch': return parse_qs(query.query)['v'][0] if query.path[:7] == '/embed/': return query.path.split('/')[2] if query.path[:3] == '/v/': return query.path.split('/')[2] # fail? return None for url in args: video_id = (extract_video_id(url)) print('youtube video_id:',video_id) from IPython.display import YouTubeVideo YouTubeVideo(video_id