Stitch or Concatenate

Questions and answers on how to get the most out of FFAStrans
crispyjones
Posts: 106
Joined: Wed Dec 27, 2017 3:21 am

Re: Stitch or Concatenate

Post by crispyjones »

@admin that explains it perfectly. Thank you.
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Stitch or Concatenate

Post by emcodem »

crispyjones wrote: Sat Sep 26, 2020 11:43 pm The most concise way I could state the requirement using my current two part workflow would be "If Step1 watch folder has growing files do not trigger step2." If this logic could be enforced then step 2 would "know" that step1 is ingesting one large clip and even though the resulting "concat.txt" file has not changed for some time, do not trigger.
Hey again,
as i was unfortunately not able to convey you my idea about a single workflow properly, i'll concentrate on solving exactly the problem you want to have solved.

Here is how you can check for the condition "if step 1 watchfolder has no growing files anymore".
Concat_step1_waitforcache.json
(10.14 KiB) Downloaded 455 times
How it works: so your condition is: if the step 1 has no growing files anymore. We have growing files in the watchfolder whenever there is a .json file lying in C:\FFAStrans\Processors\db\cache\wfs\__WF_GUID___\mons\__MON_GUID__\i
So this example workflow is step 1 checking if itself has any more growing files in it's monitor folder.
Note that on the final success path of this workflow, you'll have to start the second workflow somehow, e.g. use the included http communicate or move all files into another watchfolder for step to, or write some text file or such.


I am not 100% convinced that this solves your problem as there is no guarantee that a file is growing longer than a watchcycle and such. So using the above way, depending on how exactly the files are coming in to your folder, it might happen that step 2 ist started multiple times.

Sure i could provide more accurate solutions if i understood whats the actual original condition when you want to start your workflow (how exactly are the files being dropped into the watchfolder)? From what i understood by now, it might be one simple solution for you to use my ffconcat workflow from before, start it every 5 minutes using the webinterface scheduler and alter the workflow so as a first thing, have a files find processor check if there are files that's date created is younger than 5 minutes - use a conditional to check the file count and if file count is 0, go on processing. Or maybe i need to add a check for "date modified" in the files find processor for you to succeed?
emcodem, wrapping since 2009 you got the rhyme?
crispyjones
Posts: 106
Joined: Wed Dec 27, 2017 3:21 am

Re: Stitch or Concatenate

Post by crispyjones »

Thanks @emcodem, you're like me and can't let somethings go!! I've been too busy playing with new super cool VMAF analyzer you guys put in 1.1.0. I get easily distracted by shiny new things. I promise I'll try this workflow out soon.
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Stitch or Concatenate

Post by emcodem »

Hehe yeah i just cannot leave any question open ;-) Actually what really bothers me is that i was not able to get you on the same page as i was... hope you will give me more chances in the future :D
emcodem, wrapping since 2009 you got the rhyme?
jdb
Posts: 2
Joined: Fri Mar 10, 2023 11:24 pm

Re: Stitch or Concatenate

Post by jdb »

Hi,

First of all, I have been using ffratrans for a year now with great pleasure.

I'm working on a workflow where I have to add 10 sec black before and 10 sec black behind a file. By using the ffconcat version 1.0 function this is no problem.

The challenge is to change the timecode in the right way,

Below the input:

Code: Select all

ffconcat version 1.0

file black.mov
file program.mov
file black.mov
To add the right start timecode to the output file we have to use the start timecode of 'program.mov' adjusted with minus 10 seconds.

Example:
  • Start TC program.mov : 00:03:00:00

    Start TC after concat: 00:02:50:00
Any ideas to do this is a proper way?

Thank you in advance for your feedback.
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Stitch or Concatenate

Post by emcodem »

Hey jdb,
welcome to the forum and thank you for using FFAStrans :D

First, this would have been worth to open a separate topic. Also this is worth to have a separate entry on the wiki, calling @momocampo here.

For any tc calculations we need to consider the framerate. As ffastrans already knows the starttc and framerate, we also have an inbuilt variable that can be used as a base for calculations: %f_start_sec%, where the actual value of this variable would be like 0.04 (40ms) in case starttc is at 1 frame and 25fps is the framerate.
Also, we have a "function" for converting seconds to timecode: $inttotc.
I would create 2 user_variables: %f_calculated_start_sec%. and %s_calculated_smpte_tc% (the f_ and s_ means the variable is of type float and string).

In a populate processor, you set:
%f_calculated_start_sec% = %f_start_sec%+10
%s_calculated_smpte_tc% = $inttotc(%f_calculated_start_sec%,%f_frame_rate%)

And voila, you have your needed timecode in the variable %s_calculated_smpte_tc%
emcodem, wrapping since 2009 you got the rhyme?
jdb
Posts: 2
Joined: Fri Mar 10, 2023 11:24 pm

Re: Stitch or Concatenate

Post by jdb »

Hi Encodem,

Thank you for your fast reply, next time I will create a separate topic.

Your suggestion is working, but now I need to implement in the right way,

The file program.mov has as start TC of 00:01:55:00. When I add 10 seconds of black before and after the file program.mov with ffconcat, I have to change the start TC of the concatted file. The start TC will be the TC from the file program.mov minus 10 seconds.

Because I concat the file with black.mov as the first file, the start TC from this file is leading (00:00:00:00). Any idea to replace this with the start TC of the file program.mov?

Below the ffconcat job:

Code: Select all

ffconcat version 1.0

file black.mov
file program.mov
file black.mov
Thanks in advance!
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Stitch or Concatenate

Post by emcodem »

@jdb
So you work with concat file but you didnt tell me how you actually do the encoding. For setting tc, it doesnt really matter if you work with concat or a single file. There are multiple topics existing with examples about how to work with inbuilt encoders and cmd processor, tell me if you dont find what you need.
Inbuilt processors have a text field where you can set your calculated tc variable, when using custom ffmpeg or cmd processor, you just add this

Code: Select all

-timecode %s_calculated_smpte_tc%
somewhere before the output, e.g. cmd processor:

"%s_ffmpeg%" -safe 0 -i "%s_path_to_concat_file%" -c:v libx264 -c:a aac -ac2 -timecode %s_calculated_smpte_tc% "\\PATH\TO\OUTPUT.mov"
emcodem, wrapping since 2009 you got the rhyme?
Post Reply