影片音訊分離
在這個練習中,你將切分一支 1980 年代的 Bounce 衣物柔軟精廣告影片。這麼做是為了分開影像與音訊輸入,之後才能分別餵給影像分類器與音訊分類器模型。

ffmpeg_extract_subclip 與 VideoFileClip 模組已載入。MP4 檔案已下載為 bounce_ad.mp4。
本練習屬於課程
使用 Hugging Face 的多模態模型
練習說明
- 從
bounce_ad.mp4建立一個從 0 秒開始、5 秒結束的子片段,輸出檔名為bounce_ad_5s.mp4。 - 載入新的子片段。
- 擷取音訊串流。
- 將音訊串流寫出為
bounce_ad_5s.mp3
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Create a subclip file from bounce_ad.mp4
ffmpeg_extract_subclip(____)
# Load the new subclip
video = ____
# Extract the audio stream
audio = ____
# Write the audio stream
audio.____