
Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net
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 and configure the Time interface to your liking:
- Windows/Linux: "View > Time v3.x (intf)";
- Mac OS: "Vlc > Extensions > Time v3.x (intf)".
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
Lua 5.1! like in VLC-32bit for Windows (later I will fix it for Lua 5.2/5.3)
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
v3.2 (intf) (27.8.2018) 2 years ago
- option to disable milliseconds in elapsed time
- option to show system/ending time in "h:m" format
v3.2 (intf) (27.8.2018) 2 years ago
- option to disable milliseconds in elapsed time
- option to show system/ending time in "h:m" format
v3.1 (intf) (19.8.2018) 2 years 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 2 years ago
- fixed time in microseconds for VLC 3;
v2.1 (intf) (5.9.2016) 58019 4 years ago
- fixed several bugs in Interface script;
old (before changes on this portal in September 2016) 2 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;
ignorer
7 years ago
Report
mederi
7 years ago
Report
mfakih
7 years ago
This is very useful when someone is taking excerpts from a long video file. The excepts will have their time (relative to the original file) within them. VLC does not put the recording time in the filename of the result file, only the system time.
Report
mederi
7 years ago
Report
ravemir
8 years ago
Are these values supposed to be as precise as possible, or are they estimations with varying precision?
Report
mederi
8 years ago
-- 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
vlcaddon
7 years ago
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
7 years ago
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
mederi
7 years ago
Report
ravemir
8 years ago
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
mederi
8 years ago
Report
blackfeet
4 years ago
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
mederi
4 years ago
Report
ravemir
8 years ago
Report
jayaprakash
8 years ago
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
mederi
8 years ago
Report
jayaprakash
8 years ago
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
mederi
8 years ago
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
8 years ago
I tried as you guided.
It is working very well.
Report
AlexisBV
8 years ago
(for example 00:01.83, or 55 frames, and so on)
Report
mederi
8 years ago
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
Nietha
7 years ago
Quote:local elapsedSecond = elapsed_time % 60
Report
wthopman
8 years ago
Report
mederi
8 years ago
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
mederi
8 years ago
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