Page 1 of 3 123 LastLast
Results 1 to 10 of 30

Thread: HOWTO: Convert movie files to 3gp (mobile) format with sound.

  1. #1
    Join Date
    Oct 2005
    Beans
    80

    HOWTO: Convert movie files to 3gp (mobile) format with sound.

    This howto guides you through the process of setting up ffmpeg on your computer so that you can convert your avi and other movies to mobile (psp, cellphone) 3gp format. It is short, which I hope that you will appreciate. Most of the work will be done by a script.

    You need to install SVN for this to work. To get it
    Code:
     sudo apt-get install svn



    Updated May 24 2007 6pm:
    - After a little bit of testing I have found that the newer versions from SVN have broken the libraries needed by the C code to compile, it is best just to use the SVN version from the time that this worked.
    - There may have been a recent update to ffmpeg that removes the need for this howto that I am not aware of. If there is please tell me or post here!
    - Thanks to dragoncow2 for showing how to download previous versions of SVN, so I don't have to look it up. The script here is updated with his change.
    - Everything should work perfect now! Have fun

    Updated May 24 2007 12am:
    - I have fixed the links in the script so that they do not get truncated, I've noticed that has bugged people
    - I am testing the svn newer versions and trying to see why they do not work with the old codec


    First, uinstall any ffmpeg you might have currently installed. The usual command that will do this is
    Code:
    sudo apt-get remove ffmpeg
    Next, save the following into a script and make it executable and run it:
    Code:
    #!/bin/bash
    
    # feel free to change the src directory
    cd /usr/src/
    
    #will download the newest svn ffmpeg
    svn co -r '{2007-03-03}' svn://svn.mplayerhq.hu/ffmpeg trunk ffmpeg
    #Install the required audio codecs for 3gp videos
    cd ffmpeg/libavcodec
    mkdir amr_float
    cd amr_float
    wget http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-510.zip
    unzip *.zip
    unzip *code.zip
    cd ..
    mkdir amrwb_float
    cd amrwb_float
    wget http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip
    unzip *.zip
    unzip *code.zip
    cd ../..
    #configure ffmpeg to use these audio codecs
    ./configure --enable-amr_nb --enable-amr_wb $@
    make
    
    #link the ffmpeg binary to somewhere in PATH so you can run it anywhere
    ln -sf /usr/src/ffmpeg/ffmpeg /usr/local/bin/ffmpeg
    # or somewhere else in the path!
    To make it executable
    Code:
    chmod +x ffmpeg-install-script
    .

    When you run it make sure you run it as sudo.
    When the script is finished without any errors, you can encode your videos with the following command:

    Code:
    ffmpeg -i input -acodec amr_nb -ar 8000 -ac 1 -ab 32 -vcodec h263 -s qcif -r 15 out.3gp
    where input is the input movie file and out.3gp is the container for the output. Note, that the settings for aspect ratio and audio bit rate and frame rate are best left alone, as chaning them may cause the video to be unplayable on your cellphone (even if it is playable on your computer.)

    *****
    I will be adding the simple command to do the reverse (i.e. 3gp to avi) a little later I just have to research it a little more.
    I first need to get the other way working 100% of the time, seems svn changes quite often, makes sense. I don't think I will be adding support for this after all since who wants to conver 3gp->avi the quality would suck
    Last edited by gmatt; May 25th, 2007 at 02:20 AM.

  2. #2
    Join Date
    Jul 2006
    Location
    London UK
    Beans
    54
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: HOWTO: Convert movie files to 3gp (mobile) format with sound.

    Thanks for this, I have set it up and have started to convert a file...

    A couple of things to note before installation :
    - you will need to have the subversion package installed (I used apt-get to install it)
    - if you copy and paste the script above you will need to manually change the two 3gpp urls as they are truncated in the above code by the forum software. Right-click on the urls and select Properties to see the full path.

    Cheers.

  3. #3
    Join Date
    Jul 2005
    Location
    Lübeck, DE
    Beans
    149
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: HOWTO: Convert movie files to 3gp (mobile) format with sound.

    .
    Last edited by jamyskis; March 6th, 2007 at 12:33 PM. Reason: Error
    "Yes sir! I mean, no sir! I mean, yes to the first part, and no to the second part! Sir!"

    "Shut up, you idiot."

  4. #4
    Join Date
    Feb 2007
    Location
    Here
    Beans
    64
    Distro
    Ubuntu 6.10 Edgy

    Re: HOWTO: Convert movie files to 3gp (mobile) format with sound.

    Code:
    Unknown option "--enable-amr_nb".
    See ./configure --help for available options.
    Makefile:5: config.mak: No such file or directory
    /version.sh 
    make: /version.sh: Command not found
    make: *** No rule to make target `config.mak'. Stop.
    I have build-essential, subversion, libc6 and libc6dev installed. Any ideas?

    Thankfully it's not too difficult to remove the source your script has downloaded and reinstall ffmpeg but I'd really like to get it working.
    Code:
    /usr/src/ffmpeg$ ./configure --help
    gives this:
    Usage: configure [options]
    Options: [defaults in brackets after descriptions]

    Standard options:
    --help print this message
    --log[=FILE|yes|no] log tests and output to FILE [config.err]
    --prefix=PREFIX install in PREFIX [/usr/local]
    --libdir=DIR install libs in DIR [PREFIX/lib]
    --shlibdir=DIR install shared libs in DIR [PREFIX/lib]
    --incdir=DIR install includes in DIR [PREFIX/include/ffmpeg]
    --mandir=DIR install man page in DIR [PREFIX/man]
    --enable-static build static libraries [default=yes]
    --disable-static do not build static libraries [default=no]
    --enable-shared build shared libraries [default=no]
    --disable-shared do not build shared libraries [default=yes]
    --enable-gpl allow use of GPL code, the resulting libav*
    and ffmpeg will be under GPL [default=no]
    --enable-pp enable GPLed postprocessing support [default=no]
    --enable-swscaler software scaler support [default=no]
    --enable-beosthreads use BeOS threads [default=no]
    --enable-os2threads use OS/2 threads [default=no]
    --enable-pthreads use pthreads [default=no]
    --enable-w32threads use Win32 threads [default=no]
    --enable-x11grab enable X11 grabbing [default=no]

    External library support:
    --enable-sunmlib use Sun medialib [default=no]
    --enable-dc1394 enable IIDC-1394 grabbing using libdc1394
    and libraw1394 [default=no]
    --enable-liba52 enable GPLed liba52 support [default=no]
    --enable-liba52bin open liba52.so.0 at runtime [default=no]
    --enable-avisynth allow reading AVISynth script files [default=no]
    --enable-libamr-nb enable libamr-nb floating point audio codec
    --enable-libamr-wb enable libamr-wb floating point audio codec
    --enable-libdts enable GPLed libdts support [default=no]
    --enable-libfaac enable FAAC support via libfaac [default=no]
    --enable-libfaad enable FAAD support via libfaad [default=no]
    --enable-libfaadbin build FAAD support with runtime linking [default=no]
    --enable-libgsm enable GSM support via libgsm [default=no]
    --enable-libmp3lame enable MP3 encoding via libmp3lame [default=no]
    --enable-libnut enable NUT (de)muxing via libnut,
    native demuxer exists [default=no]
    --enable-libogg enable Ogg muxing via libogg [default=no]
    --enable-libtheora enable Theora encoding via libtheora [default=no]
    --enable-libvorbis enable Vorbis en/decoding via libvorbis,
    native implementations exist [default=no]
    --enable-x264 enable H.264 encoding via x264 [default=no]
    --enable-xvid enable Xvid encoding via xvidcore,
    native MPEG-4/Xvid encoder exists [default=no]

    Advanced options (experts only):
    --source-path=PATH path to source code [/usr/src/ffmpeg]
    --cross-prefix=PREFIX use PREFIX for compilation tools []
    --cross-compile assume a cross-compiler is used
    --target-os=OS compiler targets OS [linux]
    --cc=CC use C compiler CC [gcc]
    --make=MAKE use specified make [make]
    --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS []
    --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS []
    --extra-libs=ELIBS add ELIBS []
    --build-suffix=SUFFIX suffix for application specific build []
    --arch=ARCH select architecture [i686]
    --cpu=CPU selects the minimum cpu required (affects
    instruction selection, may crash on older CPUs)
    --enable-powerpc-perf enable performance report on PPC
    (requires enabling PMC)
    --disable-mmx disable MMX usage
    --disable-armv5te disable armv5te usage
    --disable-armv6 disable armv6 usage
    --disable-iwmmxt disable iwmmxt usage
    --disable-altivec disable AltiVec usage
    --disable-audio-oss disable OSS audio support [default=no]
    --disable-audio-beos disable BeOS audio support [default=no]
    --disable-v4l disable video4linux grabbing [default=no]
    --disable-v4l2 disable video4linux2 grabbing [default=no]
    --disable-bktr disable bktr video grabbing [default=no]
    --disable-dv1394 disable DV1394 grabbing [default=no]
    --disable-network disable network support [default=no]
    --disable-ipv6 disable ipv6 support [default=no]
    --disable-zlib disable zlib [default=no]
    --disable-vhook disable video hooking support
    --disable-debug disable debugging symbols
    --disable-mpegaudio-hp faster (but less accurate)
    MPEG audio decoding [default=no]
    --disable-ffmpeg disable ffmpeg build
    --disable-ffserver disable ffserver build
    --disable-ffplay disable ffplay build
    --enable-small optimize for size instead of speed
    --enable-memalign-hack emulate memalign, interferes with memory debuggers
    --disable-encoder=NAME disables encoder NAME
    --enable-encoder=NAME enables encoder NAME
    --disable-decoder=NAME disables decoder NAME
    --enable-decoder=NAME enables decoder NAME
    --disable-encoders disables all encoders
    --disable-decoders disables all decoders
    --disable-muxer=NAME disables muxer NAME
    --enable-muxer=NAME enables muxer NAME
    --disable-muxers disables all muxers
    --disable-demuxer=NAME disables demuxer NAME
    --enable-demuxer=NAME enables demuxer NAME
    --disable-demuxers disables all demuxers
    --enable-parser=NAME enables parser NAME
    --disable-parser=NAME disables parser NAME
    --disable-parsers disables all parsers
    --enable-bsf=NAME enables bitstream filter NAME
    --disable-bsf=NAME disables bitstream filter NAME
    --disable-bsfs disables all bitstream filters
    --enable-protocol=NAME enables protocol NAME
    --disable-protocol=NAME disables protocol NAME
    --disable-protocols disables all protocols

    Developer options (useful when working on FFmpeg itself):
    --enable-gprof enable profiling with gprof [no]
    --disable-opts disable compiler optimizations
    --enable-extra-warnings enable more compiler warnings
    --disable-strip disable stripping of executables and shared libraries

    NOTE: Object files are built at the place where configure is launched.

    Am I missing something here?
    Last edited by Docter; May 13th, 2007 at 05:53 PM.
    quidquid latine dictum sit altum viditur - Whatever is said in Latin sounds profound

  5. #5
    Join Date
    Jul 2005
    Location
    Near DC
    Beans
    13
    Distro
    Edubuntu 6.06 Dapper

    Re: HOWTO: Convert movie files to 3gp (mobile) format with sound.

    The trick is to get the svn version from March 03, since that is when these directions worked. You could figure out how to get the new one to work, but after 20 minutes of troubleshooting I decided to be lazy and just check out the older version, from the time it worked...and so, do this instead:

    #!/bin/bash

    # feel free to change the src directory
    cd /usr/src/

    #will download the newest svn ffmpeg
    svn co -r '{2007-03-03}' svn://svn.mplayerhq.hu/ffmpeg trunk ffmpeg
    #Install the required audio codecs for 3gp videos
    cd ffmpeg/ffmpeg/trunk/libavcodec
    mkdir amr_float
    cd amr_float
    wget http://www.3gpp.org/ftp/Specs/archiv.../26104-510.zip
    unzip *.zip
    unzip *code.zip
    cd ..
    mkdir amrwb_float
    cd amrwb_float
    wget http://www.3gpp.org/ftp/Specs/archiv.../26204-510.zip
    unzip *.zip
    unzip *code.zip
    cd ../..
    #configure ffmpeg to use these audio codecs
    ./configure --enable-amr_nb --enable-amr_wb $@
    make

    #link the ffmpeg binary to somewhere in PATH so you can run it anywhere
    ln -sf /usr/src/ffmpeg/ffmpeg /usr/local/bin/ffmpeg
    # or somewhere else in the path!



    Hope that helps! I haven't tested it all, but I got ffmpeg to compile with amr* stuff, so it's much better than using current svn )

  6. #6
    Join Date
    Jul 2005
    Location
    Near DC
    Beans
    13
    Distro
    Edubuntu 6.06 Dapper

    Re: HOWTO: Convert movie files to 3gp (mobile) format with sound.

    Ok, I got it working. Get rid of the `ln` on the last line...it's not really needed. Also, I didn't uninstall the original ffmpeg because there's no conflicts with both. Just don't "install" the second one, run it from the folder where it's built, like this:

    ./ffmpeg -i ~/House.avi -acodec amr_nb -ar 8000 -ac 1 -ab 32 -vcodec h263 -s qcif -r 15 ~/house.3gp


    It's working just fine on my Samsung A950, here's the filetypes before and after:

    # House.avi: RIFF (little-endian) data, AVI, 624 x 352, 23.98 fps, video: XviD, audio: MPEG-1 Layer 3 (stereo, 48000 Hz)

    # house.3gp: ISO Media, MPEG v4 system, 3GPP


    Dont' worry if the audio doesn't play with mplayer, as mplayer doesn't have the proper support built in (at least default from the multiverse), for the audio, it works just fine on the cell phone though.

    Hope this helps,

  7. #7
    Join Date
    May 2007
    Beans
    17
    Distro
    Xubuntu 6.10 Edgy

    Re: HOWTO: Convert movie files to 3gp (mobile) format with sound.

    I also got
    Code:
    Unknown option "--enable-amr_nb"
    ./configure outputs
    Code:
    install prefix            /usr/local
    source path               /tmp/ffmpeg
    C compiler                gcc
    make                      make
    .align is power-of-two    no
    ARCH                      x86_32 (generic)
    big-endian                no
    MMX enabled               yes
    CMOV enabled              no
    CMOV is fast              no
    gprof enabled             no
    debug symbols             yes
    strip symbols             yes
    optimize                  yes
    static                    yes
    shared                    no
    postprocessing support    no
    software scaler enabled   no
    video hooking             yes
    Imlib2 support            no
    FreeType support          yes
    network support           yes
    IPv6 support              yes
    threading support         no
    SDL support               no
    Sun medialib support      no
    AVISynth enabled          no
    liba52 support            no
    liba52 dlopened           no
    libamr-nb support         no
    libamr-wb support         no
    libdts support            no
    libfaac enabled           no
    libfaad enabled           no
    faadbin enabled           no
    libgsm enabled            no
    libmp3lame enabled        no
    libnut enabled            no
    libogg enabled            no
    libtheora enabled         no
    libvorbis enabled         no
    x264 enabled              no
    XviD enabled              no
    zlib enabled              yes
    License: LGPL
    Creating config.mak and config.h...
    I seem to be missing a lot of stuff... ???
    Last edited by hexo1125; May 14th, 2007 at 12:32 AM.

  8. #8
    Join Date
    Feb 2007
    Location
    Here
    Beans
    64
    Distro
    Ubuntu 6.10 Edgy

    Re: HOWTO: Convert movie files to 3gp (mobile) format with sound.

    Marvelous. Your clear instructions and speedy response is most appreciated. I guess I shoulda noticed the date

    Now I can take a tai chi vid with me when I practice.

    I guess if you ever need anyone killed... I'm your guy. Thanks.


    (DISCLAIMER: I am not a hitman!)
    quidquid latine dictum sit altum viditur - Whatever is said in Latin sounds profound

  9. #9
    Join Date
    May 2007
    Beans
    17
    Distro
    Xubuntu 6.10 Edgy

    Re: HOWTO: Convert movie files to 3gp (mobile) format with sound.

    My last post, I used the latest version (as of that post).

    I then tried the March 3rd revision, and get some other error
    Code:
    make[1]: *** No rule to make target `amr_float/sp_dec.o', needed by `libavcodec.a'.  Stop.

  10. #10
    Join Date
    May 2007
    Beans
    17
    Distro
    Xubuntu 6.10 Edgy

    Re: HOWTO: Convert movie files to 3gp (mobile) format with sound.

    anyways, it was my bad...

    copy and paste the code doesn't work because the wget links are truncated...
    also make sure the folder directives are right in the script...
    cd into the proper directory before executing the configures and makes...
    then it should work fine...

    Thanks!

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •