Time v3.2 Original

VLC Extensions

Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on git.opendesktop.org

5
Score 67%
Description:

Time is VLC Extension that displays running time on the screen in a playing video.
(Extension script "time_ext.lua" + Interface script "time_intf.lua")
Features:
- supported tags: [E], [Efps], [D], [R], [T], [O], [P], [n], [_];
- 9 possible positions on the screen;
- elapsed time with milliseconds;
- playback speed rate taken into account for duration time;

Time v3.1+ (intf)
Simple instructions:
1) "time_ext.lua" > Copy the VLC Extension Lua script file into \lua\extensions\ folder;
2) "time_intf.lua" > Copy the VLC Interface Lua script file into \lua\intf\ folder;
3) Start the Extension in VLC menu "View > Time v3.x (intf)" on Windows/Linux or "Vlc > Extensions > Time v3.x (intf)" on Mac and configure the Time interface to your liking.

Alternative activation of the Interface script:
* The Interface script can be activated from the CLI (batch script or desktop shortcut icon):
vlc.exe --extraintf=luaintf --lua-intf=time_intf
* VLC preferences for automatic activation of the Interface script:
Tools > Preferences > Show settings=All > Interface >
> Main interfaces: Extra interface modules [luaintf]
> Main interfaces > Lua: Lua interface [time_intf]

INSTALLATION location \lua\extensions\ for an Extension script (Create directory if it does not exist! Then Interface script in \lua\intf\):
* Windows (all users): %ProgramFiles%\VideoLAN\VLC\lua\extensions\
* Windows (current user): %APPDATA%\VLC\lua\extensions\
* Linux (all users): /usr/lib/vlc/lua/extensions/
* Linux (current user): ~/.local/share/vlc/lua/extensions/
* Mac OS X (all users): /Applications/VLC.app/Contents/MacOS/share/lua/extensions/
* Mac OS X (current user): /Users/%your_name%/Library/Application Support/org.videolan.vlc/lua/extensions/

Forum: https://forum.videolan.org/viewtopic.php?f=29&t=97639

Last changelog:

v3.2 (intf) (27.8.2018) 3 months ago

- option to disable milliseconds in elapsed time
- option to show system/ending time in "h:m" format

C

mederi

5 years ago

The time is actual playback time returned by VLC. If you pause playing video, then you will see stabile actual time position including milliseconds. Even if it is paused, the value is still being refreshed on the screen. For better stability I programmed the sctipt to perform update of time on the screen approximately 2 times per second. You can try to disable it completely for frequent update of time:Quote:function input_events_handler(var, old, new, data)
-- tt=os.clock()
-- if tt>=(t+.5) then -- OSD update approximately 2 times per second instead of 4-5 times
-- t=tt

...

-- end
end

Report

ravemir

5 years ago

Well, I tried your fix but, as you said, it only speeds up the updates, it doesn't show many differences in the update procedure:
If, for example, I click on the skip bar on a position, with the the video paused, it shows a given time for a fraction of a second, and then skips forward to a different time.

I have, however, found out something interesting: if I skip the video to exactly the same spot, the frames present the same timestamp every time, but if I skip even a pixel to the left/right of that spot, the timestamp of the frame changes.

Could this be a problem calculating the time from the frame numbers? Could the frame numbers themselves be computed wrong when I skip the video (and hence, influence the ms values)?

Report

C

mederi

5 years ago

VLC is time-based player. Every change in position iniciates some internal decoding procedures causing various events. The extension just reads actual available value of elapsed time several times per second, so VLC is not automatically sending any change of time value to extension. If the played media is of constant bitrate, then it si possible to convert time to frames (seconds * fps = frames). Then there is also some rounding of a result (math.floor()). If it is not accurate enough, then I am sorry but I cannot do much about it.

Report

ravemir

5 years ago

Well, I managed a workaround for this, by using AviDemux, and works perfect. Anyone looking for this feature be sure to check it out.

Report

blackfeet

2 years ago

Hi mederi,
I'm using the Time addon following instructions to downgrade my version, and I'm happy to be using it. But I have also noticed that the milliseconds change in strange ways. For example, if I am paused and I change the playback speed from 0.33x to 0.50x. Also, the time displayed does not always land on the same milliseconds each time I pause on the same frame. It's usually close each time, but it does make me wonder how it is being calculated. I wonder, as you suggest, can the frame rate be used to calculate the decimals displayed, such as 30 frames/sec displays hh:mm:ss.000, .033, .067, .100, .133, and so on? If these times were assigned to frames and did not change it would remove some ambiguity in the time.
I really don't need accuracy to the millisecond, but CONSISTENCY to the hundredth of a second would give me confidence to know exactly which frame I'm on. I'm no coder, so I don't know how feasible it is what I'm asking for.

Report

C

mederi

2 years ago

I am not VLC developer. The Extension just works with time values provided by VLC.

Report

vlcaddon

5 years ago

You should not use os.clock() as the clock() gives the CPU time, which is how much time the thread consumed. This time is a random time depends on how much the program use the CPU. That's why the update jump up and down randomly. And elapse more than a few seconds.

You should use os.time() here with ">".

tt = os.time()
if tt > t then
....

unfortunately, lua has no built in function to retreived time more acturate than 1 sec.

Also the vlc.osd.message should have a durantion value bigger than 1.5 seconds to keep the OSD shows up all the time:

vlc.osd.message(osd_output, channel1, osd_position, 1500000)

Report

vlcaddon

5 years ago

Since vlc itself provide some more precise time value, we can use it here like:

Quote:
...
ttvlc = vlc.var.get(input, "time")
tt = os.time()
if tt > t || ttvlc >= tvlc + .5 then
tvlc = ttvlc
t = tt
...


