前提:
限定音频文件后缀为_a.m4a
限定视频文件后缀为_v.mp4
限定输出文件后缀为_output.mp4
实例:
有test项目,其名称定义为:
音频文件为 test_a.m4a
视频文件为 test_v.mp4
输出文件为 test_output.mp4- @echo off
- title package [m4a + mp4 -^> mp4]
- color 5F
- cls
-
- call :_package "test"
- echo Done ^!
- pause
-
- goto :eof
- :_package
- set "project_name=%~1"
- set "WorkDir=%~dp0"
- set "WorkDir=%WorkDir:~0,-1%"
- set "acFile=%WorkDir%\%project_name%_a.m4a"
- set "vcFile=%WorkDir%\%project_name%_v.mp4"
- set "outFile=%WorkDir%\%project_name%_output.mp4"
- if not exist "%acFile%" goto :_error_miss_file
- if not exist "%vcFile%" goto :_error_miss_file
- if exist "%outFile%" del /q /f "%outFile%"
- ffmpeg -i "%vcFile%" -vcodec copy -i "%acFile%" -acodec copy "%outFile%"
- if exist "%outFile%" (
- del /q /f "%vcFile%"
- del /q /f "%acFile%"
- )
- goto :eof
-
- goto :eof
- :_error_miss_file
- echo Error, Miss File.
- goto :eof
复制代码
|