Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to download a few videos from youtube and convert them to 3gp so that I can play them on my phone. I would like to know how this can be done using ffmpeg.

I tried the various results on the net only to get the following errors.

  1. I used:

    ffmpeg -i dil.mp4 -sameq -ab 64k -ar 44100 dilenada.3gp

I got:

Unsupported codec for output stream #0.1

Seems stream 0 codec frame rate differs from container frame rate: 2000.00 (2000/1) -> 29.92 (359/12)

  1. I used:

    ffmpeg -y -i dil.mp4 -r 20 -s 352x288 -b 400k -acodec libfaac -ac 1 -ar 2000 -ab 24k dilenada.3gp

I got:

Seems stream 0 codec frame rate differs from container frame rate: 2000.00 (2000/1) -> 29.92 (359/12)

Unknown encoder 'libfaac'

What am I doing wrong?

share|improve this question
You would be best to lose the -sameq option which rarely accomplishes what you think it does..... – andrew.46 May 30 '14 at 6:38

Use the following command:

ffmpeg  -y -i movie.mp4 \
        -r 20 -s 352x288 -vb 400k \
        -acodec aac -strict experimental -ac 1 -ar 8000 -ab 24k \
share|improve this answer

You probably just need to install the non free/restricted packages of ffmpeg like libavcodec-extra-53 libavformat-extra-53 libavutil-extra-51 and the likes.

Calling ffmpeg with --list-encoders will show the available encoders.

share|improve this answer
I tried installing them but still the commands mentioned in the question did not work. – harisibrahimkv May 7 '12 at 18:13
Still the same error messages? – LiveWireBT May 7 '12 at 22:18

You are doing everything right :). You will have to install for the conversion to work.

Ubuntu Restricted Extras, i.e. libavcodec-extra-53

You may get it from the software center or use the following command

sudo apt-get install ffmpeg libavcodec-unstripped-52

share|improve this answer
Also check this out – Bhargav May 7 '12 at 17:36

I ran into problems with ffmpeg too

Apparently, ubuntu is no longer using ffmpeg, but a fork called avconv. This makes some (many ?) commands found on sites unusable on ubuntu.

What I did was just get the original ffmpeg:

sudo add-apt-repository ppa:jon-severinsson/ffmpeg
sudo apt-get update
sudo apt-get install ffmpeg

not sure how much this would help you, though

share|improve this answer
your line is not working here, but at least it is not giving the "unknown codec" error, but one about resolution – josinalvo Jul 23 '12 at 17:29

In order to get round this problem, the only option may be to build from source. That solved any issues for me. I uninstalled any of the ffmpeg packages currently on the system that I had tried to use, and used this excellent Ubuntu compilation guide. This was the only way I could encode to proprietary formats such as mp4 and mp3.

In addition, the following script, which I have modified (credit to the original creator), can again be further altered and used to convert mp4 to 3gp or mp4 to mp3 (to extract the audio), or anything whatsoever. It also preserves the original name of the file in the newly converted file: It is however important to fill in the options correctly.

You can use different options for 3gp; for example,you may want a different resolution than qcif (176x144), but I found these settings initially worked for me with my compiled version of ffmpeg. (The conversion may take a while, depending on how powerful your CPU is, as converting it to 3gp reduces the file size quite a lot: 314mb to 13 mb for one of my conversions!)

Save this script below to a new document and make it executable (chmod +x), place it in the desired folder and execute it; or use the terminal to select the folder the script is in and the target folder containing the files; e.g. ~/Scripts/script ~/Downloads

for f in *.mp4
    ffmpeg -i "$f" -vcodec h263 -s qcif -r 15 -b 100k -acodec libfaac -ac 1 -ar 32000 -ab 64k -f 3gp "$name"
share|improve this answer

protected by Community May 26 '15 at 8:25

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.