Freeze Last Frame Add Durtation

Questions and answers on how to get the most out of FFAStrans
Post Reply
graham728
Posts: 82
Joined: Sat Oct 13, 2018 10:54 pm

Freeze Last Frame Add Durtation

Post by graham728 »

Hi,

Is it possible to take the last frame of a video and freeze this to add 10 seconds of duration? Some media delivery services require a 5/10 second hold on the end of delivered shows/commercials.

To summarise:

Input 30 second clip (for example) then encode to 35 seconds with the last 5 seconds being a freeze frame of the last frame.

Thanks!
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Freeze Last Frame Add Durtation

Post by emcodem »

Sure, it is christmas time, anything is possible :-)
This actually took me a lot more time than expected, it should place the output file exactly where your input file resides, named *_concat.mp4.
You can configure encoding parameters in the last node.
It only works with source files where the duration in frames can be extracted by ffastrans, i dunno which they are but it worked for some mxf and mp4 for me.

Let me know if you have any questions.

Import this workflow xml and submit some source file using e.g. my webgui or add a watchfolder before the first component:
ExtendLastFrame.xml
(13.87 KiB) Downloaded 552 times
@steinar, if you read this:
i needed to subtract 1 from the variable %i_frames% (that is a misleading variable name by the way ;-)) but i did not find a predefined function for arithmetic, so i used a batch but i needed to write the batch output to a text file and read the result in order to fill a variable with my calculation. Maybe you want to add some processor similar to the DOS command but that allows to set a variable to the returned value of a user defined (autoit?) script, or parse STDOUT of a batch for a certain pattern?

cheers,
emcodem
emcodem, wrapping since 2009 you got the rhyme?
admin
Site Admin
Posts: 1687
Joined: Sat Feb 08, 2014 10:39 pm

Re: Freeze Last Frame Add Durtation

Post by admin »

Great work emcodem! Like you write, anything is possible ;-) But why is the %i_frames% variable misleading? Maybe it should be something like %i_tot_frames% or %i_vid_frames%, or do you have other suggestions? Arithmetics are performed in the "Populate variables" and "Conditional" nodes right in the input fields. So can you just do "%i_last_frame_num% = %i_frames%-1" in the populate variables node.

I can certainly look at the option for picking up the returned exit value for a executed command but I think parsing of STDOUT is covered by the ability to read files like you do and parse it using the functions in the two "Populate variables" and "Conditional" nodes.

-steinar
momocampo
Posts: 595
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: Freeze Last Frame Add Durtation

Post by momocampo »

My god...When I saw your work emcodem, I wonder if I came from the same planet :) I'm so far away from youuuuuuu....lol
Well done !

Benjamin
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Freeze Last Frame Add Durtation

Post by emcodem »

Thanks for the flowers, i just wanted to try what's needed to do this and thanks to steinar, we could save 2 nodes at least in this workflow!
admin wrote: Mon Dec 24, 2018 1:03 pm But why is the %i_frames% variable misleading?
@steinar: Sorry, the misleading comment was just a joke, i was referring to I-frames in a long GOP video ;-) Sure the var name for those woule be liek %i_i_iframes% hehe...). No worries, please don't change any variable name, i personally dont care what's their name as long as they are documented, it could even be GUID's or just Gods names (like %wotan%= the name of the ffastrans main controller). How i work with them is to just copy and paste them from the documentation.

AND: Got it, so you Eval the value of the Populate Variables "value fields", so i love this one most by now. I just tried "Shutdown(6)" and id worked. This is like finally being logged in as "root" - and it does not really open any security issue as it is by design! I guess no more request for a new node will ever come in from me.
momocampo wrote: Mon Dec 24, 2018 2:02 pm I'm so far away from you....
@Benjamin, no worries, i guess i am somewhat ahead of you because workflow integration of filebased broadcast workflows on a designer/developer (technical) level is job for 12 years now ;-) As you seem to like and use steinar's software a lot, please let me help you to learn more about it, just open forum threads here as you wish, you can ignore the sticky threads from steinar regarding "no ffmpeg and avisynth questions";-) Tell us more about your perspective!
emcodem, wrapping since 2009 you got the rhyme?
admin
Site Admin
Posts: 1687
Joined: Sat Feb 08, 2014 10:39 pm

Re: Freeze Last Frame Add Durtation

Post by admin »

@emcodem, yes I Eval, or Execute and you CAN do crazy stuff with it. On the other hand, you can also do crazy stuff in the "Command executor" node, so.... ;-)

-steinar
Post Reply