Greetings!
This is my first question here, please be gentle! ;)
So, as the subject line says, I am currently attempting to compile,
install and run
either the libav or ffmpeg media codec suite and then x264 on OpenBSD 5.4,
where x264
is then linked against either libav or ffmpeg. All of this on the
x86_64/AMD64
architecture. x264 itself is a H.264/AVC video trans-/encoder.
So far so good.
The first big problem was the lack of a new enough GNU assembler
("as"/"gas"), as x264
features SSSE3 inline assembly, that gas from binutils 2.15 cannot build.
So I went ahead
and compiled myself my own gas from binutils 2.24, which supposedly worked
fine.
But the real bummer is what follows, and this error even shows up, if I
disable all
assembly optimizations in libav/ffmpeg as well as x264 (then it even
compiles on a stock
5.4 without my new gas 2.24, but won't run).
So, I start my video transcoding, and I get this (leaving out the [info]
lines):
"x264 [error]: malloc of size 8856384 failed
x264 [error]: x264_encoder_encode failed
aborted at input frame 13, output frame 0"
I suspect x264 and not the libav/ffmpeg it was linked against, because 13
input frames
were seemingly decoded by libav/ffmpeg, but not a single output frame was
encoded by x264.
Using older versions of x264/libav (up to 1 year old I tried) results in
the same problem,
only the malloc() size number is different. Like "31736" instead of the
"8856384" above.
Just in case you'd wanna know, this is a sample command line like the one
I called:
"x264 --preset veryslow --tune film --b-adapt 2 --b-pyramid normal -r 3 -f
-2:0 --bitrate 10000 --aq-mode 1 -p 1 --slow-firstpass --stats
framestats.stats -t 2 --no-fast-pskip --cqm flat input.264 -o
pass1output.264"
I tried compiling this with and without assembly, and with both GCC 4.2.1
as well as GCC
4.8.1. The error is always the same.
To learn more, I thought I'd take a look at the x264 port of OpenBSD 5.4,
but found this
in its Makefile, disabling all linking against both libav and ffmpeg as
well as disabling
all assembly (likely due to the binutils/gas issue):
CONFIGURE_ARGS+=--disable-asm \
--disable-ffms \
--disable-gpac \
--disable-lavf \
--disable-swscale \
--enable-static \
--prefix=${PREFIX}
The ffms thing disables linking against ffmpeg, the lavf+swscale stuff
disables linking
against libav. asm is self-explanatory.
So the x264 port (as well as the precompiled package) are completely
crippled. Not only is
the assembly missing, costing tons of performance, but you can't even feed
anything but
raw video to it! What I need is the capability to feed stuff like
H.264/AVC, MPEG2, VC-1
videostreams etc. to x264, so I need libav or ffmpeg.
Now, the main issue is the malloc() failure here. My home-brewn gas
shouldn't be the
problem, because it happens even when compiling from pure C/C++.
My assumption would be, that maybe OpenBSDs libc implementation of
malloc() behaves in
ways that x264 can't handle properly?! I've tried looking at the x264
source coude, but
this stuff is just way beyond me, I don't understand any of the code
really.
I have so far managed to do this on NetBSD, FreeBSD/PC-BSD, MidnightBSD,
Dragonfly BSD,
OpenSolaris, Linux, Windows (CygWin and MinGW/MSYS), MacOS X and even
Haiku OS with
varying degrees of modifications to the build scripts and in one case a
header file.
It drives me crazy I can't figure this out on OpenBSD! ;) I've been trying
this for
months already!
Does anybody have any idea on how I could proceed? I am no developer.. So
yeah. If anybody
would want to take a look at the actual source code, the latest x264
version is available
here:
ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
libav and ffmpeg can be obtained here (I prefer libav, but that's more a
taste thing),
one of them needs to be built first, as x264 needs to be linked against
either of the two:
http://git.libav.org/?p=libav.git;a=snapshot;h=HEAD;sf=tgz
http://www.ffmpeg.org/releases/ffmpeg-2.2.tar.bz2
The x264 trouble seems to originate in one of either "x264.c",
"encoder/encoder.c" or
maybe "common/common.c".
Sorry for this very lengthy post, but I've tried and tried and tried and
failed every
time. When I finally got past the gas problem, I was sooo happy to get it
built, only to
hit this issue at runtime.
I need help here, so if anyone has any idea on how to solve this, it'd be
greatly
appreciated!
Not sure if it would make sense to contact the x264 port maintainer, as
that person seems
to have decided not to try and get it to work "properly" or maybe he hit
the same brick
wall I did and couldn't get past it? Is the issue maybe really not
solvable at all?
If so, I'd like to know and understand why at least.
Well, thanks a lot for any help you might be able to provide, and for
reading my wall of
text!