Page 1 of 1

Command Executer output to variable etc.

Posted: Thu Dec 14, 2017 9:31 am
by silverline
Hi,

does anyone know if it is possible to make use of the output of a command execution as variable.

As background:
I noticed that ffmpeg sometimes renders the video shorter than the audio (in nvenc & x264) and I have no direct solution for this. The difference in duration is more than a second and leads to files being rejected by our partners. I now want to automatically compare audio & video duration, but ffastrans has only an output option for duration of the whole file not for separate streams.
I thought I could read out the separate duration with ffprobe and store them in variables to compare them.

Does anyone has an idea to this?

Best,
silverline

(I tried searching the forum for this, but the word "command" always leads to no search results, because it is "too common"...)

Re: Command Executer output to variable etc.

Posted: Fri Dec 15, 2017 7:56 pm
by admin
Hi silverline,

You need to use the "Command executor" for this. Please read the help section and the examples on how it works. So make sure you know how to get the output you want using ffprobe from a normal dos command. Then connect the "Populate variables"-node and the $read()-function to read the output to a variable. From there you can use other functions like $between() or the more advanced $regext() in order to get what you want. Now, this is not a trivial task and some basic programing or scripting knowledge is required.

-steinar

Re: Command Executer output to variable etc.

Posted: Mon Jan 21, 2019 8:44 am
by gilles.thoma
Hi,

I guess you mean by using the $read()-function that we first have to write the command output to a file and then read in that file and populate a variable?
Or is there any possibility to directly populate the variable?

Regards,
Gilles

Re: Command Executer output to variable etc.

Posted: Mon Jan 21, 2019 9:34 am
by admin
Hi Gilles, thank you for using FFAStrans and welcome to the forum! :-)

Yes, that is what I mean.
Currently you cannot output stdout/err directly to a FFAStrans variable. But it's a good idea to look at the options. Thanks for posing the idea :-)

-steinar

Re: Command Executer output to variable etc.

Posted: Wed Jan 23, 2019 3:28 pm
by emcodem
admin wrote: Mon Jan 21, 2019 9:34 am Currently you cannot output stdout/err directly to a FFAStrans variable.
Challenge accepted! :geek:

[EDIT] it is partly possible to do but only using hacky style techniques ;-)

Cheers,
emcodem

Re: Command Executer output to variable etc.

Posted: Wed Jan 23, 2019 7:32 pm
by admin
Just a word of warning: This is possible but not recomended. Misuse, crashes or any other abnormal behavour from executing autoit commands from within FFAStrans is your responsibility alone. Support with issues regarding this approach will not be given by me. Also, this method might not be available in the future.

-steinar

Re: Command Executer output to variable etc.

Posted: Wed Jan 23, 2019 8:01 pm
by emcodem
Hehe, damned, i tried to be funny ;-)
I should have added a note about it but i also really hope that anybody who is able to use this also understands what this means and will not use it in production :-)

Re: Command Executer output to variable etc.

Posted: Wed Jan 23, 2019 8:34 pm
by admin
Hehe, and funny it was in a wierd kind of way...;-)