Reputation: 24446
I've got a bunch of spoken word mp3 files, which all have the same intro talking and music, and then the real content begins. So it goes roughly like this:
00:00 Standard intro spoken word
00:20 Standard intro music
00:35 The content
The timings are not always the same (can vary by 5 secs). So I'd to cut the first 25 seconds and then fade in the next five seconds. And then output the file in the same mp3 format. Is this possible with ffmpeg?
Upvotes: 7
Views: 6123
Reputation: 3355
I was just looking how to trim the audio in a video and just figured this out:
ffmpeg -i input.mp4 -ss 10 -to 20 -i input.mp4 -map 0:v -map 1:a -c copy -copyts output.mp4
We use -i input.mp4
twice (for video/audio) and select with -map 0:v
and -map 1:a
.
Then we can put -ss 10 -to 20
before our audio input to trim it.
Then we need -copyts
so the audio input begins at the same timestamp.
And we use -c copy
to not re-encode so it's faster.
Use -c:v copy
if you want to re-encode, since the video doesn't need re-encoding, only the audio.
Hope this helps anyone.
Upvotes: 1
Reputation: 534
This command should work for you:
ffmpeg -ss 25 -i input.mp3 -af "afade=type=in:start_time=0:duration=5" -c:a libmp3lame output.mp3
-ss 25
will start the input after the first 25 seconds.
afade
filter will fade in the audio from the specified start time for the next 5 seconds.
Upvotes: 14