當前位置:首頁 » 編程軟體 » 如何編譯ffmpeg

如何編譯ffmpeg

發布時間: 2023-06-01 07:27:53

❶ 如何用Android NDK編譯FFmpeg

一、安裝cygwin、配置ndk和下載ffmpeg源碼

這步就不說了,網上很多教程,再次聲明本教程只針對ndk R4這個版本。需要說明的是,本人在cygwin安裝路徑下的.bash_profile文件中指定的NDK路徑如下所示。因為本人裝了好幾個NDK,因此後面的R4隻是個標示。

NDK_R4=/cygdrive/d/android-ndk-r4
export NDK_R4

二、編譯前准備和編譯

1、因為R4這個NDK比較舊,交叉編譯的時候需要在一個Android環境中,那簡單,創建一個Android空項目,把整個項目拷出來,在項目下建立一個文件夾jni,把ffmpeg0.6.6的源碼拷進去。左圖,HelloJni就是我新建的一個項目,Android.mk這時候你還沒有,先不用管。右圖ffmpeg-0.6.6文件夾的內容要跟我一樣,直接就是代碼。我這里的ffmpeg_cywin這個文件夾是隨便建的,放哪裡無所謂的。

2、在ffmpeg-0.6.6下建立一個文件config.sh,內容如下所示。需要注意的是,unix下的換行符和windows下是不一樣,如果直接拷貝到windows下的記事本,後面執行這個config.sh的時候會出問題,這里我用的是notepad++編輯的,在編輯->檔案格式轉換->轉換為UNIX格式。(注意,後面的所有的Android.mk的編輯都有此要求)。

簡單說一下這個config.sh,PREBUILT和PLATFORM根據你安裝ndk的位置而不同,config.sh其實是一個腳本,執行這個腳本的時候又調用了另外一個腳本configure,configure主要是根據編譯選項(下面enable disable那些),生成相應的編譯配置,就是說你想要編譯ffmpeg什麼模塊就自己定製編譯選項的內容。基本上這個文件只要修改一下PREBUILT和PLATFORM就行,其他都不用改。

#!/bin/bash
export PREBUILT=D://android-ndk-r4/build/prebuilt/windows/arm-eabi-4.4.0
export PLATFORM=D://android-ndk-r4/build/platforms/android-8/arch-arm
./configure --target-os=linux \
--arch=arm \
--enable-version3 \
--enable-gpl \
--enable-nonfree \
--disable-stripping \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffserver \
--disable-ffprobe \
--disable-encoders \
--disable-muxers \
--disable-devices \
--disable-protocols \
--enable-protocol=file \
--enable-avfilter \
--disable-network \
--disable-mpegaudio-hp \
--disable-avdevice \
--enable-cross-compile \
--cc=$PREBUILT/bin/arm-eabi-gcc \
--cross-prefix=$PREBUILT/bin/arm-eabi- \
--nm=$PREBUILT/bin/arm-eabi-nm \
--extra-cflags="-fPIC -DANDROID" \
--disable-asm \
--enable-neon \
--enable-armv5te \
--extra-ldflags="-Wl,-T,$PREBUILT/arm-eabi/lib/ldscripts/armelf.x -Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib $PREBUILT/lib/gcc/arm-eabi/4.4.0/crtbegin.o $PREBUILT/lib/gcc/arm-eabi/4.4.0/crtend.o -lc -lm -ldl"
3、修改configure文件,找到下圖的內容,修改成我這樣,這個是用來存放執行腳本過程的臨時文件的,我這里用的是D://NDK,你可以設置其他地方,但是要先創建好這個文件夾,放哪裡無所謂的。

4、然後在cywin中進入ffmpeg0.6.6文件夾,執行chmod -x config.sh,然後執行./config,此過程需要一定的時間。如果這一步出現問題,很有可能是你config.sh中的PREBUILT和PLATFORM的路徑設置不對,或者是你拷貝內容到config.sh的時候沒有在UNIX格式下。執行完如下圖所示。

5、在ffmpeg-0.6.6下會生成一個config.h文件,編輯它,找到#define restrict restrict這一行,把它改成#define restrict

6、在libavutil/libm.h下,把所有static的方法注釋掉或者直接刪掉。

