12 秒間実行される一般的な紹介タイトル ビデオ (MP4) を取得し、それを他の 4 つの MP4 ビデオ (同じビデオですが、それぞれ異なる言語のオーディオ トラックがあります) の先頭に添付しようとするバッチ スクリプトを作成しました。
ここのffmpeg構文によると:http://ffmpeg.org/trac/ffmpeg/wiki/How%20to%20concatenate%20%28join,%20merge%29%20media%20files concat demuxerは、テキストファイルから実行する必要があります次のようになります。
# this is a comment
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
ファイルを結合する時点まで、スクリプトのすべてが正しく機能しているように見えると思います。しかし、私はこのエラーが発生します:
[concat @ 04177d00] Line 2: unknown keyword ''C:\Users\Joe\1May\session3\readyforfinalconversion\frenchfile.mp4'
filelistFrench.txt: Invalid data found when processing input
[concat @ 03b70a80] Line 2: unknown keyword ''C:\Users\Joe\1May\session3\readyforfinalconversion\spanishfile.mp4'
filelistSpanish.txt: Invalid data found when processing input
[concat @ 0211b960] Line 2: unknown keyword ''C:\Users\Joe\1May\session3\readyforfinalconversion\basquefile.mp4'
filelistBasque.txt: Invalid data found when processing input
[concat @ 03a20a80] Line 2: unknown keyword ''C:\Users\Joe\1May\session3\readyforfinalconversion\Englishfile.mp4'
filelistEnglish.txt: Invalid data found when processing input
問題は作成中のテキスト ファイルにあると思います。無知で申し訳ありませんが、私のような新しいスクリプト作成者は、開発者の専門用語について混乱し、物事を文字どおりに受け取ることがあります。
彼らが提供したテキスト ファイルの例を見たとき、これが私のテキスト ファイルのようなものだと考えるのは正しいでしょうか?
# this is a comment
Titlefile.mp4 'C:\Users\Joe\1May\session3\readyforfinalconversion\Titlefile.mp4'
Englishfile.mp4 'C:\Users\Joe\1May\session3\readyforfinalconversion\Englishfile.mp4'
繰り返しますが、私は文字通りすぎますか? 引用は正しいですか?スラッシュは正しいですか?例では、パス内のスラッシュは、通常の windows \ の代わりに / です。役立つ場合に備えて、スクリプト全体を提供します。
@echo off
setlocal EnableDelayedExpansion
rem Create an array of languages
set i=0
for %%a in (French Spanish Basque English) do (
set /A i+=1
set term[!i!]=%%a
)
rem Get the title video file name from user
set /p titlevideofilename=What is the title video file
name?
rem create a path variable for the title video file
set pathtotitlevideo=%~dp0%titlevideofilename%
rem Get the names of the different language video files to append to the title video
rem create a path variable for each different language video files
for /L %%i in (1,1,4) do (
set /p language[%%i]=what is the name of the !term
[%%i]! file you want to append after the title video?
set pathtofile[%%i]=%~dp0!language[%%i]!
)
rem create data file for ffmpeg based on variable data
for /L %%i in (1,1,4) do (
echo # this is a comment>>filelist!term[%
%i]!.txt
echo file '%pathtotitlevideo%'>>filelist!term[%
%i]!.txt
echo file '!pathtofile[%%i]!'>>filelist!term[%
%i]!.txt
)
cls
rem join files using ffmpeg concat option
for /L %%i in (1,1,4) do (
c:\ffmpeg\ffmpeg\bin\ffmpeg.exe -loglevel error -f
concat -i filelist!term[%%i]!.txt -c copy !language[%
%i]!.!term[%%i]!.withtitle.mp4
)
endlocal
:eof
exit
編集
@foxidrive のおかげで、私はそれの単純さを見ました...どうやら私は文字通り十分ではなかったようです。私はこれらの 3 つの変更を行い、スクリプトは完全に動作するようになりました。3: 例にあるように、"/" の代わりに "\" を使用しました。
したがって、テキスト ファイルを作成するコードは次のようになります。
rem create data file for ffmpeg based on variable data
for /L %%i in (1,1,4) do (
echo # this is a comment>>filelist!term[%
%i]!.txt
echo file '%pathtotitlevideo%'>>filelist!term[%
%i]!.txt
echo file '!pathtofile[%%i]!'>>filelist!term[%
%i]!.txt
)
だから今私のテキストファイルは次のようになります:
# this is a comment
file 'C:\Users\Joe\1May\session3\readyforfinalconversion\Titlefile.mp4'
file 'C:\Users\Joe\1May\session3\readyforfinalconversion\Englishfile.mp4'