Skip to main content

Topic: pcutmp3 tool (Read 231079 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • cheatz
  • [*]
pcutmp3 tool
Reply #100
Ah i got it working all i had to do was double click the jar file not the bat file.

When it splits files it only saves ID3v1 tags. ID3v1 doesn't capture the full filename so i'm left with half a filename even though the information on the cue sheet supplies the full filename.

Is there a fix for this?
  • Last Edit: 03 August, 2007, 08:58:52 AM by cheatz

  • SebastianG
  • [*][*][*][*][*]
  • Developer
pcutmp3 tool
Reply #101
When it splits files it only saves ID3v1 tags. ID3v1 doesn't capture the full filename so i'm left with half a filename even though the information on the cue sheet supplies the full filename.


The problem with pcutmp3 development is that even if it supported all kinds of nice features the userbase would still be very small. Honestly, I'm not a pcutmp3 user myself because I simply don't need it. So, my only concern is its main functionality. However, that doesn't mean that I wouldn't welcome patches. So, if any of you feel the urge to hack some Java code feel free to send patches. The source code of pcutmp3 has always been part of the JAR file.

Cheers!
SG

  • senab
  • [*][*][*]
pcutmp3 tool
Reply #102
pcutmp3 with ID3v2 Support

After quite a while since I said I was going to add ID3v2 support, i've finally done it. I've used the Jaudiotagger library, which is really good and licensed under the LGPL.

Changes
  • Added ID3v2 writing support.
  • Changed default naming scheme

Download
I've packaged pcutmp3 in two ways:
  • JAR file. Same as how Sebastian packaged his version and can be used as a direct replacement (source is included). Download.
  • EXE file. I've packaged the JAR using JSmooth to create an executable file. Basically use this version if you're using Windows, it means you can call the exe directly without going through java -jar. Source is not included. Download.
There is a small "problem" with the tag library in that it is very verbose. There's no easy way to make it less verbose but i've done what I can for now. It doesn't affect the end result at all. Also the library has made the program much bigger (40k to ~900k) but I think the increase in file size is worth the functionality.

  • Last Edit: 30 May, 2008, 04:42:38 PM by senab

  • SebastianG
  • [*][*][*][*][*]
  • Developer
pcutmp3 tool
Reply #103
Nice! Good timing, too because my university homepage doesn't exist anymore.

Thanks for the effort.

Cheers,
SG

  • senab
  • [*][*][*]
pcutmp3 tool
Reply #104
After my exams finish next week, i'm thinking of going through the code to bring it upto date. At the moment it's written for Java 1.4, i'm also going to refactor it a bit aswell to make it a bit more OO.

Sebastian: What license are you releasing this under?

And if anyone has any ideas for features, let me know
  • Last Edit: 31 May, 2008, 06:36:28 AM by senab

  • jetpower
  • [*][*]
pcutmp3 tool
Reply #105
Hi,
I would like to ask for a feature: chop file into same-length parts.
Example: An audiobook mp3 is 120 minutes long -> chop it to 24 parts, each with 5 minutes of length.
I can do it with 'crop' command already but this way it'll be automatic and much less typing.

  • mezenga
  • [*][*][*]
pcutmp3 tool
Reply #106
Hi,
I would like to ask for a feature: chop file into same-length parts.

I suppose you want to strip mp3s just like some archives do (7z, rar, ...).
Different from the archive, where you need all the strips, the striped audio parts can be evaluated alone. I don´t think it´s a good idea. This kind of feature would fit better in a GUI (IMO). Anyway, a simple spreadsheet can save you the typing.

A more powerful feature is the acceptance of .cue files already implemented.

Edit: wrong information rectified.
  • Last Edit: 01 June, 2008, 11:03:32 AM by mezenga

  • jaybeee
  • [*][*][*][*]
pcutmp3 tool
Reply #107
Nice! Good timing, too because my university homepage doesn't exist anymore.

Thanks for the effort.

Cheers,
SG
If anyone still wants Sebi's last version of pcutmp3, then you can grab it from here: pcutmp3 v0.95b

  • dubpistol
  • [*][*][*]
pcutmp3 tool
Reply #108
And if anyone has any ideas for features, let me know

Yes, this one:
[...] It should be possible to rejoin files losslessly (not yet implemented). [...]

  • jetpower
  • [*][*]
pcutmp3 tool
Reply #109
Hi,
I would like to ask for a feature: chop file into same-length parts.

I suppose you want to strip mp3s just like some archives do (7z, rar, ...).
Different from the archive, where you need all the strips, the striped audio parts can be evaluated alone. I don´t think it´s a good idea. This kind of feature would fit better in a GUI (IMO). Anyway, a simple spreadsheet can save you the typing.

A more powerful feature is the acceptance of .cue files already implemented.

Edit: wrong information rectified.

Well the idea is certainly good for me. I'll explain.
Its for my phone. My phone plays mp3 but is very slow at seeking in audio files. Also one cannot jump to a certain point in long audio (for example to start where you left it the other day) and you have to fast forward which takes time, is annoying and drains the battery. With, say 5 minute file the seeking is fast and luckily phone jumps to next audio chunk automatically (when they are in order), so I can listen and relax:)

