How to install FFmpeg on Mac OS X(转)

FFmpeg-Logo.svg

This post is going to be to show you how to install FFmpeg on Mac OS X as easy as possible. For that, i will use a software called “Homebrew”. It is a linux like package manager with a lot of useful tools easy to install from it. It is quite similar to MacPorts, but in this special case you will get a more recent FFmpeg using Homebrew thanMacPorts. Once you are familiar with Homebrew, i am sure you will use it a lot more afterwards if you are not using already.

Install/Update Xcode

To be able to use Homebrew you need the Xcode Command Line Tools. Follow these steps to install it:

1. Open “Mac App Store” and install Xcode. If you have XCode already installed, update to the latest version available if necesary.

2. After Xcode has been successfully installed, open the Xcode Preferences-Pane.

3. Select the “Downloads”-Tab and click on “Install” next to the “Command Line Tools” entry.

XCode Downloads-Pane

 

The time i am writing this Tutorial i have already installed the Xcode Command Line Tools, even if not in the latest version, which i will correct later on my system. But, this is also good for you as you can see what to install if i tell you that on your system will be an “Install”-Button where is an “Update”-Button on the provided screenshot.

 

Install Homebrew

Installing Homebrew is quite simple. Everything you need to do is to open up a Terminal window, paste and execute the following command and follow the instructions during the installation process.

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

After successful installation you should execute:

brew doctor

This checks if your Homebrew installation was successful and installation of Formulas (Packages) will work. If you have any trouble please drop me a note in the comments section.

Install FFmpeg

Now we are nearly done as all prerequisites are now installed and we can start installing FFmpeg. As there are many options when installing FFmpeg, a command you should know about is brew options <Formula> . This will show you all available options for the fromula you are going to install which will be in this case “ffmpeg”. So in our case, brew options ffmpeg will print the following information to your screen:

1
2
3
4
5
6
7
8
reneVolution$ brew options ffmpeg
--with-fdk-aac
    Enable the Fraunhofer FDK AAC library
--with-ffplay
    Enable FFplay media player
--with-freetype
    Build with freetype support

To finally install FFmpeg on your system you should follow these steps:

1. Check if your Homebrew installation is up to date and working with brew doctor

2. Check all available options for ffmpeg with brew options ffmpeg

3. Install ffmpeg with all desired options with brew install ffmpeg [all youroptions]

Example:

To install FFmpeg with all available options without disabling anything execute:

1
brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libass --with-libvo-aacenc --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-opus --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools

If you are running into any troubles during installation please leave a message in the comments section.

Afterwards FFmpeg should be installed and you can start enjoy to use it.

If you prefer to work with FFmpeg on your Windows machine, read my article How to get the latest FFmpeg binaries for Windows.

Android缺乏手势问题

近来研究Android,发现里面有ScaleGestureDetector,竟然没有RotateGestureDetector。只能搜索到第三方的:

通过Guesture方法实现Rotate

Android multitouch gesture detectors


https://github.com/Almeros/android-gesture-detectors

直接再View上实现Rotate
https://github.com/MikeOrtiz/TouchImageView
https://github.com/jasonpolites/gesture-imageview
https://github.com/codepanda-ch/android-gestureimageview

官方的Scale例子
http://developer.android.com/training/gestures/scale.html

Android texture限制问题

问题描述:今天开发Make Face,调试时发现程序突然挂了,也没有报错。看了LogCat,看到如下log:
Bitmap too large to be uploaded into a texture (3264x2448, max=2048x2048)
问题分析:硬件加速的时候,对图片的大小有限制。不同设备可能有不同的最大值。
问题解决:方法有两种
第一种:关闭硬件加速
1.Application级别

<application android:hardwareAccelerated="true" ...>

2.Activity级别

<application android:hardwareAccelerated="true">
    <activity ... />
    <activity android:hardwareAccelerated="false" />
</application>

3.Window级别

getWindow().setFlags(
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);

4.View级别

myView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

第二种:使用BitmapRegionDecoder加载
http://developer.android.com/reference/android/graphics/BitmapRegionDecoder.html

Android的icon设计

应用程序图标 (Icon)应当是一个 Alpha 通道透明的32位 PNG 图片。由于安卓设备众多,一个应用程序图标需要设计几种不同大小,如:
LDPI (Low Density Screen,120 DPI),其图标大小为 36 x 36 px。
MDPI (Medium Density Screen, 160 DPI),其图标大小为 48 x 48 px。
HDPI (High Density Screen, 240 DPI),其图标大小为 72 x 72 px。
xhdpi (Extra-high density screen, 320 DPI),其图标大小为 96 x 96 px。

Android中的R.class

大家都知道R.class总是出问题,现在我来总结下问题,并如何排除。

一般问题:
1.在xml文件中代码错误或者格式错误
2.布局文件的文件名有大写字母
3.含有相同文件名、格式的xml文件

解决方法:
首先肯定是找到出错的原因并改正,然后可以执行以下任何一个方法更新R文件。
1.先执行project—clean,再执行Project--Build Automaticaly
2.右击你的工程(项目)——>Android Tools——>Fix Project Properties
3.修改string.xml,随便改动一下,可更新R文件