7、修改libavcodec,libavfilter,libavformat,libavutil,libpostproc和libswscale目錄的MakeFile文件,每個文件中,刪除語句

include $( SUBDIR ) ../config.mak 和 include $ (SUBDIR) .. / subdir.mak。

libavcodec下的makefile中搜索inverse.o,把它所在的那一行刪掉,要不編譯的時候會沖突。

8、在ffmpeg-0.6.6文件夾下,創建av.mk文件(UNIX格式),內容如下:

#LOCAL_PATH is one of libavutil, libavcodec, libavformat, or libswscale

#include $(LOCAL_PATH)/../config-$(TARGET_ARCH).mak
include $(LOCAL_PATH)/../config.mak

OBJS :=
OBJS-yes :=
MMX-OBJS-yes :=
include $(LOCAL_PATH)/Makefile

# collect objects
OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
OBJS += $(OBJS-yes)

FFNAME := lib$(NAME)
FFLIBS := $(foreach,NAME,$(FFLIBS),lib$(NAME))
FFCFLAGS = -DHAVE_AV_CONFIG_H -Wno-sign-compare -Wno-switch -Wno-pointer-sign
FFCFLAGS += -DTARGET_CONFIG=\"config-$(TARGET_ARCH).h\"

ALL_S_FILES := $(wildcard $(LOCAL_PATH)/$(TARGET_ARCH)/*.S)
ALL_S_FILES := $(addprefix $(TARGET_ARCH)/, $(notdir $(ALL_S_FILES)))

ifneq ($(ALL_S_FILES),)
ALL_S_OBJS := $(patsubst %.S,%.o,$(ALL_S_FILES))
C_OBJS := $(filter-out $(ALL_S_OBJS),$(OBJS))
S_OBJS := $(filter $(ALL_S_OBJS),$(OBJS))
else
C_OBJS := $(OBJS)
S_OBJS :=
endif

C_FILES := $(patsubst %.o,%.c,$(C_OBJS))
S_FILES := $(patsubst %.o,%.S,$(S_OBJS))

FFFILES := $(sort $(S_FILES)) $(sort $(C_FILES))

9、在jni文件夾下,創建Android.mk(UNIX格式),內容如下:
include $(all-subdir-makefiles)

10、在ffmpeg-0.6.6文件夾下,創建Android.mk,內容如下:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_STATIC_LIBRARIES := libavformat libavcodec libavutil libpostproc libswscale
LOCAL_MODULE := ffmpeg
include $(BUILD_SHARED_LIBRARY)
include $(call all-makefiles-under,$(LOCAL_PATH))

11、在ffmpeg-0.6.6\libavformat下,創建Android.mk,內容如下:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include $(LOCAL_PATH)/../av.mk
LOCAL_SRC_FILES := $(FFFILES)
LOCAL_C_INCLUDES := \
$(LOCAL_PATH) \
$(LOCAL_PATH)/..
LOCAL_CFLAGS += $(FFCFLAGS)
LOCAL_CFLAGS += -include "string.h" -Dipv6mr_interface=ipv6mr_ifindex
LOCAL_LDLIBS := -lz
LOCAL_STATIC_LIBRARIES := $(FFLIBS)
LOCAL_MODULE := $(FFNAME)
include $(BUILD_STATIC_LIBRARY)

12、在ffmpeg-0.6.6\libavcodec下,創建Android.mk,內容如下:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include $(LOCAL_PATH)/../av.mk
LOCAL_SRC_FILES := $(FFFILES)
LOCAL_C_INCLUDES := \
$(LOCAL_PATH) \
$(LOCAL_PATH)/..
LOCAL_CFLAGS += $(FFCFLAGS)
LOCAL_LDLIBS := -lz
LOCAL_STATIC_LIBRARIES := $(FFLIBS)
LOCAL_MODULE := $(FFNAME)
include $(BUILD_STATIC_LIBRARY)

13、在ffmpeg-0.6.6\libavfilter、libavutil、libpostproc和libswscale下,創建Android.mk,內容如下:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include $(LOCAL_PATH)/../av.mk
LOCAL_SRC_FILES := $(FFFILES)
LOCAL_C_INCLUDES := \
$(LOCAL_PATH) \
$(LOCAL_PATH)/..
LOCAL_CFLAGS += $(FFCFLAGS)
LOCAL_STATIC_LIBRARIES := $(FFLIBS)
LOCAL_MODULE := $(FFNAME)
include $(BUILD_STATIC_LIBRARY)
14、然後在jni目錄下,運行$NDK_R4/ndk-build -B,這里的命令需要根據你自己的情況修改,然後就開始編譯了。過程需要10來分鍾,成功之後,會在libs下生產libffmpeg.so。如果編譯出來的libffmpeg.so只有1.5k,得如下修改一下NDK,再重新編譯。

把下面紅色部分加到NDK的build/core/build-binary.mk里:
LOCAL_STATIC_LIBRARIES := $(call strip-lib-prefix,$(LOCAL_STATIC_LIBRARIES))
LOCAL_STATIC_WHOLE_LIBRARIES := $(call strip-lib-prefix,$(LOCAL_STATIC_WHOLE_LIBRARIES))
...
static_libraries := $(call map,static-library-path,$(LOCAL_STATIC_LIBRARIES))
static_whole_libraries := $(call map,static-library-path,$(LOCAL_STATIC_WHOLE_LIBRARIES))
...
$(call mole-add-static-depends,$(LOCAL_MODULE),$(LOCAL_STATIC_LIBRARIES))
$(call mole-add-static-depends,$(LOCAL_MODULE),$(LOCAL_STATIC_WHOLE_LIBRARIES))
...
$(LOCAL_BUILT_MODULE): $(static_libraries) $(static_whole_libraries) $(shared_libraries)
...
$(LOCAL_BUILT_MODULE): PRIVATE_STATIC_LIBRARIES := $(static_libraries)
$(LOCAL_BUILT_MODULE): PRIVATE_WHOLE_STATIC_LIBRARIES := $(static_whole_libraries)
接著再將最外層ffmpeg/Android.mk裡面的LOCAL_STATIC_LIBRARIES改成LOCAL_STATIC_WHOLE_LIBRARIES

❷ 如何用Android NDK編譯FFmpeg

android的NDK開發需要在linux下進行:

  1. 因為需要把C/C++編寫的代碼生成能在arm上運行的.so文件,這就需要用到交叉編譯環境,而交叉編譯需要在linux系統下才能完成。

  2. 安裝android-ndk開發包,這個開發包可以在google android 官網下載: 通過這個開發包的工具才能將android jni 的C/C++的代碼編譯成庫

  3. android應用程序開發環境: 包括eclipse、java、 android sdk、 adt等。

NDK編譯步驟:

a.選擇ndk自帶的例子hello-jni,我的位於E:android-ndk-r5sampleshello-jni(根據具體的安裝位置而定) 。

b.運行cygwin,輸入命令cd /cygdrive/e/android-ndk-r5/samples/hello-jni,進入到E:android-ndk-r5sampleshello-jni目錄。

c.輸入$NDK/ndk-build,執行成功後,它會自動生成一個libs目錄,把編譯生成的.so文件放在裡面。($NDK是調用我們之前配置好的環境變數,ndk-build是調用ndk的編譯程序)

d.此時去hello-jni的libs目錄下看有沒有生成的.so文件,如果有,ndk就運行正常啦。

❸ 怎麼編譯ffmpeg release版本

FFmpeg在Windows系統下的編譯過程,分四步:如下:1.配置編譯環境2.下載FFMPEG的代碼3.編譯,獲取FFMPEG庫(頭文件,lib,和DLL)4.在VC下配置,測試1.配置編譯環境1)安裝MSys下載文件:bash-3.1-MSYS-1.0.11-snapshot.tar.bz2m

❹ 如何把ffmpeg編譯進motion

ffmpeg編譯

首先解壓ffmpeg-0.5.1.tar.bz2,,執行configure命令如下:

[plain] view plain
./configure --cc=arm-linux-gnueabihf-gcc --host-cc=arm-linux-gnueabihf --prefix=/home/***/iWork/common/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux --enable-cross-compile --arch=arm --disable-yasm

編譯:

[plain] view plain
make

出現錯誤如下:

[plain] view plain
arm-linux-gnueabihf-gcc -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I. -I"/home/***/iWork/lamobo/motion-3.2.12-arm-project/ffmpeg-0.5.1"
-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -std=c99 -fomit-frame-pointer -g -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization
-Wpointer-arith -Wrendant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef -O3 -fno-math-errno -fno-signed-zeros -c -o
libavcodec/dsputil.o libavcodec/dsputil.c
/tmp/ccOmDdh7.s: Assembler messages:
/tmp/ccOmDdh7.s:51789: Error: thumb conditional instruction should be in IT block -- `movgt fp,r9'
/tmp/ccOmDdh7.s:51790: Error: thumb conditional instruction should be in IT block -- `movgt r9,r8'
/tmp/ccOmDdh7.s:51792: Error: thumb conditional instruction should be in IT block -- `movle r9,r7'
/tmp/ccOmDdh7.s:51794: Error: thumb conditional instruction should be in IT block -- `movgt fp,r9'
/tmp/ccOmDdh7.s:51889: Error: thumb conditional instruction should be in IT block -- `movgt r9,r8'
/tmp/ccOmDdh7.s:51890: Error: thumb conditional instruction should be in IT block -- `movgt r8,ip'
/tmp/ccOmDdh7.s:51892: Error: thumb conditional instruction should be in IT block -- `movle r8,r6'
/tmp/ccOmDdh7.s:51894: Error: thumb conditional instruction should be in IT block -- `movgt r9,r8'
make: *** [libavcodec/dsputil.o] Error 1
這需要修改~/ffmpeg-0.5.1/config.mak,在OPTFLAGS(line:16)選項中添加:
[plain] view plain
-Wa,-mimplicit-it=thumb
加入這句的意思是在使用Thumb ISA指令編譯時自動產生「IT」指令。 繼續編譯,又報錯:
[plain] view plain
strip: Unable to recognise the format of the input file `ffmpeg'
這是strip沒有使用交叉編譯的版本所致,由於此時我們需要的庫文件已經編成,所以這個錯誤可以忽略不計,修改config.mak中的strip為arm-linux-gnueabihf-strip,繼續讓編譯完成

motion編譯

motion中的ffmpeg.c是對ffmpeg api的封裝,向其他模塊提供功能。如在主程序文件motion.c中

[cpp] view plain
//......

#ifdef HAVE_FFMPEG
/* FFMpeg initialization is only performed if FFMpeg support was found
* and not disabled ring the configure phase.
*/
ffmpeg_init();
#endif /* HAVE_FFMPEG */

//......

這里ffmpeg_init就是ffmpeg.c中封裝的方法:

[cpp] view plain
void ffmpeg_init()
{
motion_log(LOG_INFO, 0, "ffmpeg LIBAVCODEC_BUILD %d LIBAVFORMAT_BUILD %d", LIBAVCODEC_BUILD, LIBAVFORMAT_BUILD);
av_register_all();

#if LIBAVCODEC_BUILD > 4680
av_log_set_callback( (void *)ffmpeg_avcodec_log );
#endif

/* Copy the functions to use for the append file protocol from the standard
* file protocol.
*/
mpeg1_file_protocol.url_read = file_protocol.url_read;
mpeg1_file_protocol.url_write = file_protocol.url_write;
mpeg1_file_protocol.url_seek = file_protocol.url_seek;
mpeg1_file_protocol.url_close = file_protocol.url_close;

/* Register the append file protocol. */
#if LIBAVFORMAT_BUILD >= (52<<16 | 31<<8)
av_register_protocol(&mpeg1_file_protocol);
#else
register_protocol(&mpeg1_file_protocol);
#endif
}
我們需要在motion的Makefile中加入對ffmpeg模塊的編譯,並且打開HAVE_FFMPEG等開關。首先執行configure如下:
[plain] view plain
./configure CC=arm-linux-gnueabihf-gcc --host=arm-linux-gnueabihf --prefix=/home/stewart/iWork/common/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux
生成Makefile,在OBJ選項中添加ffmpeg.o:
[plain] view plain
OBJ = ffmpeg.o motion.o conf.o draw.o jpegutils.o $(VIDEO_OBJ) netcam.o \
netcam_ftp.o netcam_jpeg.o netcam_wget.o track.o \
alg.o event.o picture.o rotate.o webhttpd.o \
webcam.o

在CFLAGS選項中添加-DHAVE_FFMPEG -DFFMPEG_NEW_INCLUDES -DHAVE_FFMPEG_NEW的定義,加入libjpeg頭文件搜索目錄

[plain] view plain
libdir = ${prefix}/lib
incdir = ${prefix}/include

[plain] view plain
CFLAGS = -g -O2 -DHAVE_FFMPEG -DFFMPEG_NEW_INCLUDES -DHAVE_FFMPEG_NEW -D_REENTRANT
-DMOTION_V4L2 -DMOTION_V4L2_OLD -DTYPE_32BIT="int" -DHAVE_BSWAP -Wall
-DVERSION=\"3.2.12\" -Dsysconfdir=\"$( sysconfdir)\"
在LIBS中加入對ffmpeg庫的支持:
[plain] view plain
LIBS = -L${libdir} -static -lavformat -lavcodec -lavutil -ljpeg -lm -lpthread

預備工作完成,make,編譯報錯:

[plain] view plain
motion.h:44:28: fatal error: linux/videodev.h: No such file or directory
compilation terminated.

由於linux-2.4以上的內核已經取消了videodev.h文件,需要安裝libv4l-dev,然後將motion.h,video.h中的

[plain] view plain
#include <linux/videodev.h>

修改為

[cpp] view plain
#include <libv4l1-videodev.h>

繼續,又報錯:

[plain] view plain
track.c: In function 『uvc_center』:
track.c:587:29: error: storage size of 『control_s』 isn』t known
track.c:589:24: error: 『V4L2_CID_PRIVATE_BASE』 undeclared (first use in this function)
track.c:589:24: note: each undeclared identifier is reported only once for each function it appears in
track.c:592:24: error: 『VIDIOC_S_CTRL』 undeclared (first use in this function)
track.c:601:31: error: storage size of 『queryctrl』 isn』t known
track.c:605:24: error: 『VIDIOC_QUERYCTRL』 undeclared (first use in this function)
track.c:601:31: warning: unused variable 『queryctrl』 [-Wunused-variable]
track.c:587:29: warning: unused variable 『control_s』 [-Wunused-variable]
track.c:636:25: error: storage size of 『control_s』 isn』t known
track.c:636:25: warning: unused variable 『control_s』 [-Wunused-variable]
track.c: In function 『uvc_move』:
track.c:724:29: error: storage size of 『control_s』 isn』t known
track.c:726:24: error: 『V4L2_CID_PRIVATE_BASE』 undeclared (first use in this function)
track.c:729:24: error: 『VIDIOC_S_CTRL』 undeclared (first use in this function)
track.c:724:29: warning: unused variable 『control_s』 [-Wunused-variable]
track.c:779:25: error: storage size of 『control_s』 isn』t known
track.c:779:25: warning: unused variable 『control_s』 [-Wunused-variable]
make: *** [track.o] Error 1
在track.c中添加:
[plain] view plain
#include <linux/videodev2.h>
繼續,報錯(怎麼還有啊?):
[plain] view plain
gcc -L/usr/local/lib -o motion motion.o conf.o draw.o jpegutils.o video.o video2.o video_common.o netcam.o netcam_ftp.o netcam_jpeg.o netcam_wget.o track.o alg.o event.o picture.o rotate.o webhttpd.o webcam.o ffmpeg.o -lm -lpthread -ljpeg -L/usr/local/lib -lavformat -lavcodec -lavutil -lm -lz
/usr/local/lib/libavformat.a(file.o):(.data+0x60): multiple definition of `file_protocol'
ffmpeg.o:(.data+0x0): first defined here
collect2: ld returned 1 exit status
原來結構體file_protocol在libavformat.a和ffmpeg.o中重復定義了,分別打開兩個定義:
[cpp] view plain
//libavformat/file.c:85
URLProtocol file_protocol = {
"file",
file_open,
file_read,
file_write,
file_seek,
file_close,
};
[cpp] view plain
//ffmpeg.c
URLProtocol file_protocol = {
"file",
file_open,
file_read,
file_write,
file_seek,
file_close,
#if LIBAVFORMAT_BUILD >= (52<<16 | 31<<8)
NULL,
NULL,
NULL,
#endif
};

將libavformat/file.c中的file_protocol定義注掉,重新編譯一份libavformat.a。然後繼續編譯motion,又報錯:

[plain] view plain
/home/xxx/iWork/Thrid_party/ffmpeg-0.5.1/libavformat/matroskadec.c:917: undefined reference to `BZ2_bzDecompressInit'
/home/xxx/iWork/Thrid_party/ffmpeg-0.5.1/libavformat/matroskadec.c:926: undefined reference to `BZ2_bzDecompress'
/home/xxx/iWork/Thrid_party/ffmpeg-0.5.1/libavformat/matroskadec.c:929: undefined reference to `BZ2_bzDecompressEnd'
這個需要libbz2庫,下載地址http://www.bzip.org/downloads.html
編譯安裝libbz2後將-lbz2加入motion的Makefile的LIBS選項:

[plain] view plain
LIBS = -lpthread -ljpeg -L/usr/lib -lavformat -lavcodec -lavutil -lm -lz -lbz2

❺ FFmpeg之Linux下編譯與調試

下面的一切都是在 root 模式下進行的,可以不再 root 模式下進行

基礎環境就是編譯代碼的基礎庫,Ubuntu聯網安裝軟體很簡單,一個語句即可搞定,這里列出語句如下:

依賴庫分兩方面,參考以下網站列出的依賴庫信息,本文選擇的版本均參考於此網頁: FFmpeg依賴庫信息

首先創建 FFmpeg 代碼目錄,所有的源代碼放在這個目錄下

FFmpeg 編譯之後,即可使用。編譯生成的可執行程序在 ~/bin 目錄下

註:上面的 ./configure 配置編譯後並不能進行調試,需要如下配置.

剛才的工程可以運行,但不能debug。解決此問題,首先認定一點,生成的可執行程序中,ffmpeg 不包含調試信息,調試信息在 ffmpeg_g 中,debug 要選擇 ffmpeg_g。

另外,./config選項也是確定包含調試信息的核心,需要在config中添加:

採用以下命令重新config:

一些注意事項; 在使用 ffplay 播放生成 h264 格式的視頻時,播放速度會加快,解決方式:不要使用 FFmpeg 轉碼生成純 h264 格式的視頻,要使用一種容器包含 h264 視頻,即生成一種音視頻流格式,也就是不要生成純粹的 h264 碼流,而是生成諸如 mkv 等格式的文件。

❻ ios 怎麼配置編譯ffmpeg

IOS上編譯ffmpeg需要先下載兩個程序:iFrameExractor和ffmpeg
編譯步驟:
1、在終端下: cd /iFrameExtractor/ffmpeg 建議開始就執行 sudo -s (獲取許可權命令)
2、在終端下輸入 ./configure --prefix=/iFrameExtractor/ffmpeg --libdir=iFrameExtractor/ffmpeg/lib --enable-gpl --enable-static --disable-shared --enable-swscale --enable-zlib --enable-bzlib --disable-ffmpeg --disable-ffplay --disable-ffserver --enable-pthreads
3、執行make 這里會有一堆的編譯情況。
註:最好先升級Command Line Tools,避免編譯錯誤

4、執行make install。 (執行完後 到iFrameExtractor/ffmpeg/lib文件上去看看)
出現 libavcodec libavdevice libavformat libavutil libswscale5個.a文件
5、用xcode 打開iFrameExractor工程,確認Header Search Paths里有:"$(SRCROOT)/ffmpeg"路徑。 $(SRCROOT)表示工程路徑。同時可以看到iFrameExractor工程下ffmpeg文件下的.a文件都不是紅色的了。

6、真機上編譯(模擬器上i386,真機上是arm的,真機還分arm6 和arm7 )
以下是針對arm7的

/configure --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver --enable-cross-compile --arch=arm --target-os=darwin --cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc --as='gas-preprocessor/gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' -- sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk --cpu=cortex-a8 --extra-cflags='-arch armv7' --extra-ldflags='-arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk' --enable-pic
7、執行 make 和make install 就有上面的幾個.a文件,至此編譯結束。

❼ 如何編譯wince平台能使用的ffmpeg庫

如何編譯wince平台能使用的ffmpeg庫

  • 在configure ffmpeg工程時,如果不特別指定,默認fdshow設備是被支持的,但編譯後卻沒有.可以查看configure的日誌文件,會發現找不到一些依賴的頭文件.

  • 所以最終編譯出來的ffmpeg.exe, 用ffmpeg -formats來看,在indev一項中,一般只有vfwcap,而沒有dsh

❽ 如何使用ndk編譯ffmpeg靜態庫

如何使用ndk為ffmpeg編譯rtmp+polarssl靜態庫?這個問題花了我整整一天時間。其中遇到很多小問題,這里記錄一下,方便自己也方便其他人。

1、編譯polarssl,查看其Readme文件即可,不需要configure,只需要make時帶上必要的參數即可,不過要記得在每一次執行make命令時都帶上CC的參數(指向你的arm gcc),因為我試過在make install時沒有帶上CC的參數,雖然能編譯出polarssl但是未能正確被rtmp引用到。

2、因為前面我用的polarssl是當前最新(1.3.7)版本,而librtmp使用的好像是polarssl1.0.0以下版本的api,所以需要修改rtmp部分源碼,讓其調用新版polarssl的api,這里的修改可以參照《Migrating from PolarSSL-1.2 to the PolarSSL 1.3 branch》和《[rtmpmp] branch master updated. a312ac7 Fix compat with PolarSSL >= 1.1.0》。

3、出現 undefined reference to `havege_random』錯誤,這里是因為polarssl默認關閉了havege模塊,需要你手動開啟,主要就是修改include/polarssl/config.h,去掉POLARSSL_HAVEGE_C前的注釋,也就是要定義POLARSSL_HAVEGE_C,如下:
#define POLARSSL_HAVEGE_C

4、在編譯出上面兩個庫之後,可以開始編譯ffmpeg(2.1.1版本)了,如果遇到下面的問題 check_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
ERROR: librtmp not found
這里有三種解決方法:
第一種,因為是網路上傳播最多的,算是比較簡便的方法,就是修改ffmpeg的configure,將以下一行:
enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
改為:
enabled librtmp && require librtmp librtmp/rtmp.h RTMP_Socket -lrtmp -lpolarssl -lz
或者直接注釋掉&& *** 部分,然後再自己加上librtmp的庫路徑也行

第二種,(比較推薦,因為解決了這個會順帶解決大部分找不到庫的錯誤!)因為這里使用了pkg-config工具查找庫,而這個工具ndk並沒有附帶提供,而出現check_pkg_config相關錯誤的話,只要稍加註意,會發現在使用configure配置ffmpeg的交叉編譯時,已經有相應的pkg-config不存在的警告了。我對這個工具不熟悉,所以我只是簡單地加上了一個軟鏈接到系統的pkg-config,如下:
ln -s /usr/bin/pkg-config /home/cidy0106/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-pkg-config
這個時候重新configure的話可能會出現找不到polarssl庫的錯誤提示,需要修改一下librtmp安裝目錄里的librtmp.pc,把以下內容:
Libs: -L${libdir} -lrtmp -lz
改為:
Libs: -L${libdir} -lrtmp -lz -lpolarssl

至此,就可以正確編譯出ffmpeg了
轉載

熱點內容
密碼鎖寫什麼最好 發布:2025-05-15 19:05:31 瀏覽:782
5的源碼是 發布:2025-05-15 19:04:07 瀏覽:719
c語言創建的源文件 發布:2025-05-15 18:54:08 瀏覽:611
3個數字密碼鎖有多少種 發布:2025-05-15 18:49:48 瀏覽:684
壓縮包手機打開 發布:2025-05-15 18:37:34 瀏覽:217
安卓取消耳機模式怎麼取消 發布:2025-05-15 18:24:24 瀏覽:59
氣球怎麼解壓視頻 發布:2025-05-15 18:20:00 瀏覽:783
電腦軟體密碼怎麼設置密碼 發布:2025-05-15 18:09:07 瀏覽:107
android應用是否運行 發布:2025-05-15 18:02:40 瀏覽:10
java排序list 發布:2025-05-15 18:02:40 瀏覽:298