Talk:ShowFrameNumber

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(reply)
(size argument)
 
(5 intermediate revisions by 2 users not shown)
Line 20: Line 20:
 
::  else if (abs(_rate - rate) > 0.001) {
 
::  else if (abs(_rate - rate) > 0.001) {
 
::    env->ThrowError("ShowSMPTE: rate argument must be 23.976, 29.97 or an integer");
 
::    env->ThrowError("ShowSMPTE: rate argument must be 23.976, 29.97 or an integer");
:::*hi Admin; I ran the test with ''AssumeFPS'', not ''fps''=. I should have been more clear. -- [[User:Raffriff42|Raffriff42]] 19:06, 3 January 2016 (CET)
+
:::*hi Admin; I ran the test with ''AssumeFPS'' as above, not ''fps''=; I knew ''fps''= enforces correct input as you say -- [[User:Raffriff42|Raffriff42]] 19:06, 3 January 2016 (CET)
 +
::::Post your exact script please. If i use the script:
 +
::::clip = BlankClip()
 +
::::clip = clip.AssumeFPS(24.25)
 +
::::ShowSMPTE(clip, x=320, y=240, font="georgia", size=24, text_color=$ff0000)
 +
::::I get the error. [[User:Admin|Admin]] 19:29, 3 January 2016 (CET)
 +
<pre style="width:68em;margin-left:10em;padding:0.2em;border:none;">
 +
Colorbars
 +
AssumeFPS(24.25)
 +
ShowSMPTE
 +
return Last.Info
 +
</pre>
 +
:::::v2.60, no error, wrong time readout --[[User:Raffriff42|Raffriff42]] 20:31, 3 January 2016 (CET)
 +
::::::Mmm that's curious. When i use v2.60, i also don't get the error. However when I use the latest CVS (as i was doing, compiled with VC2010), i get the error. See http://www.wilbertdijkhof.com/avisynth.zip. I don't see any relevant code changes in ShowSMPTE though. I don't have VC6 anymore, so i can't run its debugger to see what's going on. Will ask Ian to look at it. [[User:Admin|Admin]] 21:33, 3 January 2016 (CET)
  
 
=====ShowSMPTE: fps argument=====
 
=====ShowSMPTE: fps argument=====
Line 28: Line 41:
 
:Inserted an "unclear" tag, like this: roses are blue<sup>[[(unclear)]]</sup> -- [[User:Raffriff42|Raffriff42]] 06:28, 1 January 2016 (CET)
 
:Inserted an "unclear" tag, like this: roses are blue<sup>[[(unclear)]]</sup> -- [[User:Raffriff42|Raffriff42]] 06:28, 1 January 2016 (CET)
 
::Good question. I will ask Ian. [[User:Admin|Admin]] 18:20, 3 January 2016 (CET)
 
::Good question. I will ask Ian. [[User:Admin|Admin]] 18:20, 3 January 2016 (CET)
 +
 +
== size argument ==
 +
I need to ask IanB, since i don't understand it. size should be a multiple of 0.125 (so it is indeed a float):
 +
 +
AVSValue __cdecl ShowFrameNumber::Create(AVSValue args, void*, IScriptEnvironment* env)
 +
{
 +
  ...
 +
  const int size = int(args[6].AsFloat(24)*8+0.5);
 +
 +
But i don't understand where this '*8' is coming from. If i look at the width/height i see (in text-overlay.cpp):
 +
 +
  struct {
 +
    BITMAPINFOHEADER bih;
 +
    ...
 +
  } b;
 +
 +
  b.bih.biWidth                  = width * 8 + 32;
 +
  b.bih.biHeight                  = height * 8 + 32;
 +
 +
[https://msdn.microsoft.com/en-us/library/windows/desktop/dd318229%28v=vs.85%29.aspx Here] they say that biWidth/biHeight specifies the width/height of the bitmap in pixels. It seems to me that width/height are already measured in pixels. Guess i'm missing something. [[User:Admin|Admin]] 14:14, 20 March 2016 (CET)
  
 
[[Category:Talk]]
 
[[Category:Talk]]

Latest revision as of 14:15, 20 March 2016

[edit] ShowSMPTE: integral or drop-frame framerates only

On reading text-overlay.cpp ShowSMPTE::ShowSMPTE, it looks like the framerate must be an integer (±0.001) or be in drop-frame range (eg, 23.975 - 23.977); framerates like 24.25 will be rounded to int(24.25+0.5)==24.0 and the time calculation will be off. This can't be right!

## (source 24fps)
ShowTime(y=50) ## top center
ShowSMPTE ## time is correct
AssumeFPS(24000, 1001)
ShowTime(y=50)
ShowSMPTE ## time is correct
AssumeFPS(24.25) ## any number not an integer ±0.001 or listed in drop-frame table
ShowTime(y=50)
ShowSMPTE ## time is wrong

Raffriff42 04:08, 29 December 2015 (CET)

Inserted a warning re: non-integral frame rates with ShowSMPTE -- Raffriff42 06:28, 1 January 2016 (CET)
If I understand it correctly, the timecodes will always be off for non-integral frame rates. That is, unless you treat them all as drop frames, and count how much frames should be dropped every minute (note: this will not be the SMPTE standard anymore). Perhaps better would have been to throw an error for non-integral framerates and not being one of those standard drop-frame ranges. Admin 17:52, 3 January 2016 (CET)
Edit2: Did you actually run that script (with source fps = 24.25)? AviSynth throws an error in my case. Relevant code:
rate = int(_rate + 0.5);
...
else if (abs(_rate - rate) > 0.001) {
env->ThrowError("ShowSMPTE: rate argument must be 23.976, 29.97 or an integer");
  • hi Admin; I ran the test with AssumeFPS as above, not fps=; I knew fps= enforces correct input as you say -- Raffriff42 19:06, 3 January 2016 (CET)
Post your exact script please. If i use the script:
clip = BlankClip()
clip = clip.AssumeFPS(24.25)
ShowSMPTE(clip, x=320, y=240, font="georgia", size=24, text_color=$ff0000)
I get the error. Admin 19:29, 3 January 2016 (CET)
Colorbars
AssumeFPS(24.25)
ShowSMPTE
return Last.Info
v2.60, no error, wrong time readout --Raffriff42 20:31, 3 January 2016 (CET)
Mmm that's curious. When i use v2.60, i also don't get the error. However when I use the latest CVS (as i was doing, compiled with VC2010), i get the error. See http://www.wilbertdijkhof.com/avisynth.zip. I don't see any relevant code changes in ShowSMPTE though. I don't have VC6 anymore, so i can't run its debugger to see what's going on. Will ask Ian to look at it. Admin 21:33, 3 January 2016 (CET)
[edit] ShowSMPTE: fps argument

I don't quite get the fps argument; is it to force a different framerate for timecode display purposes? For example, to show 24fps film frames on a 30fps video clip?
Raffriff42 04:17, 29 December 2015 (CET)

On testing, it seems the frame rate is overridden, throwing off the real time reading. Would not be useful in the above scenario.
Inserted an "unclear" tag, like this: roses are blue(unclear) -- Raffriff42 06:28, 1 January 2016 (CET)
Good question. I will ask Ian. Admin 18:20, 3 January 2016 (CET)

[edit] size argument

I need to ask IanB, since i don't understand it. size should be a multiple of 0.125 (so it is indeed a float):

AVSValue __cdecl ShowFrameNumber::Create(AVSValue args, void*, IScriptEnvironment* env) 
{
  ...
  const int size = int(args[6].AsFloat(24)*8+0.5);

But i don't understand where this '*8' is coming from. If i look at the width/height i see (in text-overlay.cpp):

 struct {
   BITMAPINFOHEADER bih;
   ...
 } b;

 b.bih.biWidth                   = width * 8 + 32;
 b.bih.biHeight                  = height * 8 + 32;

Here they say that biWidth/biHeight specifies the width/height of the bitmap in pixels. It seems to me that width/height are already measured in pixels. Guess i'm missing something. Admin 14:14, 20 March 2016 (CET)

Personal tools