Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > New and alternative a/v containers

Reply
 
Thread Tools Search this Thread Display Modes
Old 11th June 2019, 00:31   #1  |  Link
hubblec4
Matroska find' ich toll
 
Join Date: Apr 2008
Posts: 1,370
hSplit - small command-line tool that lets you split and join files

hSplit is a small command-line tool that lets you split and join files bit by bit very quickly.

This project is open source on GitHub.

Downloads


This tool should help to make test files faster / easier to generate which are needed by a developer.

hSplit can be used with the OS function "Open With" and for Windows works also well the "Send To" function.
Furthermore you can create a parameter template with the root parameter file called "params.txt". Set there all the parameter you like and omit the source file path. Now you can drop files onto hSplit.exe or use "Open with" or use a script to run hSplit with a source parameter only (maybe in a loop).

While hSplit is running you can send an Exit command to stop hSplit. hSplit runs very fast, so you have maybe no time to abort the process. Only for very large files like UHD material needs more time to split/join.

You can control the output interval of the progress numbers.
hSplit uses a totally independent worker thread which is never paused to synchronize the main thread. The progress numbers are generated in the main threads loop. To aviod to much output you can set a higher value for this parameter.


Code:
hSplit rev(init)
-----------------------------------------------------------------
Syntax
hSplit.exe [Param1 [Value1 [Param2 Value2 ... ...]]] "Source.file" ["..."]
-----------------------------------------------------------------
Parameter
-h > Show this Help

-S > Segments: split file into segments (default is split Chunks)
     an array of comma separated start and end bytes is used
     values for start and end can be an Integer or a Hex string
     to use hex values set a first char to "h" -> h0-1000,2abc-4def
     the end byte is NOT included in the target file
     if an end value is set to 0, it means end of file(last byte)
     a byte pair of 0-0 means copy the entire file and will be skipped
     the start byte must be smaller than the end byte

-s > Chunk size: value is an Integer and default means Megabyte (def=20)
     a first char can be set to define the value type
     b=Byte; k=Kilobyte g=Gigabyte

-c > Chunks count: How many chunks should be written
     if not set or set to 0 means infinity until the source file ends (def=0)

-t > Target folder: if not set or empty the source folder is used

-n > Target file name: if not set or empty the source filename is used

-P > Progress interval: Control how often the progress is send to the output
     value is a Byte from 0 to 255
     value 0 sends no progress numbers; 1=max 255=min (def=100)

-J > Join files: value is a path for a target file
     only the -P switch can be used additionally

".." > Source file: MUST be the last parameter! Path to source file

@".." > Path to a parameter file: MUST be the first parameter!
        The parameter file should be a simple text file
        You can use any name and extension for the file name
        Only source file parameters can be used additionally
-----------------------------------------------------------------
Parameter file
Each line is used as a parameter
If you don't set a source path in the parameter file,
the source path(s) is(are) read from the command-line.
You can use a root parameter file called "params.txt"
Exists this file in the root folder of hSplit, it will be used automatically.
If the "params.txt" is empty, it will be ignored.
-----------------------------------------------------------------
Command
You can send a command while hSplit is running.
Command will be executed after pressing the ENTER key

"e" > User Exit: stops hSplit
-----------------------------------------------------------------
Exit codes
hSplit sends at the end an exit code

0 - all OK
1 - no source file
2 - error while loading source file
3 - no target folder (not found or could not created)
4 - chunk size too big (bigger than the source file size)
5 - nothing to split (no data)
6 - nothing to join (no data)
7 - parameter file not found
8 - parameter file is empty (only if used with the cli parameter)
9 - wrong parameters
99 - internal Lazarus error
-1 - User Exit
-----------------------------------------------------------------
Examples
Split chunks:
hSplit.exe "Path\to\source.file"
split entire source file in 20mb chunks

hSplit.exe -s 100 "Path\to\source.file"
split entire source file in 100mb chunks

hSplit.exe -s g2 -c 10 "Path\to\source.file"
split 10 chunks with 2 gigabyte each

hSplit.exe -t "trg dir" -c 10 -n "trg name" "Path\to\source.file"
split 10 chunks with 20mb each to folder "tar dir" with name "trg name"
the file extension is used from the source file

Split segments:
hSplit.exe -S 0-1000,5000-6000,500-1500 "Path\to\source.file"
split three segments with 1000 bytes each

