Skip to content

Instantly share code, notes, and snippets.

@KenLuoTW
Last active June 4, 2023 04:52
Show Gist options
  • Save KenLuoTW/ba31d3fd59e4f5e6df65728da30f5dba to your computer and use it in GitHub Desktop.
Save KenLuoTW/ba31d3fd59e4f5e6df65728da30f5dba to your computer and use it in GitHub Desktop.
一﹒當來源是單音軌的 MP4 檔案
Video.mp4 視訊檔 (原始視訊、音訊未消音)
AudioL.aac 伴唱檔 (立體聲)
AudioR.aac 人聲檔 (立體聲)
1.將視訊檔、伴唱檔、人聲檔合成為左伴右唱的 MP4 檔案 (視訊採複製、音訊縮混重編碼)
======================================================================================
ffmpeg -i "Video.mp4" -i "AudioL.aac" -i "AudioR.aac" -map 0:v -c:v copy -filter_complex "[1:a][2:a]amerge=inputs=2,pan=stereo|c0<c0+c1|c1<c2+c3[a]" -map "[a]" -c:a aac -ab 256K -ar 48000 "output.mp4"
2.人聲聲道沿用視訊檔,將視訊檔、伴唱檔合成為左伴右唱的 MP4 檔案 (視訊採複製、音訊縮混重編碼)
======================================================================================
ffmpeg -i "Video.mp4" -i "AudioL.aac" -map 0:v -c:v copy -filter_complex "[1:a][0:a]amerge=inputs=2,pan=stereo|c0<c0+c1|c1<c2+c3[a]" -map "[a]" -c:a aac -ab 256K -ar 48000 "output.mp4"
3.將視訊檔、伴唱檔、人聲檔合成為音軌1人聲、音軌2伴唱的 MKV 檔案 (視訊採複製、音訊重編碼)
======================================================================================
ffmpeg -i "Video.mp4" -i "AudioL.aac" -i "AudioR.aac" -map 0:v -c:v copy -map 2:a -map 1:a -c:a aac -ab 256K -ar 48000 "output.mkv"
4.人聲音軌沿用視訊檔,將視訊檔、伴唱檔合成為音軌1人聲、音軌2伴唱的 MKV 檔案 (視訊採複製、音訊重編碼)
======================================================================================
ffmpeg -i "Video.mp4" -i "AudioL.aac" -map 0:v -c:v copy -map 0:a -map 1:a -c:a aac -ab 256K -ar 48000 "output.mkv"
5.人聲音軌沿用視訊檔,將視訊檔、伴唱檔合成為音軌1人聲、音軌2伴唱的 DVD 檔案 (視訊重編碼、音訊重編碼)
======================================================================================
ffmpeg -i "Video.mp4" -i "AudioL.aac" -map 0:v -map 0:a -map 1:a -target ntsc-dvd "output.mpg"
6.人聲聲道沿用視訊檔,將視訊檔、伴唱檔合成為左伴右唱的 VCD 檔案 (視訊重編碼、音訊重編碼)
======================================================================================
ffmpeg -i "Video.mp4" -i "AudioL.aac" -map 0:v -filter_complex "[1:a][0:a]amerge=inputs=2,pan=stereo|c0<c0+c1|c1<c2+c3[a]" -map "[a]" -target ntsc-vcd "output.mpg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment