ffmpeg resize "could not find codec parameters"

Solution 1:

A misleading situation

First of all, the so-called "ffmpeg" from the Ubuntu repository is not really ffmpeg from the FFmpeg project, but a fake version from a fork. It's a confusing situation. See:

  • Who can tell me the difference and relation between ffmpeg, libav, and avconv?
  • The FFmpeg/Libav situation

Secondly, this fake "ffmpeg" (and avconv) are terribly buggy. FFmpeg development is very active, and using a recent version of real ffmpeg will most likely resolve this issue.

Getting the real ffmpeg

You have several options:

  • Compile ffmpeg on Ubuntu - customizable, gives most recent code, but you must compile (not that hard and shouldn't take too long). Non-intrusive to the system.
  • Use a static build - easiest to use but not customizable; also non-intrusive.
  • Use Jon Severinsson's FFmpeg PPA - easy to enable and install but old and not customizable

Each has their advantages and disadvantages as described above.

Using a static build

You just need to download the archive, extract it, and execute the binary. No compiling or installing is necessary:

wget http://ffmpeg.gusari.org/static/32bit/ffmpeg.static.32bit.2013-06-19.tar.gz
tar xzvf ffmpeg.static.32bit.2013-03-19.tar.gz

Now you can use it. You can either navigate to the directory containing ffmpeg, and run (notice the preceding ./):

./ffmpeg -i input ... output

...or provide the full path to it as in:

/home/andy/ffmpeg/ffmpeg -i input ... output

Choose your $PATH

If you want the real ffmpeg whenever you use the ffmpeg command without having to use ./ or having to provide a full path to the binary, then place the ffmpeg binary in the bin directory in your home:

mkdir ~/bin
mv ffmpeg ~/bin
hash -r

Now you can just run ffmpeg and you'll be ready to encode stuff. If you want to use a different directory other than ~/bin, then you will have to add the directory to your $PATH as shown in How to add a directory to my path?

Checking for spies

Now using the ffmpeg command should show something like (note the "FFmpeg developers" phrase):

$ ffmpeg 
ffmpeg version N-54152-g730e07f Copyright (c) 2000-2013 the FFmpeg developers

If it shows the following then you'll know that you are cursed and the fake version is still being used (note the "Libav developers" phrase):

$ ffmpeg
ffmpeg version 0.8.5-6:0.8.5-0ubuntu0.12.10.1, Copyright (c) 2000-2012 the Libav developers