How can I truncate .mp3 and .m4a files without transcoding?
September 19, 2012 5:44 AM   Subscribe

How can I truncate (cut the end off) .mp3 and .m4a files without transcoding?

I have a lot of music files for which iTunes Match fails to match simply because the track lengths are very different. Usually these files contain a lot of silence at the end. I would like these files to match so I can download higher quality recordings from iTunes.

I have found that I can do this by loading the relevant file in audacity, chopping off the silence at the end, resaving as .m4a/.mp3, importing the result into iTunes and then running iTunes Match on the result. However, the transcoding is slow and reimporting is very laborious (it requires me to mess around a lot with the metadata).

I would like to shortcut this by editing the .mp3/.m4a files directly to chop off the silent sections at the ends, without transcoding. I'm happy to install some libraries, write some Python, etc etc to achieve this, so a reasonably hi-tech solution would be fine.
posted by beniamino to Computers & Internet (9 answers total) 2 users marked this as a favorite
 
Not hi-tech, but mp3 Trimmer?
posted by Beardman at 5:47 AM on September 19, 2012


mp3splt "trim using silence detection"
posted by stuartmm at 6:03 AM on September 19, 2012


Best answer:
ffmpeg -i input.mp3 -acodec copy -t 00:01:00 output.mp3
Will extract the first minute of audio. You can also use '-ss hh:mm:ss.xxx' to set a start offset.
posted by zengargoyle at 6:05 AM on September 19, 2012 [2 favorites]


Response by poster: Perfect! All look promising, but the ffmpeg solution works for .m4a files too (and I've checked that the files are correctly matched by iTunes after truncation). Thanks!
posted by beniamino at 6:20 AM on September 19, 2012


If I'm understanding what you're trying to do (manually shorten your tracks to some known length), you can also just do this in iTunes. Click "Get Info" for the song, "Options", then pick new start/stop times. Then exit out of there and right click the song, and do "Create AAC Version" (for m4a), and it'll create a new file with your selected length. For an mp3, go to "Preferences", "General", "Import Settings", then pick "Import Using MP3 Encoder". Now you'll be able to "Create MP3 Version" instead.
posted by gueneverey at 7:16 AM on September 19, 2012 [1 favorite]


gueneverey: "If I'm understanding what you're trying to do"

They specifically want to avoid transcoding lossy formats. I'd just use mp3plt.
posted by turkeyphant at 3:48 PM on September 19, 2012


For the mp3's, I'd use mp3 Direct Cut. It's a small, free Windows program that makes modifications to mp3 files without transcoding. You can cut, splice, and change volume levels, all without decompressing the file.
posted by exphysicist345 at 5:30 PM on September 19, 2012


OP, I was having the same issue with songs that weren't matching even though I knew iTunes sold the song. This doesn't directly answer your question, but this is what worked for me. Trimming the length didn't lead to a match for a lot of my stuff, but one thing that did was fiddling with the bit rate of the song. Say I had a 256 MP3 that I was trying to match. Change the iTunes import settings to AAC or MP3 at a lower bit rate. I usually started a couple steps down (256 to 192, for example). Then right click the song in question and choose "Create AAC (or MP3) Version" and convert it to the lower bit rate. Delete the original from your library (and from iCloud when it asks) and then update iTunes Match to rematch it. (If it fails and tells you it's a duplicate, update iTunes Match again because it may have started before the original was gone.) If it matches, great. Delete the low quality version from your local library and download the iTunes AAC version. If not, try a lower bit rate. Hope that's clear, but this is what worked for me, especially those last songs that just wouldn't match.
posted by jroybal at 6:44 PM on September 26, 2012


Response by poster: jroybal: Thanks for the tip, that works for me too on some songs where the length is right, but the match failed.
posted by beniamino at 4:10 AM on September 27, 2012


« Older I think I inhaled a bit of a melting plastic bag...   |   Are job recruiters helpful? Newer »
This thread is closed to new comments.