Can you give an example of this spreadsheet you mentioned?
What I want is not a hard feature to implement, I think and I would happy if anyone could code it in.
  • Last Edit: 01 June, 2008, 01:41:42 PM by jetpower

  • jaybeee
  • [*][*][*][*]
pcutmp3 tool
Reply #110
And if anyone has any ideas for features, let me know

Yes, this one:
[...] It should be possible to rejoin files losslessly (not yet implemented). [...]

I'm almost certain that this is with files only previously cut using pcutmp3. But still, a potentially useful feature, altho tbh I can't when I'd use it.

  • senab
  • [*][*][*]
pcutmp3 tool
Reply #111
[...] It should be possible to rejoin files losslessly (not yet implemented). [...]
Sorry but this is one I can't do, I don't know the file format of MP3 so it's a dead start.


Jetpower I quite like you're idea, i've had to do similar in the past because I haven't been able to find a cue. I'm thinking of implementing it with:
Code: [Select]
--split-every s

Where s is the size of tracks in seconds (except the last). I've had a look at the code and i'm going to do it over the next few days. I've got quite a bit of refactoring to do to make it a bit easier to do though.
  • Last Edit: 02 June, 2008, 08:59:49 AM by senab

  • jetpower
  • [*][*]
pcutmp3 tool
Reply #112
Quote
I'm thinking of implementing it with:
Code: [Select]
--split-every s

Thanks Senab. I like this command, its simple and clear. But you may also consider permitting here the full time format as in 'crop' command.

Quote
Where s is the size of tracks in seconds (except the last).

This got me thinking what to do in extreme cases where the last part is going to be very short. it's not very important for me but there could be some tolerance (couple seconds maybe) before writing yet another part.

  • mezenga
  • [*][*][*]
pcutmp3 tool
Reply #113
Well the idea is certainly good for me.
 
Can you give an example of this spreadsheet you mentioned?

Code: [Select]
;;file;x;.mp3;;;
;;total time (s);150;;splitting factor;=D2/D3;=G2-INT(G2)
;;splitting length (s);60;;;;

;;splitting result;=INT(G2);pieces of;=D3;s;
;;;=SE(H2>0,1,0);pieces of;=D3*H2;s;

Copy the following lines to a batch file:;;Auxiliary math:;;;;;

