Funscript Compilation Maker

yeah thats what happend with me, I combined 2 different videos and got that weird lag.

All right, by some miracle, I finally solved the problem!

I tried that library, tried doing the ffmpeg python library, and nothing.
The trick was to just use mkvmerge itself by using subprocess, to do the clip splitting.
I knew for a while that it was the clips themselves that were messed up, the way ffmpeg creates them. They can’t even be reassembled using any tool - they always come out messed up.

Anyway, now, just install mkvmerge (I’m using Windows)
https://mkvtoolnix.download/downloads.html#windows

I basically just wrote a new version of the cut_video method that uses mkvmerge instead. I also changed the way the OS paths work a bit, and the new files will go to their original folder now.

The code:

I’m also banking on mkvmerge creating clips that are at least as long as the video length specified. If for some reason a 19 second clip is spat out when a 20 second clip is specified, it could mess up the funscript points here and there, but idk. Seems good so far.

1 Like

Hey yall! Do you think a non coder like me can use this thing with the help of chatgpt or something or will I be doomed? :smiley:
Also, can one feed in multiple videos or just one at a time?

This looks absolutely wild, great job no matter if I get it working or not! :slight_smile:

It was beyond me, if you figure it out let me know how you did it :slight_smile:

This could be better packaged for non-technical users.
https://pyinstaller.org/en/stable/index.html

I tried writing a nixpkg for this but there are strange cross dependencies from setuptools and python3.12 and later.

installing with the requirements file was not enough to make this work.
Should wrap this in an exe with pyinstaller.

3 Likes

I tried PyInstaller and cxfreeze but wasn’t able to pack it up :expressionless:
I’d have to play around on another environment and only install the packages that this uses, probably… no time to play with it right now.

If you’re at all linux savvy, nix is a great way to handle packages and isolated environments.

Still kinda finding a bug on the individual cuts that come out of this sometimes, but not with the merging I think, so might check it out this week or so.

All right, I ended up figuring it out.
I think this is it.

So, my new method is kinda jank but it’s working so far.
Mkvmerge adds in some extra milliseconds of time when it generates the video clips, so I made it actually generate the video clip first and give me the exact timestamp it pulled, then I send those timestamps into the function that creates the offset funscript.
image
Basiaclly grabbed it from the subprocess output with some regex.

Now, it’s actually frame perfect, and matching up perfectly with multiple clips.

New code:

2 Likes

will opening this up work with your instructions like before?

It will, but you also need mkvmerge now on your computer, as this will combine the videos:

Anyway, now, just install mkvmerge (I’m using Windows)
MKVToolNix Downloads – Matroska tools for Linux/Unix and Windows 3

1 Like

getting this error even after installing mkvmerge not sure what im missing

‘mkvmerge’ is not recognized as an internal or external command,
operable program or batch file.

My bad, I forgot you have to add it to your paths on Windows. I’ll try and write up an explanation on how to do it.

Go to Environmental Variables
image

Click on the one that says Path at the top and hit Edit

Hit New and add this one to the list:

C:\Program Files\MKVToolNix
^This should be wherever you installed MKVToolnix.

Then hit OK and and then OK for the outer window.
Restart your command prompt window, and you should be able to use the mkvmerge command now.

2 Likes

i give up lol. I keep now getting index is out of range errors

Make sure you’re setting the timestamps correctly, and make sure to open the .funscript file instead of the mp4 file. Make sure to hit Save before you process it.

Also I think only the 2nd and 3rd checkboxes work now.

Curious on how you got the error.

I tested out from what @Midevil was using, and I made some additional bugfixes.

1 - changed to ffmpeg from moviepy when combining non-same files - timing is more consistent when appending clips this way. Also encodes the video to the largest video size out of all the files.
2 - fixed some more timestamp handling with getting the perfect timings when making clips - accounted for clips that start at 00:00:00.000 or end at the length of the video.

2 Likes

Sorry for not keeping up with this as much as I’d like to but I’ve now edited the main post and github to reflect these changes.

1 Like

Tried out the program and it works really well! I would love a feature to enter multiple time frames for a single video/script and then combine them. I think a lot of users would appreciate this feature as you would be able to cut out sections you don’t like to save some disk space (especially for huge vr videos). Great work so far!

Edit: Basically like the app lossless-cut, but with the amazing script cutting functionality of this app.

1 Like

You can do that with this you just have to select the same script/video each time you browse.

I missed that, thanks a lot!