Extract part of audio/video file using ffmpeg or avconv
ffmpeg/avconv is a command-line tool that converts audio or video formats. It can also grab and encode in real-time from various sources such as a TV card etc.
To extract a part of audio/video file into a new file, you can do the following:
Assuming you have ffmpeg or avconv installed on your system(windows,*nix):
If you have ffmpeg instead of avconv, below commands can be used as is replacing avconv with ffmpeg
Audio:
avconv -i SourceAudio.mp3 -ss HH:MM:SS -t numberOfSeconds -acodec copy DestinationAudio.mp3 |
Video:
avconv -i SourceAudio.mp4 -ss HH:MM:SS -t numberOfSeconds -vcodec copy -acodec copy DestinationAudio.mp4 |
In the above line replace the parameters according to your needs:
Here SourceAudio.mp3/mp4 is the source audio from which you want to extract the audio
HH:MM:SS is the start time from which you want to start extracting.
numberOfSeconds is the length of audio you need to extract from start point.
DestinationAudio.mp3/mp4 is the file into which you want to write the extracted audio to.
-Rushi