=CONCATENAR("@java -jar pcutmp3 ",D$1,E$1," --crop t:",C10,"-",D10," --out ",D$1,"-p",E10);;0;=SE(D2<D3,D2,D3*E10);1;;;
=SE(F11=1,"",CONCATENAR("@java -jar pcutmp3 ",D$1,E$1," --crop t:",C11,"-",D11," --out ",D$1,"-p",E11));;=SE(F11=1,"",D10+1);=SE(F11=1,"",SE(E10=D$5,D10+F$6,D$3*E11));2;=SE(E10>=D$5+D$6,1,0);;
=SE(F12=1,"",CONCATENAR("@java -jar pcutmp3 ",D$1,E$1," --crop t:",C12,"-",D12," --out ",D$1,"-p",E12));;=SE(F12=1,"",D11+1);=SE(F12=1,"",SE(E11=D$5,D11+F$6,D$3*E12));3;=SE(E11>=D$5+D$6,1,0);;
=SE(F13=1,"",CONCATENAR("@java -jar pcutmp3 ",D$1,E$1," --crop t:",C13,"-",D13," --out ",D$1,"-p",E13));;=SE(F13=1,"",D12+1);=SE(F13=1,"",SE(E12=D$5,D12+F$6,D$3*E13));4;=SE(E12>=D$5+D$6,1,0);;
1) Paste this text in notepad and save with ".csv" extension.
2) Open in MS Excel and: a) subst "," with ";" b) fix the size of columns A and C
3) Play 
4) Remember that it is totally untested. So, be kind when complaining that it doesn´t work 

What I want is not a hard feature to implement, I think and I would happy if anyone could code it in.
Again, pcutmp3 GUI would be a better place for this feature (IMO).

  • jetpower
  • [*][*]
pcutmp3 tool
Reply #114
Code: [Select]
;;file;x;.mp3;;;
;;total time (s);150;;splitting factor;=D2/D3;=G2-INT(G2)
;;splitting length (s);60;;;;

;;splitting result;=INT(G2);pieces of;=D3;s;
;;;=SE(H2>0,1,0);pieces of;=D3*H2;s;

Copy the following lines to a batch file:;;Auxiliary math:;;;;;

=CONCATENAR("@java -jar pcutmp3 ",D$1,E$1," --crop t:",C10,"-",D10," --out ",D$1,"-p",E10);;0;=SE(D2<D3,D2,D3*E10);1;;;
=SE(F11=1,"",CONCATENAR("@java -jar pcutmp3 ",D$1,E$1," --crop t:",C11,"-",D11," --out ",D$1,"-p",E11));;=SE(F11=1,"",D10+1);=SE(F11=1,"",SE(E10=D$5,D10+F$6,D$3*E11));2;=SE(E10>=D$5+D$6,1,0);;
=SE(F12=1,"",CONCATENAR("@java -jar pcutmp3 ",D$1,E$1," --crop t:",C12,"-",D12," --out ",D$1,"-p",E12));;=SE(F12=1,"",D11+1);=SE(F12=1,"",SE(E11=D$5,D11+F$6,D$3*E12));3;=SE(E11>=D$5+D$6,1,0);;
=SE(F13=1,"",CONCATENAR("@java -jar pcutmp3 ",D$1,E$1," --crop t:",C13,"-",D13," --out ",D$1,"-p",E13));;=SE(F13=1,"",D12+1);=SE(F13=1,"",SE(E12=D$5,D12+F$6,D$3*E13));4;=SE(E12>=D$5+D$6,1,0);;

wow, very nice, thanks. I managed to get it working - yet another surprise thing Excel can do. You might try not to use Portuguese(?) commands next time though, struggled a bit with these:).


What I want is not a hard feature to implement, I think and I would happy if anyone could code it in.
Quote
Again, pcutmp3 GUI would be a better place for this feature (IMO).

This spreadsheet works nicely but I still prefer to have this sort of functionality integrated (whether in GUI or cmdline). Available MP3 splitter programs include also splitting by size (kb) and some even have silence detection (for e.g. audiobook chapters). Combining best possible mp3 cutting with these features (and nice GUI) would make the ultimate splitter:)
  • Last Edit: 03 June, 2008, 08:36:00 AM by jetpower

  • senab
  • [*][*][*]
pcutmp3 tool
Reply #115
Again, pcutmp3 GUI would be a better place for this feature (IMO).


Why? The GUI should do nothing more than call commands on the program, anything other than simple logic should be in the program. Lookup partioning and layering in Software Engineering.

How is the GUI supposed to know how long the MP3 is? Without that piece of information your solution will not work as it won't know when to stop adding crop commands.

  • SebastianG
  • [*][*][*][*][*]
  • Developer
