Forum archive - x264 doesn't encode h.264

http://www.supermediastore.com/



Forum Archive Home -> Mac -> x264 doesn't encode h.264



x264 doesn't encode h.264

thuriel posted 2009 Oct 16 06:46
Hi!

I already was searching for a solution to this problem. There are many posts all over the internet with the same problem but no solution.

So maybe you could help me.

Whenever I try to use x264 to encode a video with ffmpeg an my Snow Leopard MacBook 1,1 ffmpeg stops and tells me:

:
Error while opening encoder for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height


The parameters don't seem to affect this. No matter what I do, the error remains. For example
:
-vcodec libx264 -b 1024k
results in the above error. Even
:
-vcodec copy
leads to the error (if the source is H.264/AVC of course).

I compiled ffmpeg and x264 by my own.

For x264 I used the snapshot of "x264-snapshot-20090926-2245" but even with the latest one (x264-snapshot-20091015-2245) I had the same problems. I had to use the
:
--disable-asm
configure option.

The version and configure options amoung other information regarding ffmpeg you may see here:

:
$ ffmpeg -version
FFmpeg version SVN-r20028, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  built on Oct 16 2009 03:31:04 with gcc 4.2.1 (Apple Inc. build 5646)
  configuration: --enable-pthreads --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-gpl --enable-libxvid --enable-libx264 --enable-nonfree --enable-libfaac --enable-libfaad
  libavutil     50. 3. 0 / 50. 3. 0
  libavcodec    52.36. 0 / 52.36. 0
  libavformat   52.39. 0 / 52.39. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libswscale     0. 7. 1 /  0. 7. 1
FFmpeg SVN-r20028
libavutil     50. 3. 0 / 50. 3. 0
libavcodec    52.36. 0 / 52.36. 0
libavformat   52.39. 0 / 52.39. 0
libavdevice   52. 2. 0 / 52. 2. 0
libswscale     0. 7. 1 /  0. 7. 1


I don't know why it worked on Leopard. I don't know what I did differently back then :/



rumplestiltskin posted 2009 Oct 16 10:00
I don't suppose you'd want to use the H264 encoding already built in to your Mac? Try MPEG Streamclip, VideoMonkey or even QuickTime Player Pro (7).


thuriel posted 2009 Oct 16 10:39
Yeah, you're right. Thank you, but I'd like to use ffmpeg (I wrote some scripts that rely on ffmpeg). And what bothers me...it worked before (on Leopard). Did I miss some dependencies (I did a clean install of Snow Leopard)? But I don't remember installing anything else than x264 and ffmpeg to encode H.264 video with ffmpeg on Leopard :/


rumplestiltskin posted 2009 Oct 16 10:52
I think your problem might be with the interaction of SL and ffmpeg. Who knows what Apple may have changed between L & SL? I think you're correct in your installation assumption (nothing extra should be needed).

However, I just noticed that you compiled ffmpeg & x264 yourself. Have you tried using the pre-compiled versions instead? If they work, maybe it's something that went awry in the compiling.



thuriel posted 2009 Oct 16 12:43
Now I tried the ffmpeg binary from the lates ffmpegX release. That one seems to work though of course linking to its own libs inside the ffmpegX bundle. Not really what I want :/

I discovered, that there is no "libx264.dylib" in /usr/local/lib/ (only the "libx264.a"). Therefore otool returned no dynamic lib for x264.

So! Hoping that was the reason for my problem I recompiled x264 with --enable-shared. Like I expected, it built the .dylib (what seems to be Mac OS X's equivalent to Linux's .so?).

After recompiling ffmpeg as well, otool gives me:

:
$ otool -L /usr/local/bin/ffmpeg
/usr/local/bin/ffmpeg:
   /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
   /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
   /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 123.0.0)
   /usr/local/lib/libfaac.0.dylib (compatibility version 1.0.0, current version 1.0.0)
   /usr/local/lib/libfaad.2.dylib (compatibility version 3.0.0, current version 3.0.0)
   /usr/local/lib/libmp3lame.0.dylib (compatibility version 1.0.0, current version 1.0.0)
   /usr/local/lib/libtheora.0.dylib (compatibility version 4.0.0, current version 4.10.0)
   /usr/local/lib/libogg.0.dylib (compatibility version 7.0.0, current version 7.0.0)
   /usr/local/lib/libvorbisenc.2.dylib (compatibility version 3.0.0, current version 3.6.0)
   /usr/local/lib/libvorbis.0.dylib (compatibility version 5.0.0, current version 5.3.0)
   /usr/local/lib/libx264.76.dylib (compatibility version 0.0.0, current version 0.0.0)


Cool, but doesn't help at all. Same problem :/

But! The compatibility version as well as the current version looks interesting for libx264 o_O



rumplestiltskin posted 2009 Oct 16 13:22
You're now going down such a technical route that the adhesive tape holding my glasses together has fallen off.
*grin*
:D

I'll have to defer to others who may understand this techno-babble better than I.



houdini2 posted 2009 Oct 16 13:53
Add --arch=x86_64 in ./configure

houdini :wink:



thuriel posted 2009 Oct 16 18:07
@rumplestiltskin: *lol* ...but thank you anyway! :)

@houdini2: I tried this. Same error message :/ ...but as far as I know the CPU in the first generation MacBooks (like mine) is 32bit, so I think the correct configure option is --arch=i386, which is the default :\



Herve posted 2009 Oct 19 04:31
my configure command, used for SnowLeopard:
"./configure --enable-postproc --enable-gpl --enable-pthreads --enable-static --disable-shared --enable-gray --enable-avfilter --enable-avfilter-lavf --enable-libx264 --extra-cflags=-m64 --extra-ldflags=-m64 --arch=x86_64"

bye

Edit: oops I didn't see that your processor wasn't 64bit, so -normally- you don't need to specify anything special (32bit is the default behavior)…



thuriel posted 2009 Oct 20 14:09
Thank you all. I'm a bit confused about all the error messages I get. At least I could find the reason for the error I described above:

Obviously I have to use a preset for encoding with x264 (in Leopard I was able to encode without this). For example:

:
-vpre hq


So, with the preset setting I can encode with x264. But that actually isn't (all) what I want to do, because my source file already is encoded in H.264. Even the audio stream already is encoded in the codec of my choice: AC3. I just want to change the container from MKV to MP4:

:
$ ffmpeg -i video.mkv -vcodec copy -acodec copy video.mp4


but, what I get is a similar error message to the above one:

:
Could not write header for output file #0 (incorrect codec parameters ?)


Does ffmpeg fail in putting AC3 into the MP4 container? I know, initially MP4 did not support AC3 streams, but over a year ago they officially allowed AC3 to be enclosed in an MP4 (see http://en.wikipedia.org/wiki/Comparison_of_container_formats). So I expect ffmpeg to be aware of that and fulfill my wish! :D

Do I have to to specify any parameters to pack AC3 into MP4?

Because this is off topic, I opened another thread: http://forum.videohelp.com/topic374557.html




Login/Register to our forum to be able to post here.








VSO Software ConvertXtoDVD lets you convert any video like AVI,MKV to DVD easily. More info or download trial!
About   Advertise   Forum Archive   RSS Feeds   Statistics