<job>
<script>

fs    = new ActiveXObject('Scripting.FileSystemObject')
shell = new ActiveXObject('WScript.Shell')

ffmpeg = fs.GetParentFolderName(WScript.ScriptFullName)+'\\ffmpeg.exe'
// WScript.Echo(ffmpeg)

arg = WScript.Arguments
if(!arg.length){
	WScript.Echo('変換するファイルをD&Dしてください')
	WScript.Quit()
}

fun = function(str){return str.indexOf(' ')>0 ? ('"'+str+'"') : str}

path_h265 = fs.GetParentFolderName(arg(0))+'\\h265'
if(!fs.FolderExists(path_h265)){ fs.createFolder(path_h265) }

for(i=0,L=arg.length;i<L;i++){
	path    = arg(i)
	pathOut = path_h265+'\\'+fs.GetBaseName(path)+'.mp4'
	shell.run(ffmpeg+' -i '+fun(path)+' -vcodec libx265 '+fun(pathOut), 1, true)
}

</script>
</job>