pcutmp3 tool
Reply #116
What license are you releasing this under?

Let's say BSD.

Regarding the joining of files: This only applies to files which have been previously cut by pcutmp3 where the end of one file is exactly the start of the following and so on. I didn't feel like implementing it because of its very rare usecases.

Cheers,
SG
  • Last Edit: 04 June, 2008, 08:14:48 AM by SebastianG

  • mezenga
  • [*][*][*]
pcutmp3 tool
Reply #117
wow, very nice, thanks. I managed to get it working - yet another surprise thing Excel can do. You might try not to use Portuguese(?) commands next time though, struggled a bit with these:).
Sorry, I forgot this detail... Glad you made it work.
Why? The GUI should do nothing more than call commands on the program, anything other than simple logic should be in the program. Lookup partioning and layering in Software Engineering.
I just thought that getting some information about the mp3 file and doing the crop math would fit in the "simple logic" category you mentioned. My point is that pcutmp3 already has the basic commands and that the GUI would use these existent commands to provide more options.
How is the GUI supposed to know how long the MP3 is? Without that piece of information your solution will not work as it won't know when to stop adding crop commands.
Well, if such a function (getting some information about the mp3) represents too much code redundancy between the GUI and the application your approach is better. Otherwise mine may worth.

  • Peddy
  • [*]
pcutmp3 tool
Reply #118
pcutmp3 with ID3v2 Support

After quite a while since I said I was going to add ID3v2 support, i've finally done it. I've used the Jaudiotagger library, which is really good and licensed under the LGPL.

Changes
  • Added ID3v2 writing support.
  • Changed default naming scheme
Download
I've packaged pcutmp3 in two ways:
  • JAR file. Same as how Sebastian packaged his version and can be used as a direct replacement (source is included). Download.
  • EXE file. I've packaged the JAR using JSmooth to create an executable file. Basically use this version if you're using Windows, it means you can call the exe directly without going through java -jar. Source is not included. Download.
There is a small "problem" with the tag library in that it is very verbose. There's no easy way to make it less verbose but i've done what I can for now. It doesn't affect the end result at all. Also the library has made the program much bigger (40k to ~900k) but I think the increase in file size is worth the functionality.



Doesn't cut properly in Linux, it creates a 200byte file (depending on the tag size) with the contents at the bottom of this post.  I've used multiple Linuxes, same problem. Could you PLEASE fix this? Here's a little snippet of a failed cut:

Code: [Select]
16/11/2008 5:22:43 PM org.jaudiotagger.tag.id3.ID3v24Tag write
INFO: Writing tag to file
16/11/2008 5:22:43 PM org.jaudiotagger.tag.id3.ID3v24Frame write
INFO: Writing frame to file:TRCK
16/11/2008 5:22:43 PM org.jaudiotagger.tag.id3.framebody.AbstractID3v2FrameBody write
INFO: Writing frame body forTRCK:Est Size:0
16/11/2008 5:22:43 PM org.jaudiotagger.tag.id3.framebody.AbstractID3v2FrameBody write
INFO: Written frame body forTRCK:Real Size:3
16/11/2008 5:22:43 PM org.jaudiotagger.tag.id3.ID3v24Frame write
INFO: Writing frame to file:TIT2
16/11/2008 5:22:43 PM org.jaudiotagger.tag.id3.framebody.AbstractID3v2FrameBody write
INFO: Writing frame body forTIT2:Est Size:0
16/11/2008 5:22:43 PM org.jaudiotagger.tag.id3.framebody.AbstractID3v2FrameBody write
INFO: Written frame body forTIT2:Real Size:28
16/11/2008 5:22:43 PM org.jaudiotagger.tag.id3.ID3v24Frame write
INFO: Writing frame to file:TPE1
16/11/2008 5:22:43 PM org.jaudiotagger.tag.id3.framebody.AbstractID3v2FrameBody write
INFO: Writing frame body forTPE1:Est Size:0
16/11/2008 5:22:43 PM org.jaudiotagger.tag.id3.framebody.AbstractID3v2FrameBody write
INFO: Written frame body forTPE1:Real Size:7
16/11/2008 5:22:43 PM org.jaudiotagger.tag.id3.ID3v24Frame write
INFO: Writing frame to file:TALB
16/11/2008 5:22:43 PM org.jaudiotagger.tag.id3.framebody.AbstractID3v2FrameBody write
INFO: Writing frame body forTALB:Est Size:0
16/11/2008 5:22:43 PM org.jaudiotagger.tag.id3.framebody.AbstractID3v2FrameBody write
INFO: Written frame body forTALB:Real Size:36
16/11/2008 5:22:43 PM org.jaudiotagger.tag.id3.ID3v1Tag write
INFO: Saving file


