Friday, April 19, 2013

Converting audio/video files using ffmpeg

ffmpeg command can be used to convert the audio/video from one format to another format

Common ffmpeg Parameters
  • -i - Path\Filename of source file
  • -y - Overwrite the existing output file without prompting
  • -an - Disable audio
Video Related ffmpeg Parameters
  • -aspect - Set Aspect Ratio for the video (4:3, 16:9 or 1.3333, 1.7777)
  • -r - Set frame rate in Hz for the video
  • -s - Set video resolution size (Width x Height)
  • -sameq - Use same video quality as source
Audio Related ffmpeg Parameters
  • -ar - Set audio sampling rate (in Hz)
  • -acodec - Force audio codec, example mp3
  • -vol - Change audio volume (256=normal)
  • -ab - Set audio bit rate (in bits/s)
Syntax
ffmpeg Command
Video
  • 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
Audio

  • 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
FFmpeg download

http://ffmpeg.arrozcru.org/autobuilds/


convert avi to flv like in youtube

ffmpeg -i video_origine.avi -ab 56 -ar 44100 -b 200 -r 15 -s 320x240 -f flv video_finale.flv

1 comment:

  1. Quite a nice post, and I've found another detailed guide on how to convert MKV to MP4 using FFmpeg here, besides, alternative to FFmpeg is mentioned in this guide.

    ReplyDelete