「指定ディレクトリ内のすべてのムービーを見つけ出し、ffmpegで変換するbatを作成」の編集履歴(バックアップ)一覧はこちら
追加された行は緑色になります。
削除された行は赤色になります。
//python
import os
import os.path
movDir = 'D:\\Movies'
exportDir = 'C:\\temp\\avi'
Command = 'E:\ncd C:\\ffmpeg\n'
movieExt = ['.mov', '.avi', '.mpg', '.wmv', '.mpeg', '.qt', '.mp4', '.swf']
for root, dirs, files in os.walk(movDir):
for fname in files:
raw = os.path.splitext(fname)[0]
ext = os.path.splitext(fname)[1].lower()
if ext in movieExt:
Command = (Command
+ 'ffmpeg -bitexact -y -i "'
+ os.path.join(root, fname)
+ '" -acodec libmp3lame -b 8192k -ab 128k -f avi -vcodec libxvid -ar 22050 "'
+ os.path.join(exportDir, raw)
+'.avi"\n')
# Create Bat file
o=open(exportDir + '\\cmd.bat','w')
o.write(Command)
o.close()
//python
import os
import os.path
movDir = 'D:\\Movies'
exportDir = 'C:\\temp\\avi'
Command = 'E:\ncd C:\\ffmpeg\n'
movieExt = ['.mov', '.avi', '.mpg', '.wmv', '.mpeg', '.qt', '.mp4', '.swf', '.flv']
for root, dirs, files in os.walk(movDir):
for fname in files:
raw = os.path.splitext(fname)[0]
ext = os.path.splitext(fname)[1].lower()
if ext in movieExt:
Command = (Command
+ 'ffmpeg -bitexact -y -i "'
+ os.path.join(root, fname)
+ '" -acodec libmp3lame -b 8192k -ab 128k -f avi -vcodec libxvid -ar 22050 "'
+ os.path.join(exportDir, raw)
+'.avi"\n')
# Create Bat file
o=open(exportDir + '\\cmd.bat','w')
o.write(Command)
o.close()