6

I'm a newbee to ubuntu and need your help: (32bit ubuntu 12.10) my command:

ffmpeg -i ../output_images/particles%04d.png -r 30 -b 30000k final_movie.avi

works for my 800x800 *.png pictures properly, but it doesn't with 512x512 *.png. There I get the following message:

[image2 @ 0x938a100] Could not find codec parameters (Video: png, 512x512)

On the campus-machines it works for both with the same code. I tried doing a resize-command:

for p in *.tga; do convert -resize 800x800 $p $p; done

With this added, it works, but I have and 800x800-movie in the end.


I've already installed the following packages:

Glut:

sudo apt-get install freeglut3-dev

ffmpeg:

sudo apt-get install ffmpeg

There was a "curl command not found" error. I fixed it with:

sudo apt-get install curl

There was another "convert: command not found" and I fixed it with:

sudo apt-get install imagemagick

Any idea what is missing?

Andy
  • 63
  • Probably a bug in the buggy, bizarro, fake version of "ffmpeg" from libav. Try a static build of real ffmpeg from FFmpeg. – llogan Mar 13 '13 at 22:14
  • thx, can you tell me how I do that? (command?) – Andy Mar 15 '13 at 16:05
  • Yes, I should have included that. See this example. – llogan Mar 15 '13 at 18:19
  • @Lord I followed the instructions but still get the "Copyright (c) 2000-2012 the Libav developers" and not "Copyright (c) 2000-2013 the FFmpeg developers". – Andy Mar 17 '13 at 11:45
  • You need to make sure you're executing the ffmpeg binary properly. Either navigate to the directory containing ffmpeg and run ./ffmpeg -i input ... output (notice the ./) or provide the full path to it as in /home/andy/ffmpeg/ffmpeg -i input ... output. – llogan Mar 17 '13 at 17:52
  • Changing the code to the path and it works now with the png's :D . Any way to make it the default operation when using ffmpeg? Would be good, otherwise I'd have to change all the files that I get to run. Any idea? (tyvm so far!!!) – Andy Mar 18 '13 at 17:15
  • I'm sorry, but I don't understand the question. Can you clarify? – llogan Mar 18 '13 at 18:06
  • I'd like to know, if it is possible to set the "FFmpeg developers" version to standard instead of the "libav" one. So that when I run ffmpeg in any folder directly with ./ffmpeg that it will use the new one by default. – Andy Mar 18 '13 at 20:47
  • You have several options, but the "best" method is to place the ffmpeg binary in a directory and add the directory to your $PATH as shown in How to add a directory to my path?. – llogan Mar 18 '13 at 21:54
  • perfect, that helped, error is fixed!!! Is it ok for you, if I'll make an answer to this thread containing all necessary commands? (ofc saying they're from you) – Andy Mar 19 '13 at 18:22
  • I'll just add an answer. – llogan Mar 19 '13 at 19:52

2 Answers2

6

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:

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:

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
llogan
  • 11,868
0

What helped me is to change the image conversion format from png to jpeg. So the makemovie.sh has to look like this:

#!/bin/bash
cd output_images
for F in $(ls *.tga); 
do 
    convert -quality 100 $F ${F%.tga}.jpg; 
    #convert -quality 100 $F ${F%.tga}.png;
    rm $F;
    echo done with converting $F; 
done
cd ..

THISPATH=$(pwd)
export PATH=$PATH:${THISPATH}/ffmpeg/ffmpeg-install/bin/

echo Making the movie now...

cd final_movie
rm final_movie.avi
ffmpeg -i ../output_images/particles%04d.jpg -r 30 -b 30000k final_movie.avi
cd ..
mlissner
  • 2,243
  • you mean convert the .tga to .jpg. Guess that would work as well, but maybe at some point we need the transparency of a png-picture for multiple layers. Plus it seems to work on other machines, but thx for the tip ;) – Andy Mar 15 '13 at 16:08