Setting snapshot options

Discuss your Lua playlist, album art and interface scripts.
bien02
New Cone
New Cone
Posts: 3
Joined: 17 Sep 2015 19:24

Setting snapshot options

Postby bien02 » 18 Sep 2015 07:11

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.

mederi
Big Cone-huna
Big Cone-huna
Posts: 1951
Joined: 15 Mar 2011 16:38
VLC version: 2.0.8
Operating System: Windows Vista/XP

Re: Setting snapshot options

Postby mederi » 20 Sep 2015 13:35

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

bien02
New Cone
New Cone
Posts: 3
Joined: 17 Sep 2015 19:24

Re: Setting snapshot options

Postby bien02 » 21 Sep 2015 08:28

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")

bien02
New Cone
New Cone
Posts: 3
Joined: 17 Sep 2015 19:24

Re: Setting snapshot options

Postby bien02 » 22 Sep 2015 05:42

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.

olgun
New Cone
New Cone
Posts: 5
Joined: 08 Apr 2016 16:25

Re: Setting snapshot options

Postby olgun » 12 Apr 2016 10:32

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

mederi
Big Cone-huna
Big Cone-huna
Posts: 1951
Joined: 15 Mar 2011 16:38
VLC version: 2.0.8
Operating System: Windows Vista/XP

Re: Setting snapshot options

Postby mederi » 15 Apr 2016 18:05

There are no functions. There are just values of options in "vlcrc" config file. This forum is about Lua scripts.


Return to “Scripting VLC in lua”

Who is online

Users browsing this forum: No registered users and 3 guests