Question

I am trying to build x264 from source on Ubuntu 32bit in order to convert a sequence of jpg or png images into mp4 video: x264 site, sample images

The downloaded binaries is able to convert the sequence into an mkv video (or few other formats) when I run this command:

./x264dist ~/Dev/x264emp/img/FLYOVER%4d.JPG -o abc.mkv

x264dist is the renamed name of the binary I download from the site.

However, when I grab the source and compile with simple configure:

$ ./configure --enable-shared --enable-static --enable-pic

platform:      X86
system:        LINUX
cli:           yes
libx264:       internal
shared:        yes
static:        yes
asm:           yes
interlaced:    yes
avs:           avxsynth
lavf:          no
ffms:          no
mp4:           no
gpl:           yes
thread:        posix
opencl:        yes
filters:       crop select_every 
debug:         no
gprof:         no
strip:         no
PIC:           yes
bit depth:     8
chroma format: all

then $ make. Then I use the binaries to run the exactly same command as above but there is this error:

./x264 ~/Dev/x264emp/img/FLYOVER%4d.JPG -o abc.mkv
raw [error]: raw input requires a resolution.
x264 [error]: could not open input file `/home/tmd/Dev/x264emp/img/FLYOVER%4d.JPG' via any method!

It seems like it can't read any input at all. But at least I am still able to run --help on that binaries.

Then I realized that the downloaded binaries is 3.5Mb while my custom compilation results in 1.5Mb binaries.

So I just want to know what are the build configurations used by the official build, and/or is there any dependency I am missing that leads to this problem.

The reason I am trying to build myself because I want to port the x264 lib into Javascript using Emscripten. There has been a solution using FFmpeg but it seems like I don't need the whole video processing library but only a simple H264 codec. So I need to solve the configure/compile/linking problem to port it rightly.

Possibly similar https://stackoverflow.com/questions/19445075/how-to-configure-x264-build-before-running-make-on-os-x

Was it helpful?

Solution

It can't read from your input because you compiled it without lavf support: lavf: no so it can take only raw yuv and y4m files as input (I doubt you have avxsynth installed).

To compile x264 with lavf you need to have ffmpeg/libav libraries installed and be in gcc search path or you will need to provide path for them in configure by using something like this:

--extra-cflags="-I/usr/local/include" --extra-ldflags="-L/usr/local/lib"

Also you may need to compile ffmpeg/libav yourself because x264 need new enough libraries and may refuse to use one from prebuild repos. x264 is written to use versions from master branch of ffmpeg/libav and may not work with stable branches that don't have needed new APIs. So if you think that you have all needed libraries installed than look into config.log file to find out why x264 refused to link with them.

OTHER TIPS

I think you need to either build a static library or a shared library, I'm not sure what should happen when you enable both.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top