Page 1 of 1

Setting snapshot options

Posted: 18 Sep 2015 07:11
by bien02
I’ve been working on a Lua script to take to snapshots at set times. I am using vlc 2.1.x and 2.2.1. I have been able to get a snapshot captured using:

-- Take a video snapshot
function snapshot()
local vout = vlc.object.vout()
if not vout then return end
vlc.var.set(vout,"video-snapshot",nil)
end

I found this code from : https://github.com/Tilka/vlc/blob/maste ... common.lua

However, I have not been able to figure out how to change the snapshot options (Directory, Prefix and Format) from the Lua script.Is there a way to change these values using Lua?

I've tried vlc.var.set(vout,"snapshot-format","png"), but that does not work.

Re: Setting snapshot options

Posted: 20 Sep 2015 13:35
by mederi
You can change settings before playback of a video, otherwise you need to restart the video (stop&play).

Code: Select all

vlc.config.set("snapshot-format", "png")
Defaults from "vlcrc" file:
# Video snapshot directory (or filename) (string)
#snapshot-path=

# Video snapshot file prefix (string)
#snapshot-prefix=vlcsnap-

# Video snapshot format (string)
#snapshot-format=png

# Display video snapshot preview (boolean)
#snapshot-preview=1

# Use sequential numbers instead of timestamps (boolean)
#snapshot-sequential=0

# Video snapshot width (integer)
#snapshot-width=-1

# Video snapshot height (integer)
#snapshot-height=-1

Re: Setting snapshot options

Posted: 21 Sep 2015 08:28
by bien02
Thank you very much mederi!
I couldn’t find the answer on my own, but you provided the info I needed. I am now able to change the video path with the script and I can save snapshots to the video folder using the following:

vlc.config.set("snapshot-path", VideoFilePath.."Snapshots")
os.execute("mkdir " .. "\"" .. VideoFilePath .. "\"" .. "Snapshots")

Re: Setting snapshot options

Posted: 22 Sep 2015 05:42
by bien02
My Snapshot script was taking a long time to complete its processing so I would get a dialog as follows:

Extension not responding! [x]
Extension 'extension' does not respond.
Do you want to kill it now?
[Yes]

I found that adding:

Code: Select all

vlc.keep_alive()
in the processing loop resets the watchdog timer to let vlc know that the script is still working and not frozen. I just thought I'll mention this in case anyone else was having issues with their scripts.

Re: Setting snapshot options

Posted: 12 Apr 2016 10:32
by olgun
i would like use VLC snapshot on the .net plugin.
snapshot is ok. but bellow functions not working.
Defaults from "vlcrc" file:
# Video snapshot directory (or filename) (string)
#snapshot-path=

# Video snapshot file prefix (string)
#snapshot-prefix=vlcsnap-

# Video snapshot format (string)
#snapshot-format=png

# Display video snapshot preview (boolean)
#snapshot-preview=1

# Use sequential numbers instead of timestamps (boolean)
#snapshot-sequential=0

# Video snapshot width (integer)
#snapshot-width=-1

# Video snapshot height (integer)
#snapshot-height=-1

Re: Setting snapshot options

Posted: 15 Apr 2016 18:05
by mederi
There are no functions. There are just values of options in "vlcrc" config file. This forum is about Lua scripts.