arrbee99 1561 Posted July 19, 2023 Share Posted July 19, 2023 Anyone out there know of a (free) video splitter that works. Ideally want it to work on mkv's (plus mp4's) and be able to divide up a long file into multiple segments in one go and save separately. So, load, move to a time, mark it, move to a different time, mark it, rinse, repeat and save the portions into separate mkv files. Thanks. Link to comment Share on other sites More sharing options...
Spaceboy 2500 Posted July 19, 2023 Share Posted July 19, 2023 mkvtoolnix - but its not a visual gui. you tell it at what time in mins and secs you want the split to be done Link to comment Share on other sites More sharing options...
arrbee99 1561 Posted July 19, 2023 Author Share Posted July 19, 2023 Thats a thought. Thanks Link to comment Share on other sites More sharing options...
Gilgamesh_48 946 Posted July 19, 2023 Share Posted July 19, 2023 I have never really tried to accomplish what you are trying but I think "FreeMake" has the ability to split videos and make two or more videos out of one. It is, or at least used to be, free for basic use. I find it easier to use for basic file conversions but, because of conversion speed, which is not very fast, I use HandBrake mostly. I also think there might be some way to make HandBrake do the same tasks. Lately I have not been doing much video editing due to health issues so my advice might be just a little out of date. Link to comment Share on other sites More sharing options...
arrbee99 1561 Posted July 20, 2023 Author Share Posted July 20, 2023 (edited) Thanks. I'll check it out, just having a go with Mkvtoolnix at the moment - go through the video in Avidemux to get (hopefully) exact timings, then copy timings into toolnix and let it create separate files... Edit - also don't want to use Handbrake (if its even possible) as trying to avoid any encoding, just chop it up but leave as is, if you see what I mean. Edited July 20, 2023 by arrbee99 1 Link to comment Share on other sites More sharing options...
Gilgamesh_48 946 Posted July 20, 2023 Share Posted July 20, 2023 30 minutes ago, arrbee99 said: Edit - also don't want to use Handbrake (if its even possible) as trying to avoid any encoding, just chop it up but leave as is, if you see what I mean. Freemake may also do some encoding. I seem to remember though that there are settings that simply copy the video in order to split it. I sometimes forget that others want and/or need to keep the resolutions high. But, as you age out of life, many people find that their ability to see details diminishes. The only video problem that really hurts my experience is the blockiness that sometimes get into low resolution encodes. Link to comment Share on other sites More sharing options...
arrbee99 1561 Posted July 20, 2023 Author Share Posted July 20, 2023 Well, the thing I like about Avidemux is its easy to not encode, you just make sure everything is set to Copy. And its free. So thats two things. The annoying thing about it is, copy or encode, it always looses subtitles. Do try too keep things decent quality wise, whether I succeed is another matter...I'm certainly less spring chicken, more (if you're familiar with) Fowler from the movie Chicken Run. Link to comment Share on other sites More sharing options...
rbjtech 4314 Posted July 20, 2023 Share Posted July 20, 2023 (edited) as @Spaceboysays above - for MKV then mkvtoolnix is your best bet - as it retains all parts of the MKV in the split - incl subs etc. You can also do multiple splits in a list. Avidemux is your friend for timings (as you have already identified ) - try and use key frames if you can (although I think mkvtoolnix may insert them - not 100% on that) For the MP4's - then personally I would just convert them to MKV's .. mkvmerge -o newfile.mkv oldfile.mp4 or use one of the many mkvmerge GUI's Edited July 20, 2023 by rbjtech 1 Link to comment Share on other sites More sharing options...
seanfletcher255 3 Posted July 22, 2023 Share Posted July 22, 2023 ffmpeg can do it i have written a wrapper code to split a video by a either a list of time codes or by a file with time codes and what you want to name each segment its tightly integrated into my movie ripping software but i could re-write a standalone if needed; also my code is for linux but some one could port it to windows or mac i suppose but thats beyond me Link to comment Share on other sites More sharing options...
seanfletcher255 3 Posted July 22, 2023 Share Posted July 22, 2023 its writen with php just because i wanted my ripping software to give me the option to write out a shell script before doing anything (usually automatically) but occasionally i want to check whats happening and tweak or come back later and do it again with out dong more work. <?php ## ## Generate a script to cut up a video file with ffmpeg using lossless copy no encoding or other stuff like that ## $argInput = realpath($argv[1]); $argTimes = $argv[2]; $segments = (is_file(realpath($argTimes))) ? explode("\n",file_get_contents(realpath($argTimes))) : explode(";",$argTimes); $i = 1; $Script = $RS_DIR_TEMP . '/rip_split_queue_split_' . ripws_global_randomStr() . '.sh'; file_put_contents($Script,'RS_DIR_PROCESSED="'.$RS_DIR_PROCESSED.'"' . "\n"); foreach ($segments as $segment) { if(!empty($segment)) { list($times,$OutputName) = explode("|",$segment,2); list($start,$stop) = explode("-",$times,2); $tmpStart = fletch_convert_time($start); $tmpStop = fletch_convert_time($stop); $span = $tmpStop-$tmpStart; //print_r($span); $pi = pathinfo($argInput); if (empty($OutputName)) { $argOutput = (empty($argv[3])) ? $RS_DIR_PROCESSED . '/' . $pi['filename'] . '_' . str_pad($i, 4, '0', STR_PAD_LEFT) . '.' . $pi['extension'] : $argv[3]; } else { $argOutput = $RS_DIR_PROCESSED . '/' . $OutputName . '.' . $pi['extension']; } $Command = ''; // initilize $Command .= '## Cut from ' . fletch_format_time($start) . ' to ' . fletch_format_time($stop) . ' out of "' . $argInput .'" and write to "'. $argOutput .'" ##' . "\n"; $Command .= 'mkdir -p "' . dirname($argOutput) . '" 2>/dev/null' . "\n"; // -c:a copy -map 0 $Command .= 'ffmpeg -i "' . $argInput . '" -ss ' . $start . ' -t ' . $span . ' -vcodec copy -acodec copy -c:a copy "' . $argOutput . '"' . "\n\n"; file_put_contents($Script,$Command,FILE_APPEND); $i++; } } echo $Script; ?> the fletch_convert_time() function takes human readable time codes like 1:02 or 1:37:45 and converts them into seconds for the ffmpeg command function fletch_convert_time($times_list, $suffix='', $Seperator=' ') { $times = explode($Seperator, $times_list); $rtTotalTime = ""; foreach ($times as $time) { //$time = str_replace(array(':','-','h','m','s'), ":", $time); @list($newTime,$MicroSecs) = explode(".",$time); $pieces = preg_split('#[-hms:]#', $newTime, -1, PREG_SPLIT_NO_EMPTY); //return print_r($pieces,true); $segments = count($pieces); switch($segments) { case "4"; $days = $pieces[0]; $hours = $pieces[1]; $minutes = $pieces[2]; $seconds = $pieces[3]; $total_time = ($days*86400)+($hours*3600)+($minutes*60)+($seconds); $rtTotalTime .= $total_time . $suffix; break; case "3"; $hours = $pieces[0]; $minutes = $pieces[1]; $seconds = $pieces[2]; $total_time = ($hours*3600)+($minutes*60)+($seconds); $rtTotalTime .= $total_time . $suffix; break; case "2"; $minutes = $pieces[0]; $seconds = $pieces[1]; $total_time = ($minutes*60)+($seconds); $rtTotalTime .= $total_time . $suffix; break; case "1"; $seconds = $pieces[0]; $total_time = $seconds; $rtTotalTime .= $total_time . $suffix; break; default; $rtTotalTime = "Invalid Format!"; break; } } return $rtTotalTime; } Link to comment Share on other sites More sharing options...
arrbee99 1561 Posted July 23, 2023 Author Share Posted July 23, 2023 Thats very nice stuff, but would have absolutely no idea how to Windowsize it. Link to comment Share on other sites More sharing options...
sanjaydevani 2 Posted August 21, 2023 Share Posted August 21, 2023 I've been using Movavi for some of my video editing tasks. For splitting videos, especially MKVs, it's the best and easiest to use. It's pretty intuitive, and the interface is simple even a 7-year-old kid will understand how to use it. Beyond splitting, I also often merge videos using it. The merging feature is straightforward, and the added value for me has been the automated transitions and the variety of styles it offers. It's just a neat bonus that makes my edits look more polished. You can read more about its features in this article on how to combine videos. Link to comment Share on other sites More sharing options...
seanfletcher255 3 Posted November 16, 2023 Share Posted November 16, 2023 @echo off setlocal enabledelayedexpansion rem Set input and times arguments set "argInput=%1" set "argTimes=%2" rem Set output directory set "RS_DIR_PROCESSED=C:\path\to\output\directory" rem Create a temporary batch script set "Script=%RS_DIR_PROCESSED%\rip_split_queue_split_%random%.bat" echo set "RS_DIR_PROCESSED=!RS_DIR_PROCESSED!" > "%Script%" rem Initialize counter set i=1 rem Iterate through segments for /f "tokens=1,* delims=|" %%a in ('type "%argTimes%"') do ( set "times=%%a" set "OutputName=%%b" rem Call the function to convert time call :fletch_convert_time times span rem Set default output name if not provided if not defined OutputName set "argOutput=!RS_DIR_PROCESSED!\!~ni!_!i!.!~xi!" if not "%3"=="" set "argOutput=%3" rem Create the FFmpeg command echo rem Cut from !start! to !stop! out of "!argInput!" and write to "!argOutput!" >> "%Script%" echo mkdir "!argOutput!" 2>nul >> "%Script%" echo ffmpeg -i "!argInput!" -ss !start! -t !span! -vcodec copy -acodec copy -c:a copy "!argOutput!" >> "%Script%" echo. >> "%Script%" rem Increment counter set /a i+=1 ) echo echo Video splitting completed successfully! >> "%Script%" echo pause >> "%Script%" rem Output the path to the temporary batch script echo %Script% goto :eof :fletch_convert_time rem Function to convert time set "times_list=%1" set "suffix=%2" set "Seperator=%3" rem Your existing PHP time conversion logic rem ... goto :eof Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now