2012-10-23 20 views
0

所以這裏是我的腳本循環通過特定的視頻擴展»添加手動簡介»產生必要的* .BAT &終於最終‘裝載機’批處理文件來按順序執行以前的* .bat文件需要&日誌記錄(這使自由安靜的交易如果你願意)菜鳥接近自動X264 CMD

::== 
:: gets lines into vars c1 v2 v... 
@echo off 
:: user input required 
cd /d "d:\Trainers\out\" 
setLocal EnableDelayedExpansion 
dir /B /O:N | findstr ".wmv$ " >filename.txt 
echo. >log.txt 
:: user input required 
for /f "tokens=* delims= " %%a in ('type filename.txt ^|findstr ".wmv$"') do (
set /a n+=1 
echo. >file!n!.bat 
set in=%in%%%a 
:: user input required 
set out=!in:.wmv=.mp4! 
:: user input required 
set v=x264 --crf 23 --level 3.1 --tune film -o "d:\Trainers\out\!in!" "d:\Trainers\out\!out!" 
echo. !v!>file!n!.bat 
) 
dir /B /O:N | findstr ".bat$ " >x264_home.txt 
for /f "tokens=* delims= " %%a in (x264_home.txt) do (
set /a n+=1 
:: mtee is an external library Google it 
set "z=call %%a | mtee /d/c/t/+ log.txt" 
echo. !z! >> x264_home.bat 
) 
echo. @echo off > newFile.bat 
type x264_home.bat >> newFile.bat 
type newFile.bat > x264_home.bat 
del newFile.bat,x264_home.txt,filename.txt 
echo. pause >> x264_home.bat 
echo. @echo All Operation done... >> x264_home.bat 
:: user input required 
move "d:\Trainers\out\*.bat" "d:\Program Files\x264_auto\test\" 
:: user input required 
move "d:\Trainers\out\log.txt" "d:\Program Files\x264_auto\test\" 
::== 

現在上面的代碼是很容易理解(BCZ它由一個小白寫的)完美運行&創建必要的文件。例如在file1.bat的一個看起來是這樣的:

x264 --crf 23 --level 3.1 --tune film --preset veryslow --deblock -2:-1 --zones 24233,25324,q=20 --acodec aac --abitrate 80 -o "d:\Trainers\out\1.wmv" "d:\Trainers\out\1.mp4" 

... &裝載機.bat文件看起來像

@echo off 
call file1.bat | mtee /d/c/t/+ log.txt 
call file2.bat | mtee /d/c/t/+ log.txt 
call file3.bat | mtee /d/c/t/+ log.txt 
@echo All Operation done... 

你看這是在一個安靜的靈活的方法,你可以使用特殊filestr»設置另一個循環»設置另一個配置文件。此外,當您大量使用--zone x264功能 時,每個批處理文件都可以進行後期編輯。我成功了,因爲在任何輸出中都沒有錯誤...但它的x264.exe(提供程序/編譯器x264GUI)會拋出錯誤, T'

d:\Program Files\x264_auto\test>x264 --crf 23 --level 3.1 --tune film --preset 
veryslow --deblock -2:-1 --zones 24233,25324,q=20 --acodec aac --abitrate 80 -o 
"d:\Trainers\out\1.wmv" "d:\Trainers\out\1.mp4" 
ffms [error]: could not create index 
lavf [error]: could not open input file 
raw [error]: raw input requires a resolution. 
x264 [error]: could not open input file `d:\Trainers\out\1.mp4' via any method! 

它的x264這就是罪魁禍首可能是一個高級指南,這裏需要

回答

-1

是您的X264與MP4輸入支持編譯? (我相信需要lavc/lavformat,只需從x264.nl下載預編譯的x264,它具有所有額外功能)

如果直接運行相同的命令,是否會得到相同的錯誤? (不通過bat文件)

如果是,是否僅在使用區域時發生? (如果是這樣,那麼將你的命令行例子作爲x264錯誤發佈到x264-devel郵件列表中)

如果否,你確定你運行的是完全相同的x264嗎? (也許有幾個在你的系統上的不同位置)

我建議你在做什麼(a)在cython/bash/shell腳本中使用subprocess.call(...)或(b) , 要麼 。 bat文件幾乎是對任何問題的錯誤答案:)這兩者中的任何一個的好處是它們對程序參數有簡單而規則的轉義規則。