How to trim the first 10 seconds from a batch of mp3?

0

This was asked before, Mass MP3 audio file editor, but I'm wondering if things have changed by now. I'm also ok with any solution that works for any OS, and even CLI.

ffmpeg doesn't do the trick (the file output is not trimmed).

ffmpeg -i 2999.mp3 -ss 0:10 -acodec copy 2999-trimmed.mp3
FFmpeg version 0.6.1, Copyright (c) 2000-2010 the FFmpeg developers
  built on Mar  7 2011 12:32:28 with gcc 4.2.1 (Apple Inc. build 5646)
  configuration: --prefix=/opt/local --enable-gpl --enable-postproc --enable-swscale --enable-avfilter --enable-avfilter-lavf --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libdirac --enable-libschroedinger --enable-libfaac --enable-libfaad --enable-libxvid --enable-libx264 --enable-libvpx --enable-libspeex --enable-nonfree --mandir=/opt/local/share/man --enable-shared --enable-pthreads --disable-indevs --cc=/usr/bin/gcc-4.2 --arch=x86_64
  libavutil     50.15. 1 / 50.15. 1
  libavcodec    52.72. 2 / 52.72. 2
  libavformat   52.64. 2 / 52.64. 2
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.19. 0 /  1.19. 0
  libswscale     1.11. 0 /  1.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0
**[mp3 @ 0x12180c800]max_analyze_duration reached**
**[mp3 @ 0x12180c800]Estimating duration from bitrate, this may be inaccurate**
Input #0, mp3, from '2999.mp3':
  Metadata:
    TYER            : 2005-01-21
    TPE1            : البخاري
    TPE2            : البخاري
    TALB            : صحيح البخاري ٢
  Duration: 00:00:28.94, start: 0.000000, bitrate: 32 kb/s
    Stream #0.0: Audio: mp3, 22050 Hz, 1 channels, s16, 32 kb/s
Output #0, mp3, to '2999-trimmed.mp3':
  Metadata:
    TSSE            : Lavf52.64.2
    Stream #0.0: Audio: libmp3lame, 22050 Hz, 1 channels, 32 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
size=     103kB time=26.36 bitrate=  32.0kbits/s    
video:0kB audio:103kB global headers:0kB muxing overhead 0.031300%

simpatico

Posted 2011-08-13T11:42:01.747

Reputation: 113

Shouldn't the questions be merged? – RedGrittyBrick – 2011-08-13T16:35:19.457

Answers

2

mp3splt is what I use often. It's specialty is that it splits between full MP3 frames, ie. without decompressing and recompressing the sound, which means the quality is not affected at all.

Something like this would work for a single file:

mp3splt -f 0.10 5000.0 <filename>

The 5000.0 needs to be higher than length of any single file; the mp3splt stops when it encounters EOF or the specified end point is reached.

Zds

Posted 2011-08-13T11:42:01.747

Reputation: 2 209

0

    #!/bin/bash

for file in $1/*.mp3
do

echo "file=$file"
mp3splt -f 0.10 5000.0 $file
if test "$?" == "0"; then
#   cp $file $file"_backup" 
    rm $file
    fi
done    

Thank you Zds for referring mp3splt

simpatico

Posted 2011-08-13T11:42:01.747

Reputation: 113