User Tools

Site Tools


variables:inbuilt_variables

This is an old revision of the document!


Variables

Variables are used to adapt and alter your workflow jobs to fit your output needs and incoming media. A variable is represented by a text string encapsulated with the percentage (%) character: %f_fps%, %username%, %s_original_name% etc… FFAStrans variables are always prefixed with a “s_” (string), “i_” (integer) or “f_” (float):

%s_v_codec% —> DNxHD120
%i_height% —> 1080
%f_fps% —> 29,97

FFAStrans has 3 kind of variables: Generic inbuilt variables, special inbuilt variables and user variables.

Generic Inbuilt Variables

These variables are automatically populated. If variable cannot be populated, they will mostly have an empty string or a zero (0), (e.g: height or width for an audio file, number of audio channels for a video file, mxf version for a quicktime file, etc). FFAStrans has 5 types of generic inbuilt variables :

  1. Media Variables
  2. File Variables
  3. Time Variables
  4. OS Variables
  5. FFAStrans Variable

Variables are generally populated on the fly when needed.

You can call all these generic inbuilt variables when you want and insert it by pressing the arrow-button next to a text field. All fields that has an arrow next to it supports variables.

1.Media Variables

Media properties are derived from the original input file. Different types of media can contain different kind of properties

Video | Audio Variables

Video Variables                                                                                             Audio Variables

%i_v_streams%Number of video streams (1).%i_a_streams%Number of audio streams (4).
%i_v_bitrate%Video bitrate of first video stream (50000).%i_a_bitrate%Audio bitrate of first audio stream (128).
%i_frames%Media length in frames (2600).%i_a_bit_depth%Bit depth of first audio stream (16).
%s_pixel_format%Pixel format of first video stream (yuv422p).%i_a_channels%Total number of audio channels (2).
%f_frame_rate%Frames per second (29.97).%i_a_sample_rate%Audio sample rate of first audio stream(48000).
%s_v_codec%Codec of first video stream (mpeg2video).%s_a_codec%Codec of first audio stream (pcm_s16le).
%s_v_profile%The profile of the first video stream.%s_a_profile%The profile of the first audio stream.
%i_v_first%Stream number of the first video stream.%i_a_first%Stream number of the first audio stream.
%s_pix_aspect%Pixel aspect of the first video stream (16:9).%i_tot_channels%The total number of audio channels.
%f_duration%Media length in seconds (137.48).%f_duration%Media length in seconds (137.48).
%i_interlace%Field domination(0=Progressive, 1=Upper, 2=Lower (1)).%s_a_layout%Return audio layout as array. First instance is number of channels in first audio stream, etc.
%s_date_created%Creation date of media (2015-15-11 21:16:33).%s_date_created%Creation date of media (2015-15-11 21:16:33).


Video Variables

%i_height%Media video height of first video stream (1080).
%i_width%Media video width of first video stream (1920).
%s_v_codec_long%Long codec name of first video stream (Windows Media Video 2).
%s_disp_aspect%Display aspect of the first video stream (1:1).
%s_color_space%Color space of the first video.
%s_color_trans%Color transfer of the first video.
%s_color_prim%Color primaries of the first video.
%s_color_range%Color range of the first video.
%i_intra%Checks if media is intra frame based. Return 1 if true, 0 otherwise.
%i_rotation%Find the rotation/orientation of the source media.
%s_duration_tc%Media duration as time code (00:05:10:12).
%s_date_created%Creation date of media (2015-15-11 21:16:33).
%f_start_sec%Start TC converted to seconds (2591.96).
%i_stc_hh%Start hour from TC.
%i_stc_mm%Start minute from TC.
%i_stc_ss%Start second from TC.
%i_stc_ff%Start frame from TC.
%s_start_tc%Start TC of Media (01:13:48:20).

Metadata Variables

%s_format%Format name of the container.
%s_mxf_version%Checks the mxf version used in the MXF source.
%s_mxf_op%Find the operational pattern used in the MXF source.
%s_format_long%Long format name of the container.
%s_master_display%Master display info if present on PQ/HDR10 video.
%s_info_ffprobe%Complete media info from ffprobe in JSON format.
%s_info_exiftool%Complete media info from exiftool in JSON format.
%s_info_mediainfo%Complete media info from mediainfo in JSON format.
%i_max_fall%Maximum program average frame light level in nits.
%i_max_cll%Maximum program light level in nits.