hSplit.exe -S h0-1000,5000-6000,500-1500 "Path\to\source.file"
split three segments with 4096 bytes each

Join files:
hSplit.exe -J "Path\to trg.file" -P 0 "Path\source.1" "Path\source.2"
join 2 files without progress numbers

Parameter file:
hSplit.exe @"Path\to MyParam.file"
all parameters are read from the parameter file

hSplit.exe @"Path\to MyParam.file" "Path\to\source.file"
the source parameter from command-line is used (no path in the parameter file)
(if you want to join files, you can specify more command-line parameters)

Last edited by hubblec4; 1st October 2020 at 00:19.
hubblec4 is offline   Reply With Quote
Old 11th June 2019, 02:17   #2  |  Link
mariush
Registered User
 
Join Date: Dec 2008
Posts: 589
placing the g before the number is a bit weird .. g2 in your command line... would make more sense to put K,M,G at the end of the number


Total Commander has this functionality built in... well, except the "multiple segments of different sizes" - btw maybe you should add a warning if there's data in the file that's not in the output due to the way segments are specified


File > Split File ... or File > Combine File ...

7zip (compression software) can also create such files, you just need to select "No compression" and specify volume size to whatever size you want.

can also be used in command line mode...

Has a downside... basically with just plain split file you can take segment 1 and 2, append 2 to the first segment and then delete segment 2... but you can't do this with 7zip archives even if there's no compression.
But for small files where you can download all segments and use Extract to recreate the original file, it's not an issue.


Last edited by mariush; 11th June 2019 at 02:21.
mariush is offline   Reply With Quote
Old 11th June 2019, 08:27   #3  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
Am I correct to assume that this is a binary splitter like DGSplit?

Well, it looks very powerful, but also way more complex than I would like. I will stick with DGSplit...

Keep in mind that binary splitters can only cut multimedia files correctly if the file format does not use global headers. Have a look here:
https://forum.doom9.org/showthread.p...87#post1722687


Cheers
manolito
manolito is offline   Reply With Quote
Old 11th June 2019, 11:43   #4  |  Link
hubblec4
Matroska find' ich toll
 
Join Date: Apr 2008
Posts: 1,370
Quote:
Originally Posted by mariush View Post
placing the g before the number is a bit weird .. g2 in your command line... would make more sense to put K,M,G at the end of the number
OK, that could be change/expand so that the last char is relevant.

Quote:
Originally Posted by mariush View Post
Total Commander has this functionality built in... well, except the "multiple segments of different sizes" - btw maybe you should add a warning if there's data in the file that's not in the output due to the way segments are specified


File > Split File ... or File > Combine File ...

7zip (compression software) can also create such files, you just need to select "No compression" and specify volume size to whatever size you want.

can also be used in command line mode...
hSplit is a middle step for an other tool. I want learn programming a cli tool because my first cli tool (chapterEditorCLI) is not so good.
I have used DGSplit as template.
hubblec4 is offline   Reply With Quote
Old 5th July 2019, 17:59   #5  |  Link
hubblec4
Matroska find' ich toll
 
Join Date: Apr 2008
Posts: 1,370
A small update to rev0.01

Downloads

Code:
changelog hSplit

added    &
fixed    *
improved #
changed  %

rev0.01
* small issue for joining if a source file is not present

# size type can now be also the last char (1b or 2k or 3g)
  - only one type is allowed: first or last position
hubblec4 is offline   Reply With Quote
Old 1st October 2020, 00:21   #6  |  Link
hubblec4
Matroska find' ich toll
 
Join Date: Apr 2008
Posts: 1,370
Code:
change hSplit

added &
fixed *
improved #
changed %

rev0.02 - 01.10.2020
* hSplit not working if the root parameter file (params.txt) is not present
  and no parameter file was set in the commandline
download

Last edited by hubblec4; 1st October 2020 at 12:06.
hubblec4 is offline   Reply With Quote
Old 1st October 2020, 01:57   #7  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
Does it support arbitrarily large files? E.g., 50GB source files?
videoh is offline   Reply With Quote
Old 1st October 2020, 12:04   #8  |  Link
hubblec4
Matroska find' ich toll
 
Join Date: Apr 2008
Posts: 1,370
Yes, there is no limitation.
hubblec4 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 +1. The time now is 12:29.


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