animetosho / ParPar

High performance PAR2 create client for NodeJS
190 stars 19 forks source link

help needed with CLI command to generat par2create like files #20

Closed sanderjo closed 4 years ago

sanderjo commented 4 years ago

I would like to switch from par2 to parpar, but I don't know how to: which CLI command to use (so related to https://github.com/animetosho/ParPar/issues/2)

I always use par2 create -r10 -n7 mypar2files *rar with the output at the bottom of this post.

I tried a few parpar command, but can't generate the same result.

$ parpar -r10%  -s 100 -o somerandombin-500MB *rar
Cannot determine a slice size to satisfy required number of slices (100): using a slice size of 6553596 bytes would produce 101 slice(s), whilst a size of 6553600 bytes would produce 81 slice(s)
Enter `parpar --help` for usage information

and

$ parpar -r10  -s 100M -o somerandombin-500MB *rar
Multiply method used: XOR JIT (128 bit), 4 threads
Generating 1000 MiB recovery data (10 slices) from 500 MiB of data
Calculating: 100.00%
PAR2 created. Time taken: 18.204 second(s)

$ ll *par2
-rw-rw-r-- 1 sander sander       5820 jan 12 13:22 somerandombin-500MB.par2
-rw-rw-r-- 1 sander sander 1048593908 jan 12 13:22 somerandombin-500MB.vol00+10.par2

Tips appreciated

$ par2 create -r10 -n7 mypar2files   *rar

Block size: 264792
Source file count: 21
Source block count: 1981
Redundancy: 10%
Recovery block count: 198
Recovery file count: 7

Opening: somerandombin-500MB.part01.rar
Opening: somerandombin-500MB.part02.rar
Opening: somerandombin-500MB.part03.rar
Opening: somerandombin-500MB.part04.rar
Opening: somerandombin-500MB.part05.rar
Opening: somerandombin-500MB.part06.rar
Opening: somerandombin-500MB.part07.rar
Opening: somerandombin-500MB.part08.rar
Opening: somerandombin-500MB.part09.rar
Opening: somerandombin-500MB.part10.rar
Opening: somerandombin-500MB.part11.rar
Opening: somerandombin-500MB.part12.rar
Opening: somerandombin-500MB.part13.rar
Opening: somerandombin-500MB.part14.rar
Opening: somerandombin-500MB.part15.rar
Opening: somerandombin-500MB.part16.rar
Opening: somerandombin-500MB.part17.rar
Opening: somerandombin-500MB.part18.rar
Opening: somerandombin-500MB.part19.rar
Opening: somerandombin-500MB.part20.rar
Opening: somerandombin-500MB.part21.rar
Computing Reed Solomon matrix.
Constructing: done.
Wrote 16776936 bytes to disk
Wrote 16776936 bytes to disk
Wrote 16776936 bytes to disk
Wrote 2098008 bytes to disk
Writing recovery packets
Writing verification packets
Done
$ ll *par2
-rw-rw-r-- 1 sander sander    45008 jan 12 13:16 mypar2files.par2
-rw-rw-r-- 1 sander sander   619632 jan 12 13:16 mypar2files.vol000+02.par2
-rw-rw-r-- 1 sander sander  1194256 jan 12 13:16 mypar2files.vol002+04.par2
-rw-rw-r-- 1 sander sander  2298600 jan 12 13:16 mypar2files.vol006+08.par2
-rw-rw-r-- 1 sander sander  4462384 jan 12 13:16 mypar2files.vol014+16.par2
-rw-rw-r-- 1 sander sander  8745048 jan 12 13:16 mypar2files.vol030+32.par2
-rw-rw-r-- 1 sander sander 17265472 jan 12 13:16 mypar2files.vol062+64.par2
-rw-rw-r-- 1 sander sander 19384352 jan 12 13:16 mypar2files.vol126+72.par2
sanderjo commented 4 years ago

Ah, https://github.com/animetosho/ParPar/issues/18#issuecomment-536574313 gave the answer: -d pow2 (power of 2). So:

$ parpar -d pow2  -s 1M -r 64 -o my_recovery.par2 *rar
Multiply method used: XOR JIT (128 bit), 4 threads
Generating 64 MiB recovery data (64 slices) from 500 MiB of data
Calculating: 100.00%
PAR2 created. Time taken: 4.738 second(s)
$ ll *par2
-rw-rw-r-- 1 sander sander    15420 jan 13 22:45 my_recovery.par2
-rw-rw-r-- 1 sander sander  1064064 jan 13 22:45 my_recovery.vol00+01.par2
-rw-rw-r-- 1 sander sander  2112708 jan 13 22:45 my_recovery.vol01+02.par2
-rw-rw-r-- 1 sander sander  4225300 jan 13 22:45 my_recovery.vol03+04.par2
-rw-rw-r-- 1 sander sander  8435180 jan 13 22:45 my_recovery.vol07+08.par2
-rw-rw-r-- 1 sander sander 16839636 jan 13 22:45 my_recovery.vol15+16.par2
-rw-rw-r-- 1 sander sander 33633244 jan 13 22:45 my_recovery.vol31+32.par2
-rw-rw-r-- 1 sander sander  1064064 jan 13 22:45 my_recovery.vol63+01.par2

I still don't understand the -s 1M -r 64, but based on a few tries my rule of thumb / guesstimate is "smallest par2 with size 1MB, and go up to 64MB max". And with the -d pow2 parpar will create par2's in between, each time doubling in size

animetosho commented 4 years ago

For ParPar v0.3.0, the closest you could get is probably:

parpar -s2000 --min-input-slices=1 -r10% -d pow2 -o somerandombin-500MB *rar

This creates 8 volumes instead of 7, so slightly different.

For ParPar v0.3.1 (current Git), you can use:

parpar -s2000 --min-input-slices=1 -r10% --slices-first-file 2 -o somerandombin-500MB *rar

This puts the volume count at 7, so should match par2cmdline.

Explanation of differences:

animetosho commented 4 years ago

I still don't understand the -s 1M -r 64, but based on a few tries my rule of thumb / guesstimate is "smallest par2 with size 1MB, and go up to 64MB max".

PAR2 works off the notion of blocks or slices. Essentially, your input is divvied up into these pieces when it is processed. The -s parameter (in both ParPar and par2cmdline) is used to specify the size of each block/slice. -s 1M in ParPar is equivalent to -s1048576 in par2cmdline (-s1048576 also works in ParPar) and just means that the input data is interpreted as a series of 1MB blocks.

-r 64 in ParPar is equivalent to -c64 in par2cmdline - it says how many recovery blocks to generate. 64*1MB will, hence, generate a total of 64MB of recovery data. This total is distributed among all volumes, so a "64MB max" is technically correct, but probably not an intuitive way to think about it.