

ss is the start of the extracted audio timestamp, and -t is the audio duration.įor example, to extract 30 seconds of audio starting 2 minutes into the video, and use the same audio codec as the original source:įfmpeg -i myvideo.mp4 -ss 00:02:00 -t 00:00:30.0 -vn -acodec copy audio.ogg In this command, -i is used to specify the path and filename of the input video, -vn skips the inclusion of the video stream, while -acodec copy is for copying the original audio (without re-encoding).Įxtract only a portion of the audio from a video, using the same audio format used by the original source:įfmpeg -i myvideo.mp4 -ss 00:00:00 -t 00:00:00.0 -vn -acodec copy audio.ogg Replace myvideo.mp4 with the video filename/path, and audio.ogg with the name you want to use for the audio output filename, and the extension. Now that you know the original audio format, extract the audio from the video without re-encoding it using:įfmpeg -i myvideo.mp4 -vn -acodec copy audio.ogg

You may also like: How To Download A YouTube Playlist And Convert It To MP3 Using youtube-dl (Command Line) Stream #0:1(eng): Audio: vorbis, 44100 Hz, stereo, fltp (default) Near the end of this command's output you should see the audio stream, e.g.:ĭuration: 00:04:19.47, start: 0.000000, bitrate: 1261 kb/s Replace myvideo.mp4 with the video filename (and path if the video is not in the current folder). To extract the audio from a video, and keep the original audio format, the first thing you'll want to do is check what's the original audio format so you know what file extension to use, by using ffprobe (part of the FFmpeg package): Optionally also install libmp3lame for converting to mp3, and libvorbis for converting the extracted audio to Ogg Vorbis. To use the FFmpeg examples / commands below, you'll need to have FFmpeg installed on your system. This article explains how to use FFmpeg to extract the audio stream from a video, either without re-encoding (keeping the original format), or converting the resulting audio file to CBR (constant bitrate) or VBR (variable bitrate) MP3 or Ogg Vorbis.
