Save output with filename from original video
Generate the output filename to match the original video
Using a simple function script, you can save the output file with a filename that matches the original video. An example flow is: you want AI-generated SRT captions for a video you uploaded to S3. You want the SRT saved back into AWS S3 and with the same filename as that of the original video.
Clone an example Flow and get the Function script too here.
To manually add the function script to your Flow:
First, go to Functions and "+ Add a Function":
Add this script into main window:
In Packages, add the following:
So it looks like this:
Add these Input parameters:
Add these Output parameters:
It should all look like this:
Now setup your Flow. Add the Function before the Transfer to Storage step.
In the Function setup, notice the red box where you need to choose the details correctly. "Folder" refers to the folder in AWS S3 you want to save the output file to.
In the Transfer to Storage step, choose the "fileName" output from the Function step as the input for the field "File Name," as highlighted in red below:
That's all! Turn on your Flow and output files will save to Storage with a filename that matches the original ingested media.