2.File Variables

File properties are derived from the original input file. ALL files has these properties so they will allways be populated with data.

%s_original_attrib%Attributes of the original file (RASH).
%s_original_ext%Original extension.
%s_original_name%Original filename without extension and path.
%s_original_path%Path of original file.
%s_original_folder%Path of original without drive or UNC.
%s_original_path~n%Folder name n-steps backwards.
%i_original_size%File size of original in bytes.
%s_original_date%Creation date of original file (YYYY-MM-DD_hh-mm-ss).
%i_original_year%Creation year of original file, e.g. 2020
%i_original_mon%Creation month of original file. [1-12]
%i_original_day%Creation day of original file. [1-31]
%i_original_hour%Creation hour of original file.
%i_original_min%Creation minute of original file.
%i_original_sec%Creation second of original file.
%s_original_drive%Drive or UNC server of the original file.
%s_recursed_path%Path of original without drive/UNC, monitored path and filename.
%i_source_size%File size of current source in bytes.
%s_pickup_file%Full path to the original file picked up by the monitors. 1'st level source. Full remote or local path of file picked up by def_runner based on individual monitor settings. Can be any binary or non-binary reference files like .lnk, .url, .xml, .json.'(*Note)
%s_original_full%Full path original file name as picket up by monitor or manually submitted. 2'nd level source. Full remote or local path to binary file discovered by monitor'(*Note)

*Note : The %s_pickup_file% is ALWAYS the file that's being picked up by monitors, hence its name. But, this might be just a link to another file. Consider the case of for example a "c:\shortcut.lnk" file. This file just point to another file, say "\\server\share\cool.mp4"

This gives us the following different contents of the two variables:
%s_pickup_file% = c:\shortcut.lnk
%s_original_full% = \\server\share\cool.mp4


3.OS Variables

These variables, also called system enviroments, are the ones that resides within the OS independent of FFAStrans. But all can be utilized within FFAStrans. F.ex. the variable %username% is a part of the OS variables. OS variables are in fact statics(see user variable/statics) that don't change from job to job, or workflow to workflow.

These variables are specific and depend of each system. You can find the list of all variables here : https://en.wikipedia.org/wiki/Environment_variable#Windows

We can find for example %APPDATA% –>C:\Users\Share\AppData\Roaming.
Or %windir% –> C:\Windows
Etc.


4.Time Variables

These are a selection of time variables read from the system time.

%i_year%Full year (2020).
%i_yr%Short year (20).
%i_mon%Month (01-12).
%s_mon%Abbrevated month name going Jan. to Dec.
%s_month%Month name going January to December.
%i_mday%Day of month (01-31).
%i_wday%Numeric day of week. Starting on Sunday (1) through Saturday (7).
%i_yday%Current day of year. Range is 001 to 366 (or 001 to 365 if not a leap year).
%i_hour%Hour (23).
%i_min%Minute (59).
%i_sec%Second (59).
%s_week_day%Weekday name going Sunday to Saturday.
%s_w_day%Abbrevated weekday name going Sun. to Sat.
%i_week%Week number of the year.
%i_msec%Millisecond (346).

5.FFAStrans Variables

These are variables generated by FFAStrans. F.ex. %s_wf_name% holds the name of the workflow on where the job runs.

%s_job_id%GUID identifier for the current job (20160219-202314-181-4693BFCC0A72).
%s_job_work%Work folder for the current job (D:\_ffas_workroot\2015052120481\20160219-202314-181-4693BFCC0A72).
%s_wf_id%Identifier for the current workflow (20150521204819).
%s_wf_name%Name of the current workflow (Untitled).
%s_node_name%Name of the current working processor node (XDCAM-HD).
%s_source%Full path to the file work file passed by FFAStrans processors. 4'th level source. Any file set as current input/output source for processors'
%s_root_work%Path to the global root work directory.
%s_ffastrans_dir%Path to the local FFAStrans.exe file.
%s_ffmpeg%Full path to the ffmpeg.exe file.
%s_ffmpegx64%Full path to the ffmpegx64.exe file.
%s_prev_node%Name of the previous processor node.
%s_error%Current error message/state.
%s_cache_record%Full path to the cache history record file created by the monitors.
%s_source_dir%Path to the files passed by some FFAStrans processors.

