Skip to content

Commit f625e69

Browse files
committed
Renamed to video_mencoder
Renamed, so we can make video export scripts with other encoders
1 parent 96fed29 commit f625e69

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

contrib/video.lua renamed to contrib/video_mencoder.lua

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,18 @@ local function checkIfBinExists(bin)
4242
local result = handle:read()
4343
local ret
4444
handle:close()
45-
if (not result) then
45+
if (result) then
46+
--dt.print_error("true checkIfBinExists: "..bin)
47+
ret = true
48+
else
4649
dt.print_error(bin.." not found")
4750
ret = false
4851
end
49-
ret = true
52+
5053
return ret
5154
end
5255

53-
local function create_video(storage, image_table, extra_data)
56+
local function create_video_mencoder(storage, image_table, extra_data)
5457
if not checkIfBinExists("mencoder") then
5558
return
5659
end
@@ -61,16 +64,16 @@ local function create_video(storage, image_table, extra_data)
6164
return
6265
end
6366

64-
exportDirectory = dt.preferences.read("video","ExportDirectory","string")
67+
exportDirectory = dt.preferences.read("video_mencoder","ExportDirectory","string")
6568
exportFilename = "output.avi"
66-
framsePerSecond = dt.preferences.read("video","FramesPerSecond","integer")
69+
framsePerSecond = dt.preferences.read("video_mencoder","FramesPerSecond","integer")
6770

6871
dt.print_error("Will try to create video now")
6972
-- Set the codec
7073
local codec = ""
7174
local codecPreferences = ""
7275

73-
codecPreferences = dt.preferences.read("video","Codec","string")
76+
codecPreferences = dt.preferences.read("video_mencoder","Codec","string")
7477
if (codecPreferences == "H.264 encoding") then
7578
codec = 'x264'
7679
end
@@ -94,24 +97,24 @@ local function create_video(storage, image_table, extra_data)
9497

9598
dt.print("Video created in "..exportDirectory)
9699

97-
if ( dt.preferences.read("video","OpenVideo","bool") == true ) then
100+
if ( dt.preferences.read("video_mencoder","OpenVideo","bool") == true ) then
98101
-- USE coroutine.yield. It does not block the UI
99102
local playVideoCommand = "xdg-open "..exportDirectory.."/"..exportFilename
100103
coroutine.yield("RUN_COMMAND", playVideoCommand)
101104
end
102105
end
103106

104107
-- Preferences
105-
dt.preferences.register("video", "FramesPerSecond", "float", "Video exort: Frames per second", "Frames per Second in the Video export", 15, 1, 99, 0.1 )
106-
dt.preferences.register("video", "OpenVideo", "bool", "Video exort: Open video after export", "Opens the Video after the export with the standard video player", false )
108+
dt.preferences.register("video_mencoder", "FramesPerSecond", "float", "Video exort (MEncoder): Frames per second", "Frames per Second in the Video export", 15, 1, 99, 0.1 )
109+
dt.preferences.register("video_mencoder", "OpenVideo", "bool", "Video exort (MEncoder): Open video after export", "Opens the Video after the export with the standard video player", false )
107110

108111
local handle = io.popen("xdg-user-dir VIDEOS")
109112
local result = handle:read()
110113
handle:close()
111-
dt.preferences.register("video", "ExportDirectory", "directory", "Video exort: Video export directory","A directory that will be used to export a Video",result)
114+
dt.preferences.register("video_mencoder", "ExportDirectory", "directory", "Video exort (MEncoder): Video export directory","A directory that will be used to export a Video",result)
112115

113116
-- Get the MEncoder codec list with: mencoder -ovc help
114-
dt.preferences.register("video", "Codec", "enum", "Video exort: Codec","Video codec","H.264 encoding","H.264 encoding","XviD encoding")
117+
dt.preferences.register("video_mencoder", "Codec", "enum", "Video exort (MEncoder): Codec","Video codec","H.264 encoding","H.264 encoding","XviD encoding")
115118

116119
-- Register
117-
dt.register_storage("video", "Video Export", show_status, create_video)
120+
dt.register_storage("video_mencoder", "Video Export (MEncoder)", show_status, create_video)

0 commit comments

Comments
 (0)