Ffmpeg: Difference between revisions

From csml-wiki.northwestern.edu
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 1: Line 1:
= Overview =
= Overview =
Ffmpeg is a powerful tool for handling multimedia files and compiling videos from the command line. It is extremely versatile and allows the user control over many aspects of the encoding process.
[http://ffmpeg.org/ FFmpeg] is a powerful tool for handling multimedia files and compiling videos from the command line. It is extremely versatile and allows the user control over many aspects of the encoding process.


= Mobile Device Compatiblity =
= Mobile Device Compatiblity =
Line 12: Line 12:
'''''Some notes on the above command:'''''
'''''Some notes on the above command:'''''
* compiles .png files named movXXXXX.png, where XXXXX are sequentially numbered strings of 5 digits starting from 00001
* compiles .png files named movXXXXX.png, where XXXXX are sequentially numbered strings of 5 digits starting from 00001
* the -profile:v command, and the accompanying -level command, ensure compatibility with iphone/ipad. Different profiles and levels, as detailed [https://trac.ffmpeg.org/wiki/Encode/H.264 here], can be used which result in varying levels of compatibility and video compression quality.
* the -profile:v command, and the accompanying -level command, ensure compatibility with iPhone/iPad. Different profiles and levels, as detailed [https://trac.ffmpeg.org/wiki/Encode/H.264 here], can be used which result in varying levels of compatibility and video compression quality.
* -pix_fmt yuv420p must be used to ensure that ffmpeg uses a correct color formatting for these devices (''this command should be researched further, esp. for how it relates to video quality'')
* -pix_fmt yuv420p must be used to ensure that FFmpeg uses a correct color formatting for these devices (''this command should be researched further, esp. for how it relates to video quality'')
* -crf (constant rate factor) specifies the compression quality desired (i.e. how lossy your video will be). The command takes a single number between 0 and 51 as an argument, with 0 corresponding to no loss and 51 to the greatest amount of loss. The value 23 is the default, and the range 18-28 contains typical values. A value of 18 is not lossless but should be visually equivalent (or nearly equivalent) to a lossless video. Smaller numbers will result in better quality videos at the expense of larger file sizes.
* -crf (constant rate factor) specifies the compression quality desired (i.e. how lossy your video will be). The command takes a single number between 0 and 51 as an argument, with 0 corresponding to no loss and 51 to the greatest amount of loss. The value 23 is the default, and the range 18-28 contains typical values. A value of 18 is not lossless but should be visually equivalent (or nearly equivalent) to a lossless video. Smaller numbers will result in better quality videos at the expense of larger file sizes.
* -r controls the framerate of the video (frames/second)
* -r controls the framerate of the video (frames/second)


= Links =
= Links =
*[http://ffmpeg.org/ ffmpeg Main Webpage]
*[http://ffmpeg.org/ FFmpeg Main Webpage]
*[https://trac.ffmpeg.org/wiki ffmpeg Wiki]
*[https://trac.ffmpeg.org/wiki FFmpeg Wiki]
*[https://trac.ffmpeg.org/wiki/Encode/H.264 Notes on encoding H.264 video for iphone/ipad compatibility]
*[https://trac.ffmpeg.org/wiki/Encode/H.264 Notes on encoding H.264 video for iPhone/iPad compatibility]

Revision as of 16:16, 22 February 2015

Overview

FFmpeg is a powerful tool for handling multimedia files and compiling videos from the command line. It is extremely versatile and allows the user control over many aspects of the encoding process.

Mobile Device Compatiblity

Media is digested increasingly through mobile phones and tablet devices. Therefore, it is important to be aware of possible compatibility issues when encoding videos for these devices. Here is a command that compiles a series of .png images into a .mp4 video that is compatible with Android and Apple devices (see links at the bottom for more detailed information).

ffmpeg -i mov%5d.png -vcodec libx264 -profile:v baseline -level 3.1 -pix_fmt yuv420p -crf 20 -g 250 -r 20 output.mp4

Some notes on the above command:

  • compiles .png files named movXXXXX.png, where XXXXX are sequentially numbered strings of 5 digits starting from 00001
  • the -profile:v command, and the accompanying -level command, ensure compatibility with iPhone/iPad. Different profiles and levels, as detailed here, can be used which result in varying levels of compatibility and video compression quality.
  • -pix_fmt yuv420p must be used to ensure that FFmpeg uses a correct color formatting for these devices (this command should be researched further, esp. for how it relates to video quality)
  • -crf (constant rate factor) specifies the compression quality desired (i.e. how lossy your video will be). The command takes a single number between 0 and 51 as an argument, with 0 corresponding to no loss and 51 to the greatest amount of loss. The value 23 is the default, and the range 18-28 contains typical values. A value of 18 is not lossless but should be visually equivalent (or nearly equivalent) to a lossless video. Smaller numbers will result in better quality videos at the expense of larger file sizes.
  • -r controls the framerate of the video (frames/second)

Links