簡體   English   中英

Runtime.getRuntime.exec() 問題

[英]Runtime.getRuntime.exec() problem

您好我正在嘗試執行 Runtime.getRuntime.exec("ffmpeg -i inputfile image2 imagefile");

我的代碼中的輸入文件是視頻文件,我正在通過 GUI 選擇視頻文件

我將它存儲在一個變量中。那么我如何使用變量名代替字符串?它確實

如果我替換變量,則不起作用。 任何幫助都是很大的應用程序

String inputfileVariable = ...; << maybe you calculate, maybe get from some GUI component
Runtime.getRuntime.exec("ffmpeg -i " +  inputfileVariable + " image2 imagefile");

這里沒有魔法,它只是一根繩子。

你需要這樣的命令數組:

// i guess that ffmpeg is a command name and the reset are arguments
Runtime.getRuntime().exec(new String[] {"ffmpeg","-i",inputfileVariable,"image2", "imagefile"});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM