Page 1 of 1

Execute a bat file

Posted: Fri Feb 16, 2018 11:31 am
by momocampo
Hello,
I have some problem to execute a bat file. My idea is simple, I wait for 3 files with specific name (I used monitor then hold for files). When the 3 files are here, I used an command executer to start de bat but no way( this bat concatenate the 2 files in 1).
In my folder I have ffmpeg.exe, 2 video files and my bat file.
This bat works in dos command line. My FFastrans command executor is :
%%comspec% /c "C:\Users\ctvf2encode1\Desktop\popo\concat2.bat"

My bat file is like this :

(for %%i in (*.mov) do echo@ file '%%i' ) > list.txt
ffmpeg -f concat -safe 0 -i list.txt -c copy output.mov
del list.txt

I have also tried :
(for %%i in (*.mov) do echo@ file '%%i' ) > C:\Users\ctvf2encode1\Desktop\popo\list.txt
C:\Users\ctvf2encode1\Desktop\popo\ffmpeg -f concat -safe 0 -i list.txt -c copy output.mov
del list.txt

In this last method, I found the list.txt in the popo folder but it is empty. Maybe a problem of relative path ?

If someone can help me it will be really kind.
Thank you ;)

Cheers.

Edit : (I think my list.txt is generated from "c:\windows\sysWOW64" that's why my list is empty). I must find how generate a list from another path.

Re: Execute a bat file

Posted: Tue Feb 20, 2018 4:43 pm
by momocampo
Hello I'm back,

Well I succeed.
First I had to check my command in command executor node. It works with 2 quotes before and 2 behind like this :
%comspec% /c ""C:\Users\ctvf2encode1\Desktop\popo\concat2.bat""

Second, my bat file works now, here it is :

cd C:\Users\ctvf2encode1\Desktop\popo\
(for %%i in (*.mov) do echo@ file '%%i' ) > C:\Users\ctvf2encode1\Desktop\popo\list.txt
C:\Users\ctvf2encode1\Desktop\popo\ffmpeg -f concat -safe 0 -i list.txt -c copy output.mov
del list.txt

The list is created with all mov files in folder and ffmpeg concatenate the files in output.mov.

Now, I have to found how give the name of first move file to the output.mov (output.mov is too generic).
Cheers.

Re: Execute a bat file

Posted: Tue Feb 20, 2018 7:53 pm
by admin
You should use command line parameters to alter the batch script behavour.
https://stackoverflow.com/questions/265 ... batch-file

That way you can pass FFAStrans variables to the script like this:
%comspec% /c ""C:\Users\ctvf2encode1\Desktop\popo\concat2.bat" "%s_original_name%""

cd C:\Users\ctvf2encode1\Desktop\popo
(for %%i in (*.mov) do echo@ file '%%i' ) > C:\Users\ctvf2encode1\Desktop\popo\list.txt
C:\Users\ctvf2encode1\Desktop\popo\ffmpeg -f concat -safe 0 -i list.txt -c copy %1.mov
del list.txt


You could also create the entire batch script dynamically by using the "Generate text file"-node.

-steinar

Re: Execute a bat file

Posted: Thu Feb 22, 2018 6:42 pm
by momocampo
Hi Steinar,

Well thanks for the advice but it seems too complicated for me...(the code in your link).

I tried your proposition for the variable but it doesn't work. I obtain a file without name.
Anyway, I think this kind of process is too difficult to succeed for me...I must better learn the batch processes :)

Re: Execute a bat file

Posted: Thu Feb 22, 2018 7:34 pm
by admin
Yes, well, I FFAStrans kind of inspires advanced usage so the kind of tasks you want to perform demands some scripting knowledge. Good luck!

-steinar