Page 1 of 1

Timecode filter - set to source framerate after custom ffmpeg

Posted: Sat Feb 09, 2019 11:02 pm
by artmit
Hello all,

I discovered during tests, that if using custom ffmpeg script before A/V Media and then Timecode filter, it results in timecode burning with miliseconds instead of frames (on frames position).
Custom FFmpeg has such options, I use it without audio and video codecs:

Code: Select all

-vf drawtext="fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=36:fontcolor=white:shadowcolor=black:shadowx=5:shadowy=5:x=20:y=H-th-20:text='%s_some_variable%'"
I thought I could override this with forcing timecode filter to get source framerate, but unfortunately there is no option to set it via variable. I wondering if someone already had such case?

Best regards,
Artur

Re: Timecode filter - set to source framerate after custom ffmpeg

Posted: Sun Feb 10, 2019 9:25 pm
by emcodem
Hey Artur,
i can confirm the behaviour you describe, @steinar: i guess this is a bug or at least very strange behaviour:
After investigating the internal avs file that the timecode node creates, it turns out that ffastrans in the "bad" case with milliseconds, ffastrans puts this line into the internally generated avs:

Code: Select all

m_clip = ShowTime(m_clip, 0, x=360, y=1040, font="arial", size=120, text_color=$ffffff)
and in the other case, which works:

Code: Select all

m_clip = ShowSMPTE(m_clip, fps=29.97, offset="00:00:00:00", x=360, y=1040, font="arial", size=120, text_color=$ffffff)
Unfortunately as i don't have the source code of ffastrans, i am not able to look for or guess what exactly is causing this issue, therefore i am not able to propose a workaround.

What i don't really understand is why you would use 2 encodings instead of only one... i guess you have some encode node somewhere later anyway, why not adding the -vf you use in the custom ffmpeg node there? Are you aware that when "omitting" the video and audio codec, ffmpeg will fallback and default to some very crappy low-quality settings, e.g. mp3 audio and low-bitrate mpeg4 video codec. So maybe you want to re-work your workflow anyway so you don't even run into this problem ;-)

cheers,
emcodem

Re: Timecode filter - set to source framerate after custom ffmpeg

Posted: Sun Feb 10, 2019 9:58 pm
by admin
This is not a bug but rather a "feature" of AviSynth and a property of SMPTE timecode. It supports a limited variation of framerate. Consider this output from ffmpeg when feeding a "wrong" framerate:

[avisynth @ 0000013cb7333340] ShowSMPTE: rate argument must be 23.976, 29.97 or an integer

So if your framerate does not comply with these specs, FFAStrans will replace the hh:mm:ss:ff notation with hh:mm:ss:msec. This way you get someting rather than nothing or an error. However, I will add a note about this behavour in the docs.

-steinar

Re: Timecode filter - set to source framerate after custom ffmpeg

Posted: Sun Feb 10, 2019 10:15 pm
by emcodem
Hey steinar!
so you say using the custom ffmpeg node with above settings creates an unsupported framerate? Sure i also thought about the framerate bing the issue, but what causes the framerate to change?
I thought as my source video is 25fps and the custom ffmpeg does not specify the framerate, it should come out as 25fps?

cheers,
emcodem

Re: Timecode filter - set to source framerate after custom ffmpeg

Posted: Mon Feb 11, 2019 5:10 am
by admin
What custom ffmpeg node setting? All I see is a filter section, nothing about encoding. Is there a workflow xml attached that I'm overlooing? And yes, framerate can change if you use something like the inbuilt default custom encoder that creates an avi-file with mpeg4 codec. This is not a FFAStrans bug.

-steinar

Re: Timecode filter - set to source framerate after custom ffmpeg

Posted: Mon Feb 11, 2019 11:53 am
by emcodem
Hey Steinar,

there was no workflow XML you missed and i can confirm the Problem seems to be related to having an .avi container before the av/media and timecode nodes. No matter if you use the custom ffmpeg node, or e.g. DVCPRO processor (set to avi container) or if i set a framerate (-r 25) or not, whenever avi is in the game, the used avisynth timecode function is Showtime instead of the smpte one.

So the workaround for Artur would be just as easy as switching from avi to another container at his custom ffmepg node.

I used this workflow for deleting, it contains the dvcpro node.
debug_timecode_avi_problem.xml
(7.38 KiB) Downloaded 460 times
cheers,
emcodem

Re: Timecode filter - set to source framerate after custom ffmpeg

Posted: Tue Mar 12, 2019 10:22 pm
by artmit
emcodem wrote: Sun Feb 10, 2019 9:25 pm [...]
What i don't really understand is why you would use 2 encodings instead of only one... i guess you have some encode node somewhere later anyway, why not adding the -vf you use in the custom ffmpeg node there? Are you aware that when "omitting" the video and audio codec, ffmpeg will fallback and default to some very crappy low-quality settings, e.g. mp3 audio and low-bitrate mpeg4 video codec. So maybe you want to re-work your workflow anyway so you don't even run into this problem ;-)
[...]
Hello emcodem,
I've just returned to live:-) and noted that someone replied to my question :-) Did not received any notification about that, sorry that I did not responded earlier. Wow, thanks for this!
I simply did not know I can insert timecode using custom ffmpeg node also (I am just a beginner). I will search for options/syntax to do that correctly. Anyway, as I at the moment tested some workflows I can confirm that fallback quality is - as you said - very crappy :-)

Kind regards,
Artur