That will give us some stable update.

[/quote]

Report

C

mederi

5 years ago

Or you can remove that timing part from the script :) It just reduces a refresh period a bit. The extension seems to work pretty well, so it is not necessary there at all. We cannot talk about precision here. You just see a running time on the screen and if you pause a playing video, then actual time appears.

Report

jayaprakash

5 years ago

May I know the setting to show the time only in seconds?
Because to create custom playlist it requires time only in seconds. If it could get the time in seconds, the process can be make little bit faster.

Report

C

mederi

5 years ago

Please read carefully my posts above here to add some extra lines of code in the script. Then [E1] tag will be elapsed time in seconds. To edit the script you can use simple text editor like Notepad in Windows, but I recommend you to use Notepad++ that you can find on Internet.

Report

jayaprakash

5 years ago

Good...
How can display the play time of video/music file on the screen in the format of Elapsed/Remaining/Total.
And have to adjust the display font and its size.
Is it possible?

Report

C

mederi

5 years ago

Please, press HELP button and read red and yellow parts.
Then just write some new time pattern "[E]/[R]/[D]" or just edit the predefined one. You can also edit the extension script to add some new predefined pattern in the drop-down list and/or to set your favourite pattern as the default one.
To change the look of time, change subtitle settings in VLC preferences.
This extension shows time in a played video. Some future version of this extension can show time also for music files in the dialog box as a video is not available.

Report

jayaprakash

5 years ago

Thank you very much!
I tried as you guided.
It is working very well.

Report

AlexisBV

6 years ago

This currently does not seem to display more info than the stock VLC GUI already displays.. in order to be more useful, the user should be able to select fractional time display, or frames.

(for example 00:01.83, or 55 frames, and so on)

Report

C

mederi

6 years ago

Thank you for your ideas. I would like to publish your instructions how to alter the script to see elapsed time with miliseconds:
Quote:- remove the math.floor() from the elapsedSecond definition (line 91)
- change the elapsed_time string format to "%02d:%02d:%06.3f" (line 115)

Report

wthopman

6 years ago

For most jobs with video material, just the frame- number would be just as helpful.

Report

C

mederi

6 years ago

http://forum.videolan.org/viewtopic.php?f=29&t=103803
Meanwhile here is a patch for extended [E] tag for manual input of constant fps information to convert time to frames, e.g. [E23.976]. Tip: [E1] means time in seconds.
There is also a new tag [N] - new/next line.
- insert following line before line 115>local elapsed_time = string.format(... Quote:local et = elapsed_time- insert following lines right before line 125>return osd_output Quote:local osd_output = string.gsub(osd_output, "%[N%]", "\n")
local fps=tonumber(string.match(osd_output,"%[E(.-)%]"))
if fps~=nil then osd_output = string.gsub(osd_output, "%[E.-%]", math.floor(et * fps)) end

Report

Nietha

4 years ago

for people that are not programmers like me and need explicit instructions... change line 91 to

Quote:local elapsedSecond = elapsed_time % 60

Report

C

mederi

6 years ago

[PLD] tag added by Ashada:
http://forum.videolan.org/viewtopic.php?f=29&t=97639&start=20#p341783
Playlist handling often cause crash of VLC for example if you add fresh files into playlist while the extension is active. Total playlist duration would also need total elapsed time.

Report

polluted85

6 years ago

hi i am having trouble using this after creating the extensions folder in my Mac OS folder as directed and moving the .lua file in there

i go to > extensions > time

then a window pops out
what do i select?

i have a list of videos in the playlist. i want to find out total playlist time, to see what i have ahead of me to watch.

Report

polluted85

6 years ago

hi i am having trouble using this after creating the extensions folder in my Mac OS folder as directed and moving the .lua file in there

i go to > extensions > time

then a window pops out
what do i select?

i have a list of videos in the playlist. i want to find out total playlist time, to see what i have ahead of me to watch.

Report

v3.2 (intf) (27.8.2018) 3 months ago

- option to disable milliseconds in elapsed time
- option to show system/ending time in "h:m" format

v3.1 (intf) (19.8.2018) 3 months ago

- fixed numeric locale issue on Mac
- VLC version detection so the script works also in older VLC versions
- auto-format time (s > m:s > h:m:s > D/h:m:s)
- percentage playback position tag [P]
- always show "Settings" dialog box for disabled interface script
- respect other enabled VLC interfaces when saving settings
- "Settings" button in "Control panel" dialog box
- ">STOPPED<" status in title bar
- "looper_intf.lua" script file renamed to "time_intf.lua"

v3.0 (intf) (11.2.2018) 66127 10 months ago

- fixed time in microseconds for VLC 3;

v2.1 (intf) (5.9.2016) 58019 2 years ago

- fixed several bugs in Interface script;

old (before changes on this portal in September 2016) 6 years ago

v2.0 (intf) (28.4.2016) 53798
- resurrection attempt;
- Interface script "looper_intf.lua" + Extension script "time_ext.lua";
- new tags [Efps]-elapsed frames (et*fps), [n]-name, [_]-new/next line;
- elapsed time with milliseconds;
- playback speed rate taken into account for duration time;

v1.0 (19.3.2012)
- works in VLC 2.0.x;
- supported tags: [E]-elapsed time, [D]-duration, [R]-remaining time, [T]-system time, [O]-over/ending time;

File (click to download) Version Description Packagetype Architecture Downloads Date Filesize DL OCS-Install
Pling
Details
license
GPLv2 or later
version
updated Sep 01 2018
added Mar 19 2012
downloads today
0
page views today 369
System Tags addon gplv2-later