Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
改用ffmpeg接
Browse files Browse the repository at this point in the history
  • Loading branch information
sih4sing5hong5 committed Nov 16, 2018
1 parent b319b67 commit 561731d
Showing 1 changed file with 25 additions and 35 deletions.
60 changes: 25 additions & 35 deletions 鬥做伙/做影片.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,42 +54,32 @@ def 收著資料(cls, 腔口參數, 圖陣列, 聲陣列, 字陣列, 存檔所
@classmethod
def 敆做伙(cls, 圖陣列, 聲陣列, 字陣列, 存檔所在):
with TemporaryDirectory() as 目錄:
全部結果檔 = []
for 第幾个, (, , ) in enumerate(zip(圖陣列, 聲陣列, 字陣列)):
結果檔 = join(目錄, 'output{}.mkv'.format(第幾个))
暫時圖 = join(目錄, 'jpg{}.jpg'.format(第幾个))
cls._走指令([
'convert',
,
暫時圖,
])
cls._走指令([
'avconv',
'-i', 暫時圖, '-i', , '-vf', 'subtitles={}'.format(),
'-s', 'svga', '-y', 結果檔,
])
全部結果檔.append(結果檔)
敆做伙結果檔 = join(目錄, 'result.mkv')
敆做伙指令 = ['mkvmerge']
敆做伙指令.append('-o')
敆做伙指令.append(敆做伙結果檔)
for 結果檔 in 全部結果檔:
敆做伙指令.append(結果檔)
敆做伙指令.append('+')
敆做伙指令.pop()
cls._走指令(敆做伙指令)

敆做伙轉換檔 = join(目錄, 'result.mp4')
上尾轉換指令 = ['avconv']
上尾轉換指令.append('-i')
上尾轉換指令.append(敆做伙結果檔)
# 上尾轉換指令.append('-c')
# 上尾轉換指令.append('copy')
上尾轉換指令.append('-y')
上尾轉換指令.append(敆做伙轉換檔)
cls._走指令(上尾轉換指令)
全部結果表 = join(目錄, 'tuan.pio')
with open(全部結果表, 'w') as :
for 第幾个, (, , ) in enumerate(zip(圖陣列, 聲陣列, 字陣列)):
結果檔 = join(目錄, 'output{}.mp4'.format(第幾个))
暫時圖 = join(目錄, 'jpg{}.jpg'.format(第幾个))
cls._走指令([
'convert',
,
暫時圖,
])
cls._走指令([
'avconv',
'-i', 暫時圖, '-i', , '-vf', 'subtitles={}'.format(),
'-s', 'svga', '-y', 結果檔,
])
print("file '{}'".format(結果檔), file=)

copyfile(敆做伙轉換檔, 存檔所在)
敆做伙指令 = [
'ffmpeg',
'-f', 'concat',
'-safe', '0',
'-i', 全部結果表,
'-c', 'copy',
存檔所在
]
cls._走指令(敆做伙指令)

@classmethod
def 轉文本資料(cls, 腔口參數, 文字陣列, 目錄):
Expand Down

0 comments on commit 561731d

Please sign in to comment.