Increment a user integer variable

Questions and answers on how to get the most out of FFAStrans
Post Reply
SteUK
Posts: 11
Joined: Wed Jul 27, 2016 4:44 pm

Increment a user integer variable

Post by SteUK »

Hi,

Awesome tool! Credit and praise definitely deserved!

Can anyone point me in the right direction. I am trying to increment a user integer variable by 1 each time a video is decoded, but it is not doing what I desire.

From one input video, I then decode at 4 different bit-rates, placing each in a watched folder...that then performs other operations, before finally increment my variable. Then I conditionally check the variable to find when the last video has finished...before cleaning up intermediary conversion folders/files.

My increment looks like this: Set user variable: %i_number_videos_encoded% to %i_number_videos_encoded%+1

...and my workflow looks like this (not that you can see much, but you get the idea!)

Image

Thanks!
Ste
admin
Site Admin
Posts: 1680
Joined: Sat Feb 08, 2014 10:39 pm

Re: Increment a user integer variable

Post by admin »

Hi Ste, thank you for using FFAStrans and welcome to the forum! :-)

I'm afraid it's not very clear to me what you are trying to do. The screen shot was not very helpful either. But if I read you correctly, you're trying to use the variables across jobs and workflows? If so then that is not possible. If I have misunderstood you please let me know.

-steinar
SteUK
Posts: 11
Joined: Wed Jul 27, 2016 4:44 pm

Re: Increment a user integer variable

Post by SteUK »

Hi,

Think my lack of knowledge of terminology and how the tool works may have, and indeed might here, hinder my explanation.

Essentially, in the screen shot, you can see I fork into doing 4 encodes, then I jam them into a destination folder...and some time later, I want to increment a variable such that when all 4 videos reach a certain point in the chain...I know to delete the 'working/intermediate' folders and move the source video to storage.

I have implemented a work around where by I dreate dummy files to flag each encode as 'done'...then use a batch file to check for all the files and do the work I require.

Thanks!
Ste
admin
Site Admin
Posts: 1680
Joined: Sat Feb 08, 2014 10:39 pm

Re: Increment a user integer variable

Post by admin »

Once you fork a workflow you create separate instances of the job with thir own copy of the variable. F.ex.: You start with the variable %i_number_videos_encoded% = 1. If you fork it 4 times you will have:
Fork 1: %i_number_videos_encoded% = 1
Fork 2: %i_number_videos_encoded% = 1
Fork 3: %i_number_videos_encoded% = 1
Fork 4: %i_number_videos_encoded% = 1

If you increase %i_number_videos_encoded%+1 on all forks you will just have:
Fork 1: %i_number_videos_encoded% = 2
Fork 2: %i_number_videos_encoded% = 2
Fork 3: %i_number_videos_encoded% = 2
Fork 4: %i_number_videos_encoded% = 2

So you see, they are just duplicates. If you want unique numbers on all forks you must set the numbers explicit.

Fork 1: %i_number_videos_encoded% = 1
Fork 2: %i_number_videos_encoded% = 2
Fork 3: %i_number_videos_encoded% = 3
Fork 4: %i_number_videos_encoded% = 4

Was this somewhat clear?

-steinar
SteUK
Posts: 11
Joined: Wed Jul 27, 2016 4:44 pm

Re: Increment a user integer variable

Post by SteUK »

Perfectly, you nailed it here:

"Once you fork a workflow you create separate instances of the job with their own copy of the variable"

Is 'workflow-wide' variables on the road-map?
admin
Site Admin
Posts: 1680
Joined: Sat Feb 08, 2014 10:39 pm

Re: Increment a user integer variable

Post by admin »

Not with the current design. It would lead to conflict between instances trying to change the same variable. That makes the variable unpredictable, which is not what you want. So a %i_number_videos_encoded%+1 might not give you the correct result and it could eventually break your workflow.

-steinar
SteUK
Posts: 11
Joined: Wed Jul 27, 2016 4:44 pm

Re: Increment a user integer variable

Post by SteUK »

Fail enough. The system is flexible enough to work around it with batch files etc so all good :)
Post Reply