Command Executer output to variable etc.

Questions and answers on how to get the most out of FFAStrans
Post Reply
silverline
Posts: 15
Joined: Thu Jun 02, 2016 1:00 pm

Command Executer output to variable etc.

Post 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"...)
admin
Site Admin
Posts: 1659
Joined: Sat Feb 08, 2014 10:39 pm

Re: Command Executer output to variable etc.

Post 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
gilles.thoma
Posts: 1
Joined: Fri Jan 18, 2019 4:01 pm

Re: Command Executer output to variable etc.

Post 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
admin
Site Admin
Posts: 1659
Joined: Sat Feb 08, 2014 10:39 pm

Re: Command Executer output to variable etc.

Post 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
emcodem
Posts: 1645
Joined: Wed Sep 19, 2018 8:11 am

Re: Command Executer output to variable etc.

Post 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
Last edited by emcodem on Wed Jan 23, 2019 8:03 pm, edited 2 times in total.
emcodem, wrapping since 2009 you got the rhyme?
admin
Site Admin
Posts: 1659
Joined: Sat Feb 08, 2014 10:39 pm

Re: Command Executer output to variable etc.

Post 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
emcodem
Posts: 1645
Joined: Wed Sep 19, 2018 8:11 am

Re: Command Executer output to variable etc.

Post 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 :-)
emcodem, wrapping since 2009 you got the rhyme?
admin
Site Admin
Posts: 1659
Joined: Sat Feb 08, 2014 10:39 pm

Re: Command Executer output to variable etc.

Post by admin »

Hehe, and funny it was in a wierd kind of way...;-)
Post Reply