第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Ubuntu 上的 HandbrakeCLI 出現(xiàn) Python 錯誤且未找到文件

Ubuntu 上的 HandbrakeCLI 出現(xiàn) Python 錯誤且未找到文件

牛魔王的故事 2023-09-05 20:29:15
我正在嘗試用 python3 編寫一個程序,在我的 ubuntu 機(jī)器上使用 handbrakecli 來重新編碼一些視頻。我錯過了一些愚蠢的東西,但我一生都無法弄清楚這一點(diǎn),而且我已經(jīng)為此花費(fèi)了無數(shù)個小時。這是代碼:def convertvideo(input_file):    hb_args = (" -i " + input_file + " -o " + handbraketempspace + " --preset-import-file "+handbrake_json_file_location + " -Z " + handbrake_profile_name)    print (hb_args) # for debug only    subprocess.Popen(handbrake + hb_args)    return()無論我如何重新排列“,我都會收到兩個錯誤之一,要么手剎說找不到文件,要么找不到我的預(yù)設(shè)。這個確切的命令可以在命令行中完美運(yùn)行。這是具體的錯誤:Traceback (most recent call last):  File "SubProcessing.py", line 161, in <module>    finalvideo = convertvideo(sys.argv[2])  File "SubProcessing.py", line 82, in convertvideo    subprocess.Popen(handbrake + hb_args)  File "/usr/lib/python3.8/subprocess.py", line 854, in __init__    self._execute_child(args, executable, preexec_fn, close_fds,  File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child    raise child_exception_type(errno_num, err_msg, err_filename)FileNotFoundError: [Errno 2] No such file or directory: "/usr/bin/HandBrakeCLI -i /root/Alone-S02E01-Once_More_Unto_the_Breach_HDTV-720p.mkv -o /root/tmp/tempvideo.mkv --preset-import-file /mnt/media/PlexTestFiles/handbrake_presets.json -Z 'h.265_Hardware'"在此先感謝您的幫助。再說一次,我不是 python 編碼員,但我不認(rèn)為這會這么難。
查看完整描述

1 回答

?
Qyouu

TA貢獻(xiàn)1786條經(jīng)驗 獲得超11個贊

您需要subprocess.Popen使用數(shù)組中的參數(shù)進(jìn)行調(diào)用,而不是字符串。在您的情況下,相關(guān)部分將是:

subprocess.Popen([handbrake, "-i", input_file, "-o", handbraketempspace, "--preset-import-file", handbrake_json_file_location, "-Z", handbrake_profile_name])

或者,您可以指定shell=Trueto subprocess.Popen,但這會不必要地啟動 shell,因此最好不要使用它。


查看完整回答
反對 回復(fù) 2023-09-05
  • 1 回答
  • 0 關(guān)注
  • 171 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號