Try   HackMD

FFmpeg:安裝與影音轉檔(mov/mp4/mp3轉檔)

FFmpeg 是一個可以執行音訊和視訊多種格式的錄影、轉檔、串流功能自由軟體,寫OpenCV的時候發現用Iphone手機拍攝的影片檔案格式是 .mov 檔,必須額外轉換成為 .mp4 方便進行後續操作。FFmpeg是用於影片編輯的電腦開源軟體,下載後通過命令列操作可對影片和音訊檔案進行格式轉碼處理,能夠轉換的檔案類型非常多。

這裡介紹如何安裝FFmpeg加入環境變數當中再使用FFmpeg下指令來將影音轉檔。將 .mov 轉換成為 .mp4 影片格式,同理可以將 .mp4 影片檔轉成 .mp3 音檔(等同去除影片部分,只提取音軌)。

一、安裝 FFmpeg 進入環境變數

〔Step 1〕必須先去官網下載FFmpeg:FFmpeg下載網頁

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


〔Step 2〕把下載好的檔案解壓縮,資料夾改名為 ffmpeg

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


〔Step 3〕把 ffmpeg 資料夾扔到Program Files(x86)

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


〔Step 4〕打開控制台 > 系統及安全性 > 系統 > 進階系統設定

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


〔Step 5〕打開環境變數 > 系統變數 > Path > 編輯 > 新增

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


〔Step 6〕在 Path 當中編輯 > 新增 > 輸入以下路徑:

C:\Program Files (x86)\ffmpeg\bin

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


〔Step 7〕檢查是否安裝完成,執行 CMD 輸入 ffmpeg

出現以下畫面就代表安裝成功了。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


二、用FFmpeg下指令將影音轉檔(影片轉音檔)

命令提示字元(系統管理員執行)先進入路徑 C:\Windows\System32
在該路徑下執行 FFmpeg 的轉檔指令後,按下ENTER即可:

〔mov to mp4〕影片檔案格式互轉指令

C:\Windows\System32\ffmpeg.exe -i C:\Videos\待轉換影片.mov C:\Videos\轉換後影片.mp4

紅色部分:FFmpeg.exe的所在位置
黃色部分:原本要轉換的影片檔案路徑
綠色部分:轉換格式後的影片檔案路徑

〔mp4 to mp3〕影片轉音樂檔案指令

C:\Windows\System32\ffmpeg.exe -i C:\Videos\待轉換影片.mp4 C:\Videos\轉換後音檔.mp3

紅色部分:FFmpeg.exe的所在位置
黃色部分:原本要轉換的影片檔案路徑
藍色部分:轉換格式後的音樂檔案路徑

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →



: : 20210420 : : 與松 withhhsong : :

tags: ffmpeg withhhsong tutorials