当前位置: 动力学知识库 > 问答 > 编程问答 >

c - X264: How to compile x264 with swscale support?

问题描述:

Objective

I am trying to build:

  • an x264 static library (.lib) with swscale support. I would like to use this library in a Visual Studio project where 24-bit RGB bitmap images are:

    1. Converted from RGB to YUV2
    2. The converted image is sent to the x264 encoder
    3. and the output of the encoder is streamed to a remote IP-endpoint via UDP.
  • an x264 executable (.exe) with swscale support. I would like to use the executable for the same purpose as described above. In another Visual Studio project, I will start the x264.exe up as a separate process and pipe bitmap data to the x264 process via its stdin and read out the encoded data from the process's stdout.

Problem

I am having some trouble figuring out how to compile with swscale support. I need swscale support for both the executable and the library.

Status

So far I have downloaded the latest x264 source from the x264 website.

I have installed MINGW on my machine and when I run 'configure' and 'make' I get the x264 static library - but without swscale support.

I haven't been able to find a detailed step-by-step guide on how to include swscale in the x264 library. The closest I've come to a description is this discussion:

http://forum.doom9.org/showthread.php?t=165350

So I downloaded libpack from:

http://komisar.gin.by/mingw/index.html

and extracted it to my harddrive:

Then I executed 'make' and 'configure' (again) in my x264 directory:

./configure --extra-cflags="-I/m/somePath/libpack/libpack/libpack/include" --extra-ldflags="-L/m/somePath/libpack/libpack/libpack/lib"

I have the following in the lib and include directory:

When I execute the above 'configure' I get:

platform: X86

system: WINDOWS

cli: yes

libx264: internal

shared: no

static: no

asm: yes

interlaced: yes

avs: avisynth

lavf: no

ffms: no

mp4: lsmash

gpl: yes

thread: win32

opencl: yes

filters: crop select_every

debug: no

gprof: no

strip: no

PIC: no

bit depth: 8

chroma format: all

You can run 'make' or 'make fprofiled' now.

bash.exe"-3.1$

When I execute 'make' I end up with this error:

gcc.exe: error: unrecognized command line option '-fomit-frame-poin'

gcc.exe: fatal error: no input files

compilation terminated.

make: *** [.depend] Error 1

bash.exe"-3.1$

Question

What am I doing wrong??

网友答案:

A couple of things I would point to:

  • MinGW can sometimes cause compilation issues (because of Windows-based compatibility requirements - I am not saying MinGW is not good). I try to compile on native UNIX system when ever possible.
  • ffmpeg has built in support for swscale. If you cannot find a way to fix your problem you may want to consider using ffmpeg with x264 support. How to compile here or use a static build.
  • ffmpeg libswscale source can be obtained here. You could want to download it and compile x264 with a configure pointing at it.
  • you can always check ./configure --help for more information
网友答案:

1) You can't build "an x264 static library (.lib) with swscale support" because they are separate libraries and should be used together in project not by building one in another. Also you can't build libx264 static library useable by MSVS unless you build with ICL because you will have a lot of problems trying to mix MinGW build libraries (.a) into MSVS projects. I will recommend to use shared library (.dll) in case you want to use libx264 in MSVS project. You can find how to build .lib for libx264.dll using Google.

2) To build x264 executable with swscale support you need to provide x264's configure with path to swscale library and headers which are part of ffmpeg/libav project and build with them.

As for problems while building with komisar's libpack. Your configure command line looks correct but it still didn't configured it with swscale (resize filter is missing from configure output). To find out reason you need to look into config.log file which is created by configure but most likely swscale was outdated (and don't have some API values used by x264) in libpack you used.

As for gcc.exe: error: unrecognized command line option '-fomit-frame-poin' I am dunno from where you get this wrong option because it should be -fomit-frame-pointer but you didn't posted full command line of gcc that resulted in error. May be you specified it somehow yourself (environment CFLAGS) or it is some truncation of command line (too long command line).

分享给朋友:
您可能感兴趣的文章:
随机阅读: