ffmpeg should be installable from apt with x264/h264 support without users needing to recompile it

Asked by Rory McCann

Binary package hint: ffmpeg

I believe the current version of ffmpeg and x264 in apt are missing a feature. Users are frequently advised to recompile ffmpeg & x264 from source if they want some features. There is even a popular guide on ubuntu forums for recompiling the software (http://ubuntuforums.org/showthread.php?t=786095). Users on the ffmpeg mailing list are pointed to this. The ubuntu wiki contains guides on how to 'fix' ffmpeg (https://help.ubuntu.com/community/iPodVideoEncoding#Fixing ffmpeg on Ubuntu)

If a guide starts with "First remove the packages from apt, then recompile", then there is something wrong with the packages in apt.

Both ffmpeg and x264 are packaged in ubuntu (http://packages.ubuntu.com/search?keywords=x264 and http://packages.ubuntu.com/search?keywords=ffmpeg). Is there not some way to make a package that users can install instead of requiring them to recompile software?

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: ffmpeg 4:0.5.1-1ubuntu1
ProcVersionSignature: Ubuntu 2.6.32-24.41-generic 2.6.32.15+drm33.5
Uname: Linux 2.6.32-24-generic i686
Architecture: i386
Date: Wed Sep 1 11:20:47 2010
ProcEnviron:
 PATH=(custom, user)
 LANG=en_IE.utf8
 SHELL=/bin/bash
SourcePackage: ffmpeg

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu ffmpeg Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Rory McCann (rorymcc) said :
#1
Revision history for this message
Reinhard Tartler (siretart) said :
#2

the correct fix is to install the package 'ubuntu-restricted-extras', which will install 'libavcodec-extra-52' as dependency. This package is linked against libx264 and therefore capable to encode to h264.

Revision history for this message
Rory McCann (rorymcc) said :
#3

I installed the ubuntu-restricted-extras package, as you suggested, and I still have the same problem. I am currently following the ubuntu forums guide to recompile ffmpeg & x264 to see if that fixes my problem.

For the record the command I am trying to do:

ffmpeg -i './file.vob' -f mpegts -acodec libmp3lame -ar 48000 -ab 64000 -vcodec x264 -b 800000 -flags +loop -cmp +chroma -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 200k -maxrate 800000 -bufsize 800000 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect 320:240 -g 30 -async 2 test.ts

and the output is:

FFmpeg version SVN-r24342, Copyright (c) 2000-2010 the FFmpeg developers
  built on Jul 20 2010 09:23:37 with gcc 4.4.1
  configuration: --prefix=/usr --enable-pthreads --enable-shared --extra-cflags=-fPIC --enable-gpl
  libavutil 50.22. 0 / 50.22. 0
  libavcodec 52.84. 0 / 52.84. 0
  libavformat 52.75. 0 / 52.75. 0
  libavdevice 52. 2. 0 / 52. 2. 0
  libavfilter 1.25. 1 / 1.25. 1
  libswscale 0.11. 0 / 0.11. 0
Input #0, mpeg, from './Lucozade - Dawn of the De-ad.vob':
  Duration: 00:00:39.53, start: 137.786967, bitrate: 8491 kb/s
    Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 720x480 [PAR 8:9 DAR 4:3], 7000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0.1[0xa0]: Audio: pcm_s16be, 48000 Hz, 2 channels, s16, 1536 kb/s
Unknown encoder 'x264'

I have tried the above command with "-vcodec libx264", "-vcodec h264" and "-vcodec libh264", all give the same error.

I am trying to make some files for HTTP Streaming as suggested here: http://www.ioncannon.net/programming/452/iphone-http-streaming-with-ffmpeg-and-an-open-source-segmenter/

Revision history for this message
Rory McCann (rorymcc) said :
#4

I have recompiled according to the ubuntu forums guide. That solved my problem. installing ubuntu-restricted-extras didn't.

Revision history for this message
Reinhard Tartler (siretart) said :
#5

> I have tried the above command with "-vcodec libx264", "-vcodec h264"
> and "-vcodec libh264", all give the same error.

-vcodec libx264 is the only correct parameter

> I am trying to make some files for HTTP Streaming as suggested here:
> http://www.ioncannon.net/programming/452/iphone-http-streaming-with-
> ffmpeg-and-an-open-source-segmenter/
>
> In other words, installing ubuntu-restricted-extras does not fix the
> problem, removing the package and recompiling does fix the problem

please state the exact version of the package libavcodec-extra-52, that
you have installed.

Revision history for this message
llogan (loul) said :
#6

As Reinhard mentioned, you need to install libavcodec-extra-52 if you want to enable libx264 in the repository FFmpeg, or you can compile FFmpeg as you have.

As for your command, it is invalid and uses the outdated method of encoding with libx264. Also, your compiled FFmpeg did not have --enable-libx264 as a ./configure option. See the FFmpeg compiling guide on Ubuntuforums [1] or the FFmpeg x264 encoding guide [2] for some proper encoding examples.

[1] http://ubuntuforums.org/showthread.php?t=786095
[2] http://rob.opendot.cl/index.php/useful-stuff/ffmpeg-x264-encoding-guide/

Revision history for this message
Rory McCann (rorymcc) said :
#7

The version of libavcodec-extra-52 is "4:0.5+svn20090706-2ubuntu3". I reported this bug on my lucid desktop (so I could use ubuntu-bug), however the server doing the encoding is karmic. ('ubuntu-restricted-extra' is at version 36).

LouL, I installed libavcodec-extra-52 and that didn't fix it. I think it should be possible to use ffmpeg without recompilation.

Revision history for this message
Reinhard Tartler (siretart) said :
#8

Please paste the command line that you've used and didn't work for you. This does work for me with libavcodec-extra-52 installed:

>> ffmpeg -i ubuntu-uploads.ogv -vpre libx264-fast -sameq -vcodec libx264 foo.mp4

Revision history for this message
Rory McCann (rorymcc) said :
#9

The command I'm using is:

ffmpeg -i './file.vob' -f mpegts -acodec libmp3lame -ar 48000 -ab 64000 -vcodec libx264 -b 800000 -flags +loop -cmp +chroma -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 200k -maxrate 800000 -bufsize 800000 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect 320:240 -g 30 -async 2 test.ts

Revision history for this message
Reinhard Tartler (siretart) said :
#10

please also paste the full output of this command.

Revision history for this message
Rory McCann (rorymcc) said :
#11

Sorry, the output is: (NoteL: it's above aswell)

FFmpeg version SVN-r24342, Copyright (c) 2000-2010 the FFmpeg developers
  built on Jul 20 2010 09:23:37 with gcc 4.4.1
  configuration: --prefix=/usr --enable-pthreads --enable-shared --extra-cflags=-fPIC --enable-gpl
  libavutil 50.22. 0 / 50.22. 0
  libavcodec 52.84. 0 / 52.84. 0
  libavformat 52.75. 0 / 52.75. 0
  libavdevice 52. 2. 0 / 52. 2. 0
  libavfilter 1.25. 1 / 1.25. 1
  libswscale 0.11. 0 / 0.11. 0
Input #0, mpeg, from './file.vob':
  Duration: 00:00:39.53, start: 137.786967, bitrate: 8491 kb/s
    Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 720x480 [PAR 8:9 DAR 4:3], 7000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0.1[0xa0]: Audio: pcm_s16be, 48000 Hz, 2 channels, s16, 1536 kb/s
Unknown encoder 'x264'

Revision history for this message
Reinhard Tartler (siretart) said :
#12

the pasted output does not match to the pasted command line. in the
commandline you've indicated -vcodec libx264, still the error message
says 'x264'. this just doesn't make any sense.

moreover, it seems you're not using the packaged version of ffmpeg, but
a self compiled one that identifies as "FFmpeg version SVN-r24342".

Revision history for this message
Rory McCann (rorymcc) said :
#13

I have tried all of x264/libx264/h264/libh264. I only copy & pasted the last attempt (x264), i changed the command to be libx264, but forgot to change the output. Believe me, the output is the same.

I have uninstalled the ffmpeg and recompiled now and will probably not have access to this box for a while, so I can't look at the versions in more detail.

Revision history for this message
Reinhard Tartler (siretart) said :
#14

well, we can only support packaged version, and what you have shown so
far is definitly not consistent to what you say that you are using.

I guess that you have (broken) old binaries in your search path around
(e.g. in /usr/local/bin/) that hide the system ffmpeg. This would
explain some of your confusion.

as maintainer of the ffmpeg package, I can only say that libx264
encoding works just fine for me with the package libavcodec-extra-52
installed. It is BTW the main reason why this package exists in the
first place.

Revision history for this message
llogan (loul) said :
#15

Rory,

As I mentioned before it appears that you are using a compiled FFmpeg, yet you omitted '--enable-libx264' during the ffmpeg ./configure step. Therefore, even a proper command to encode to H.264 will fail. No matter how many times you try encoding with libx264 it will fail because you didn't properly configure your compiled FFmpeg to support it.

Either remove your compiled FFmpeg and install libavcodec-extra-52 and ffmpeg from the repository, OR re-compile FFmpeg following the guide I linked to in my previous message.

Also, you should use the libx264 presets when encoding to H.264. There are many reasons to use them and few reasons not to. Refer to link [2] in my previous message for examples.

Can you help with this problem?

Provide an answer of your own, or ask Rory McCann for more information if necessary.

To post a message you must log in.