Special Variables

%s_source% is the most important variable in FFAStrans. It does represent the current “input file” for any processor.

Operations with %s_source%:

  • You can use a Populate Variables Processor to change %s_source% to another file if you need to
    • Typical example: the workflow starts with a .txt file instead of a media file, it calculates the path to the media file and then sets %s_source% to the calculated value
  • Whenever the value of s_source is changed, FFAStrans will execute the analysis (mediainfo/ffprobe/exiftool) internally and update all Media related variables
  • If you change %s_source% to a non-media file (or any other value), all the Media Variables will be empty/invalid
  • Setting %s_source% to “” (nothing) will cause the current branch/job to end and dissapear from the status monitor - the job is not just dispelled but deleted from history

%s_success% represents the “success message” in the Job Status Monitor upon Job completion. It can be altered using the “Populate variables”-node.
Workflow developers often use this method to investigate the current value of a variable.

Operations with %s_success%:

In this example, the objective is to ensure that the input file has a video stream to perform the H264 encoding. Otherwise a message in the status monitor and in Webinterface's jobs list will appear. In this particular workflow, each branch leads to a success(but “no video” node isn't one for the user). The trick is to turn that success into “error” for user. Don't forget to use “execute on success”(conditional “TRUE”) to continue to H264 node OR “execute on error”(conditional “FALSE”) to continue to another node.
You just have to finish your branch by populated the %s_success% variable to a message of your choice e.g: “error” or “failed” or for the example “No video in input file”.

%s_original_path~n% = Folder name n-steps backwards.


User Variables


Normal User Variable : User variables can be populated using the “Populate variables” node within a workflow, a number of other processors like the Loudness Analyzer and via API
Populate Variables help

Scope :

User Variable Values are valid only for the current Branch and it's Child-branches. User Variables cannot be passed directly from one Branch to another.

How to create and set :

  • Press the arrow-button next to a text field,variables window appears.
  • Select “user” category.
  • Right-click into variables window and choose “new”.

  • Set “variable: Creates a normal user variable.
    • Field 1: Enter your variable name, this will always be lower case and spaces are not allowed.
    • Field 2: Here you can just write a description for the variable and its usage.
    • Set “variable and as ”string: Sets the variable as a text string. This is default.
    • Set ”variable and as ”integer: Sets the variable as an integer: whole number. Use this type if you need ffastrans to “guarantee” the value is of type integer. E.g. Spaces are removed and if the original value is a float, it will be rounded down. If the value is too big to fit into 64bit Int, it will be the maximum number an Int can be on your System.
    • Set ”variable and as ”float: Sets the variable as floating point number. Same automatic internal value conversion as int above
  • Set ”static: This is a static that can not be populated dynamically in workflows.
    • Field 1: Enter your variable name, this will always be upper case and spaces are not allowed.
    • Field 2: this option will read “Content”. Here you set the content of the static.
    • Set “static and as ”string: Sets the variable as a text string.
    • Set ”static and as ”integer: Sets the variable as an integer: whole number.
    • Set ”static and as ”float: Sets the variable as floating point number.

Static User Variable : This is another kind of variable. Unlike other variables, static variables are always written with upper case.Creating statics are very handy for example representing a very long path in a short static.

Example 1:
%S_MS_OUTPUT% = D:\Media\Customer previews\Huge important company\720p\Windows Media Video\500k bitrate with watermark

Example 2 :

In this example we have several monitor folder nodes with the same input folder.Only accept files or deny files are different.
If a full path is entered, it will work but all paths will have to be changed if the input folder is changed.
Static variables are handy to avoid this.

  • Create a static variable like ”%S_INGEST_PATH%”
  • Enter the appropriate content (the full path of monitored folder)
  • Enter your new static variable instead of the full path into all your monitor nodes

If your input path change, just edit and modify the content of %S_INGEST_PATH% and all the paths will be changed at the same time.


                                                                                                          Back to top

variables/inbuilt_variables.1612955212.txt.gz · Last modified: 2021/02/10 11:06 by emcodem

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki