Old 01-17-2019, 02:10 AM   #1
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 1,167
Smile My new VLC Auto split extension!

Hi,

finally I finished my very first programming experiment. And I'm pretty proud to present you Video split with mkvMerge, an VLC extension which allows you to easily split movies into clips with mkvToolnix. (Without re-encoding!)

This is also meant to be a good solution for video editing in Reaper as Reaper is actually not capable of splitting videos without re-encoding.

How does it work?

Firstly you need mkvToolnix. And of course VLC. The extension allows you to create timestamps on the fly while watching a movie or searching thru it. Its pretty straight forward. Your time ranges get copied into a list which will be sent formatted to mkvMerge for the splitting process.

Here it is in action:

First run routine demands the path to mkvMerge.exe which gets saved into mkvMergePath.txt next to the extension script.




Clicking the Create start/end point button adds new timestamps to the list. Those time ranges will be displayed as clips in the clip list.




Sending the timestamps to mkvMerge with one click. It saves all clips next to the source video.



I have no idea of how compatible this lua script is. I only tested it on win 7 64 bit and VLC v 3.04 which works flawlessly. But I'm pretty sure there are still many traps that I didn't think about. If someone wants to test it and runs into trouble I will try to fix that. Though I'm not experienced.

So please try it out. Put the lua file into the VLC directory/lua/extensions directory and start the extension in the menu -> view Split Video with mkvMerge


EDIT: New Version with clean button and better path handling.
Here is the file: Split_with_mkvMerge.lua

By the way. Theoretically this could be easily ported to apple and linux systems as only the paths and filenames should be renamed. Though I'm not sure but I think the system commands also needed to fit the system code. Would be cool if someone could port it to other systems or even optimizes the code a bit. (I know it looks silly at certain places. )
__________________
☆.。.:*・°☆.。.:*・°☆.。.:*・°☆REAPER//✿◔‿◔)°☆.。.:*・°☆.。.:*・°☆

Last edited by Eliseat; 01-19-2019 at 03:10 AM.
Eliseat is offline   Reply With Quote
Old 01-17-2019, 02:19 AM   #2
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 1,167
Default

I forgot the links to mkvToolnix and VLC:

https://mkvtoolnix.download/downloads.html#windows

https://www.videolan.org/vlc/download-windows.html

In my opinion, the only parts that needs to be changed for running on other systems like apple or linux would be the send functions.
Code:
function send_Clip()
    timeStamps = w2:get_text()
    input = vlc.object.input()
	if input
        then
            strCmd = 'echo | set /p dummyName='..timeStamps..'|clip'
            os.execute(strCmd)
	end
end

function send_Split()
    timeStamps = w2:get_text()
    input = vlc.object.input()


	if input
        then
    	    strCmd = mkvMerge_path..' --output "'..uri..'.mkv" "'..uri..'" --split parts:'..timeStamps
            os.execute(strCmd)
	end
end
The rest should be okay as "VLC directory" and "video source path" are VLC functions which should be equal on every system. And txt files (for saving the path) are common on every system as mkvToolnix is available for every system too.

Greetings
Eli
__________________
☆.。.:*・°☆.。.:*・°☆.。.:*・°☆REAPER//✿◔‿◔)°☆.。.:*・°☆.。.:*・°☆
Eliseat is offline   Reply With Quote
Old 01-17-2019, 06:34 AM   #3
akademie
Human being with feelings
 
Join Date: Mar 2007
Posts: 550
Default

Nice :-)

It would be great if we could send it from within Reaper timeline (check points).
What I mean is I use one big footage (may be 30-60minutes) and then on timeline I split it and make few or lots of usable scenes (every scene about few seconds or more long) for saving a "masterproject" it would be helpfull if the video items in timeline would be splitted without reencoding by using such script and even mkvToolnix etc. and then replaced in project as multiple video source files instead of the original source big video file.

akademie
akademie is offline   Reply With Quote
Old 01-17-2019, 08:23 AM   #4
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 1,167
Default

Quote:
Originally Posted by akademie View Post
Nice :-)

It would be great if we could send it from within Reaper timeline (check points).
What I mean is I use one big footage (may be 30-60minutes) and then on timeline I split it and make few or lots of usable scenes (every scene about few seconds or more long) for saving a "masterproject" it would be helpfull if the video items in timeline would be splitted without reencoding by using such script and even mkvToolnix etc. and then replaced in project as multiple video source files instead of the original source big video file.

akademie
Yes, that would be nice. And probably doable. There is only one draw back: mkvMerge is only capable to split at keyframes (from codec every n's frame). But Reaper lays videos frame by frame into the lanes which means, if you split at a certain point in Reaper, mkvMerge can't split exactly there. And Reaper probably doesn't know where the previous or next keyframes are.

The re-import of the split files wouldn't be possible without time shifts, length differences etc. And I have no idea of how to handle such things. Or if its even possible to do it from inside Reaper. This needs to be planned from a way more advanced Reaper scripter.
__________________
☆.。.:*・°☆.。.:*・°☆.。.:*・°☆REAPER//✿◔‿◔)°☆.。.:*・°☆.。.:*・°☆
Eliseat is offline   Reply With Quote
Old 01-17-2019, 10:14 AM   #5
akademie
Human being with feelings
 
Join Date: Mar 2007
Posts: 550
Default

Yeah, I do understand.
So the best would be if Reaper had "no re-encode" option in rendering ;-)
akademie is offline   Reply With Quote
Old 01-17-2019, 11:25 AM   #6
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 1,167
Default

Of course. Or Reaper could use mkvMerge in a native way to split videos. (Same way as it uses VLC and ffmpeg for preview) BUT! There is another problem according to mkvToolnix's splitting option. It allows timestamps only in chronological/sequential order. So if you make overlapping cuts you also get an error.

Anyway. VLC with mkvMErge and my extension is the best and most comfortable option at the moment.
__________________
☆.。.:*・°☆.。.:*・°☆.。.:*・°☆REAPER//✿◔‿◔)°☆.。.:*・°☆.。.:*・°☆
Eliseat is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 08:46 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.