And here's what's created.

Code: [Select]
$cat 02\ -\ Tomorrow\ Never\ Comes.mp3 
ID3MTRCK2TIT2Tomorrow Never ComesTPE1ArnejTALB$A State of Trance 377 [06-11-2008] TAGTomorrow Never ComesArnejA State of Trance 377 [06-11-2?


Thanks

  • senab
  • [*][*][*]
pcutmp3 tool
Reply #119
@Peddy: I'm going to look at this, this week

  • FigBug
  • [*]
pcutmp3 tool
Reply #120
@Peddy: I'm going to look at this, this week


Is it possible to compile the latest version of pcutmp3 with java 1.5? I tried, but got a bunch of errors. I'm guess ing java 1.6 features are used.

My idea was to write a gui for pcutmp3 for the mac. However, the mac only has java 1.6 on 64-bit intel macs. And that would be very limiting to my user base.

I think 0.95b was java 1.5. How much has changed since then?

  • senab
  • [*][*][*]
pcutmp3 tool
Reply #121
PCutMP3 0.97

Right, after the mess that was my last version of PCutMP3, here is a much nicer packaged version with ID3v2 support. It now uses a different ID3 library called JID3. Although the library hasn't been updated in a while, I chose it on the basis that it works, it's quick and fairly simply written unlike the previously used library.

Download
pcutmp3.jar
jid3.jar

By default jid3.jar must be in the same directory as pcutmp3.jar, although you can change that via the classpath. All the source is included in the JARs.

Extra points
I have included an patch in JID3 that fixed the UTF-16 support. I've also made UTF-16 the default.


@Peddy: I've tested this on various Linux machines and works fine, although I didn't have any problems with the previous version. Let me know if this doesn't work.

@FigBug: PCutMP3 is actually written against Java 1.4. The reason you got all the "errors" (they're actually warnings) is because you must be compiling with 1.5+. As the code was written for 1.4 it makes no use of Generics which is why the warning comes up. Doesn't mean there's anything wrong though.

I may update the code to bring it to 1.5 soon, and also do a bit of cleanup of the code. Off the top of my head I'd start making use of Generics, and get rid of using Vector (use ArrayList instead).

  • FigBug
  • [*]
pcutmp3 tool
Reply #122
@FigBug: PCutMP3 is actually written against Java 1.4. The reason you got all the "errors" (they're actually warnings) is because you must be compiling with 1.5+. As the code was written for 1.4 it makes no use of Generics which is why the warning comes up. Doesn't mean there's anything wrong though.


Bizarre. It works now. The last version I downloaded gave me the following errors when I tried to run it:
Code: [Select]
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)


Maybe something in the ID3 stuff didn't like Java 1.5?

Anyway, I'm glad I checked this thread again, because I was just about to write code to check the java version and warn the user to upgrade.

Thanks!

  • FigBug
  • [*]
pcutmp3 tool
Reply #123
I just noticed that when using a cue file to cut the mp3 the track number is no longer set in the ID3 tag. I seem to remember this working in the last version.

  • FigBug
  • [*]
pcutmp3 tool
Reply #124
Ok, my mac gui is done. It requires OS X 10.4
It is simple, all it does is take a mp3 and cut and cuts it up. But it saves time in that you don't have to deal with the console.

Enjoy:
http://rabien.com/software/CueCut.dmg