i'm trying to calculate the duration in microseconds (µs) the same way that virtualdub (information screen) calculates it but am having trouble getting the algo to properly show 33667µs.
29.970 fps = 33667µs
23.976 fps = 41708µs
25.000 fps = 40000µs
..
given dwScale=1001 (for video/interlace) and dwRate=30000 written to the avi header comes out wrong:
1001 * 30.000 = 33.3667
1000 * 29.970 = 33.3667
1001 * 29970 = 0.0334
1000 * 29970 = 0.0334
i know i can just hold the values in a list internally but i need it to calculate in case the framerate is different and wouldn't be in a list.
this is for a raw bmp2avi app i'm working on and want to show this value in the gui when the user sets the parameters up. thank you.
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 3 of 3
Thread
-
Last edited by vhelp; 22nd Mar 2013 at 22:57.
-
Why don't you just look at the VirtualDub source? And µs is microseconds (1/1000000), not milliseconds (1/1000). It looks to me like it's simply scale/rate * 1000000. I think "29.970 fps = 33667µs" is a typo on your part:
That was from a file with rate=30000, scale=1001. 1001 / 30000 * 1000000 = 33367 rounded to the nearest microsecond.Last edited by jagabo; 22nd Mar 2013 at 21:24.
-
[solved]
thank you for the tip, jagabo. i knew i would have to trial and error until i finally figured it out.
Code:procedure TForm1.cbxFrameRateChange(Sender: TObject); begin case cbxFrameRate.ItemIndex of 2: sb1.Panels[0].Text := inttostr(round( (100100/24000000)*10000000 ))+'µs'; //film, 41708µs 5: sb1.Panels[0].Text := inttostr(round( (100101/30000000)*10000000 ))+'µs'; //video, 33367µs end; end;
Similar Threads
-
encoded video duration different than vob duration
By fatcharlie in forum Video ConversionReplies: 9Last Post: 4th Dec 2011, 10:04 -
A Question On How To Calculate Frame Size When Resizing Vid for DVD
By hydrophonicaudio in forum Newbie / General discussionsReplies: 13Last Post: 21st Feb 2011, 07:53 -
How to calculate single frame duration
By 8day in forum Newbie / General discussionsReplies: 4Last Post: 5th Dec 2010, 10:49 -
Beta testers needed for my Frame Capture App
By several in forum MacReplies: 2Last Post: 9th Mar 2009, 14:53 -
Incorrect video duration/frame count in MKV/AVC
By crashbang in forum Video ConversionReplies: 2Last Post: 13th Oct 2008, 16:44