18 examples for ffmpeg

{{ score }}
  # Converts a FLAC file to an MP3 at 320 kbs
# ffmpeg should automatically use the proper encoder based off of extension
# ffmpeg should also convert metadata automatically
ffmpeg -i input_file.flac -ab output_file.mp3
{{ score }}
  # Remove sound from a video
ffmpeg -i in.avi -vcodec copy -an out.avi
{{ score }}
  # Cuts a clip from a video or sound.
# Give it a minute to decode the video to accurately get the timestamp.
ffmpeg -i in.avi -ss startseconds -t lengthofclip out.avi
{{ score }}
  # list all available codecs which are built in to ffmpeg
#  D..... = Decoding supported
#   .E.... = Encoding supported
#    ..V... = Video codec
#     ..A... = Audio codec
#      ..S... = Subtitle codec
#       ...I.. = Intra frame-only codec
#        ....L. = Lossy compression
#         .....S = Lossless compression
ffmpeg -codecs
{{ score }}
  # Extract audio from a video and write to variable-rate mp3 file
ffmpeg -i video-in.mp4 -q:a 0 -map a audio-out.mp3
{{ score }}
  # Capture video of a linux desktop
ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq /tmp/out.mpg
{{ score }}
  # Rip the DVD's Video file nr. 1 to an x264 (flash compatible) AAC converted AVI file to your home directory)
# With a constant framerate of 630kbit/s ( see http://www.3ivx.com/support/calculator/ ) (see ffmpeg wiki for codecs)
ffmpeg -i /mnt/cdrom/VIDEO_TS/VTS1-01.VOB -strict -2 -c:v libx264 -b:v 630k -c:a libfaac -b:a 128k  ~/Videos/MySuperDvdRip.x264.aac.avi
{{ score }}
  # Converts an input-video file to a 256k 44100Hz mp3 file.
ffmpeg -i input-video.wav -vn -ar 44100 -ac 2 -ab 256k -f mp3 output-file.mp3
{{ score }}
  # Transcode any video into HQ x264 (MPEG4-AVC) with AAC audio, in MP4 (M4V) container.
# This is the de facto standard for most current standalone players, such as Apple and Android.
# It will transcode the video into SAME resolution and framerate as the original.
# You can change the crf/qscale:a values to your needs (lower/higher is better, respectively, but larger file).
# Check out https://trac.ffmpeg.org/wiki/x264EncodingGuide#Compatibility if you want to change profile:v and baseline.
ffmpeg -i  -c:v libx264 -crf 20 -preset slow -profile:v baseline -level 3.0 -pix_fmt yuv420p -c:a libfaac -q:a 150 -y .m4v
{{ score }}
  # Change the container of a media file without transcoding
ffmpeg -i mymovie.mkv -vcodec copy -acodec copy mymovie.m4v
{{ score }}
  # Similar to above, just with a higher video profile and level, and better quality Ogg Vorbis audio.
# Appears to work on Android 2.2 (Froyo) and newer devices flawlessly. Should definitely work on Android 4.
# Packed in a MKV (Matroska) format.
ffmpeg -i  -c:v libx264 -crf 20 -preset slow -profile:v high -level 4.1 -pix_fmt yuv420p -c:a libvorbis -q:a 5 -y .mkv
{{ score }}
  # Remux video to embed non-UTF8 subtitle
ffmpeg -i video.mp4 -sub_charenc LATIN1 -i video.srt -c:a copy -c:v copy -c:s srt video_both.mkv
{{ score }}
  # convert to mp4 with aac audio codec using the ffmpeg installed with homebrew 
ffmpeg -i IN.MOV -c:v libx264 -c:a aac -strict experimental -b:a 192k out.mp4
{{ score }}
  # Modify the bitrate, using:
ffmpeg -i $infile -b $bitrate $newoutfile
{{ score }}
  # Vary the Constant Rate Factor, using:
ffmpeg -i $infile -vcodec libx264 -crf 23 $outfile
{{ score }}
  # Change the video screen-size (for example to half its pixel size), using:
ffmpeg -i $infile -vf "scale=iw/2:ih/2" $outfile
{{ score }}
  # Change the H.264 profile to "baseline", using:
ffmpeg -i $infile -profile:v baseline $outfile
{{ score }}
  # Use the default ffmpeg method to process or convert a video:
ffmpeg -i $infile $outfile