Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 at 6:38
add comment

5 Answers 5

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
add comment

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 catswhocode.com/blog/19-ffmpeg-commands-for-all-needs –  Bhargav May 7 '12 at 17:36
add comment

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
add comment

Use the following command:

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

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

#!/bin/bash
for f in *.mp4
do
    name="${f/.mp4/.3gp}"
    ffmpeg -i "$f" -vcodec h263 -s qcif -r 15 -b 100k -acodec libfaac -ac 1 -ar 32000 -ab 64k -f 3gp "$name"
done
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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