I know I can set the start with -ss and end with -to but can someone please help me to format the following so that I can enter the -ss and -to with a string?
I want -ss to come from
String start = editStart.getText().toString();
and -to to come from
String end = editEnd.getText().toString();
Here is my ffmpeg string I want to edit, I have entered -ss and -to to show where I want the above strings to be.
String s = "-i" + " " + mVideoUri.toString().replace("file:///", "") + " -filter_complex [1:v][0:v]scale2ref=iw:ih[ovr][base];[ovr]colorchannelmixer=aa=0.7[ovrl];[base][ovrl]overlay[v] -ss -to -map [v]" + directoryToStore + "/" + FileName + mp4;
String[] arguments = s.split(" ");
ExecuteFFMPEG(arguments);
Ok so you get your start and end point from:
String start = editStart.getText().toString();
String end = editEnd.getText().toString();
So instead of splitting the argument do this instead:
String[] s = {"-i" ,mVideoUri.toString(),"-filter_complex","[1:v][0:v]scale2ref=iw:ih[ovr][base];[ovr]colorchannelmixer=aa=0.7[ovrl];[base][ovrl]overlay[v]","-ss","start","-to","end","-map","[v]",directoryToStore+"/"+"output.mp4"};
ExecuteFFMPEG(s);
Related
I have a String S= "grep -iRl 2020062312213461801003087/var/seamless/spool/tdr/Reconciliation"
and i want to add space between last number and "/"
like i want my output to be grep -iRl 2020062312213461801003087 /var/seamless/spool/tdr/Reconciliation
Try this.
String S= "grep -iRl 2020062312213461801003087/var/seamless/spool/tdr/Reconciliation";
String replaced = S.replaceAll("(\\d)(/)", "$1 $2");
System.out.println(replaced);
result:
grep -iRl 2020062312213461801003087 /var/seamless/spool/tdr/Reconciliation
you can find index of first "/" by yourstring.indexOf("/"); . and insert char to string by yourString.insert(index of "/", " ");.
your code will be like that
`
int index = yourString.indexOf("/");
yourString.insert(index, " ");
String cmc = "D:\\fileFolder\\File Name-" + CurrentDate() + ".xlsx";
String autoitexec = "D:\\AutoITScripts\\AttachFile.exe" + cmc;
Runtime.getRuntime().exec(autoitexec);
Above code is my current code. I am passing autoIt script location and file location from string autoitexec. I am unable to run above code ..
String cmc = "D:\\fileFolder\\File Name-" + CurrentDate() + ".xlsx";
String autoitexec = "\"D:\\AutoITScripts\\AttachFile.exe\" \"" + cmc + "\"";
Runtime.getRuntime().exec(autoitexec);
Escape double quotes with a backslash. i.e. 2 double quotes inside a double quoted string is " \" \" ".
Spaces are required between the command and each of the arguments.
I'm using Runtime.getRuntime.exec(String) to cut some songs with ffmpeg.
But when my song has a name with a blankspace it doesn't work ...
So before I cut the song, I want to replace every blank space of my songs by "\ ".
I did that :
String in = directory+songs.get(i);
String out = directory+"trimed_"+songs.get(i);
in.replaceAll(" "," \\ ");
out.replaceAll(" ", "\\ ");
String str = "ffmpeg -t 1 -i "+in+" -vcodec copy "+out;
Runtime.getRuntime().exec(str);
But it doesn't replace anything at all when I print str, am I missing something ?
Update : I tried every ideas given bellow and I didn't find a way to fix the problem. Hence, I replaced the blankspaces by "_" and it's working great.
Try
String in = directory+songs.get(i);
String out = directory+"trimed_"+songs.get(i);
/* in = in.replaceAll("\\s","\\\\ ");
out = out.replaceAll("\\s","\\\\ ");
*/
in = "\"" + in + "\"";
out = "\"" + out + "\"";
String str = "ffmpeg -t 1 -i " + in + " -vcodec copy " + out;
Runtime.getRuntime().exec(str);
System.out.println("Command executed " + str);
Note: I tested this code myself its working fine.
If it still not working then execute the command manually by copying the str from log and trace the error
I have a string with multiple combinations like below.
msqlora -sn $(PWF_pdmm8107)
msqlora -n $(PWF_pdmm8107)
msqlora $(PWF_pdmm8107)
the string is single. but at runtime, it may be formed any one of the above situation.
I want to retrieve $(PWF_pdmm8107) token from a string.
What I have done till now.
while ( st.hasMoreTokens() )
{
if ( st.nextToken().equals( "-sn" ) )
{
pwf = st.nextToken();
}
}
please suggest a way so I can retrieve $(PWF_pdmm8107) from above string combination.
Thanks
One way you could do this is to split() the string into an array using a space as a delimiter, and select the last element
String input = "msqlora -sn $(PWF_pdmm8107)";
String[] tmp = input.split(" ");
String output = tmp[tmp.length - 1];
Consider the answer if regex is allowed..
"(\\$\\(.*\\))"
String str = "msqlora -sn $(PWF_pdmm8107)\n" +
" msqlora -n $(PWF_pdmm8107)\n" +
" msqlora $(PWF_pdmm8107)";
Pattern compile = Pattern.compile("(\\$\\(.*\\))");
Matcher match = compile.matcher(str);
while( match.find())
{
System.out.println(match.group());
}
Output:-
$(PWF_pdmm8107)
$(PWF_pdmm8107)
$(PWF_pdmm8107)
Modifying xml using Java cli. Values in the xml were blank and we pass them from the java code. The file is on a Linux system.The method i am using is this
public String modifySufPlaylist(Cli cli, String file, String[] parms)
throws RemoteCliException {
String parmlist = "";
for (String s : parms) {
parmlist += " \"" + s + "\"";
}
String cmd = "for i in " + parmlist + "; do echo -e \"/<value><\\/value>/\\ns/></>$i</\\nw\\nq\\n\" | ed "
+ file + "; done >/dev/null 2>&1";
return cli.send(cmd);
}
It works fine when My xml has
<value></value>
Now a few things were changed and the xml looks like this
<value>Enter Param 1</value>
<value>Enter IP</value>
<value>Enter password</value>
i am stuck on how to modify my script so that is replaces the default value with paramlist values.
Y dont you use xsh:
for my $file in { glob "*.xml" } {
open $file ;
for //SomeTag set #another 'new value' ;
save :b ;
}