PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, July 27, 2022

[FIXED] How to crop a mp3 from x to x+n using ffmpeg?

 July 27, 2022     crop, ffmpeg, mp3     No comments   

Issue

Following this question I decided to use ffmpeg to crop MP3s. On another question I found this way of doing it:

ffmpeg -t 30 -acodec copy -i inputfile.mp3 outputfile.mp3

The problem is that I don't want to crop the first 30 seconds, I want to crop from x to x+n, like from 30s to 100s. How would I go and do this?

I'm reading the man for ffmpeg but this is not really straightforward, especially since I just discovered about ffmpeg and I'm not familiar with audio/video editing softwares, so any pointers would be appreciated.


Solution

Take a look at the -t and -ss arguments. They should do what you want.

-t duration

Restrict the transcoded/captured video sequence to the duration specified in seconds. hh:mm:ss[.xxx] syntax is also supported.

-ss position'

Seek to given time position in seconds. hh:mm:ss[.xxx] syntax is also supported.

For example, ffmpeg -ss 30 -t 70 -i inputfile.mp3 -acodec copy outputfile.mp3 should do the trick for the range you mentioned (30s-100s).



Answered By - Michael Madsen
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing