Saturday, December 5, 2009

Converting Audio Files and Videos Using FFMPEG

ffmpeg can be used to easily convert audio or video files on any OS - Windows, Linux, or Mac.

Common ffmpeg Parameters
  • -i <filename> - Path\Filename of source file
  • -y - Overwrite the existing output file without prompting
  • -an - Disable audio
Video Related ffmpeg Parameters
  • -aspect <aspect ratio> - Set Aspect Ratio for the video (4:3, 16:9 or 1.3333, 1.7777)
  • -r <rate> - Set frame rate in Hz for the video
  • -s <size> - Set video resolution size (Width x Height)
  • -sameq - Use same video quality as source
Audio Related ffmpeg Parameters
  • -ar <rate> - Set audio sampling rate (in Hz)
  • -acodec <codec> - Force audio codec, example mp3
  • -vol <volume> - Change audio volume (256=normal)
  • -ab <rate> - Set audio bit rate (in bits/s)
Advanced ffmpeg Parameters
  • -map_meta_data output file:<input file> - Copy the metadata from input file to converted output file
ffmpeg Command Line Syntax
ffmpeg –i <input filename> <output filename>
ffmpeg Video Examples:
  • Converting MOV to FLV using FFMPEG:
    ffmpeg -i movie.mov movie.flv
  • Converting Mpeg to FLV using FFMPEG:
    ffmpeg -i movie.mpeg movie.flv
  • Converting AVI to FLV using FFMPEG - convert movie.avi to movie.flv and resize the video resolution to 500×500:
    ffmpeg -i movie.avi -s 500×500 movie.flv
  • Converting 3GP to FLV using FFMPEG - convert movie.3gp to movie.flv, keep the original file settings and disable the audio content:
    ffmpeg -i movie.3gp -sameq -an movie.flv
  • Converting MPEG to 3GP using FFMPEG:
    ffmpeg -i movie.mpeg -ab 8.85k -acodec libamr_wb -ac 1 -ar 16000 -vcodec h263 -s qcif movie2.3gp
ffmpeg Audio Examples:
  • Converting aac to mp3 using FFMPEG with MetaData - convert audio.aac to audio.mp3 with an audio rate of 22.05 Khz and audio BitRate of 32Khz, and will copy the metadata from .aac file to .mp3 file:
    ffmpeg -i audio.aac -ar 22050 -ab 32 -map_meta_data audio.mp3:audio.aac audio.mp3
  • Converting WMV to MP3 using FFMPEG
    ffmpeg -i audio.wmv audio.mp3
  • Converting WMV to FLV using FFMPEG - convert audio.wmv to audio.flv, generating only audio content:
    ffmpeg -i audio.wmv audio.flv
  • Converting AMR to MP3 using FFMPEG - convert audio.amr to audio.mp3, with an audio rate of 22.05 Khz:
    ffmpeg -i audio.amr -ar 22050 audio.mp3
  • Converting aac to mp3 using FFMPEG - convert audio.aac to audio.mp3, with an audio rate of 22.05 Khz and audio BitRate or 32Khz:
    ffmpeg -i audio.aac -ar 22050 -ab 32 audio.mp3
Download ffmpeg.exe for Windows (direct link) (8.5MB)

ffmpeg windows 7, vista, windows 2008

No comments:

Post a Comment