Results 1 to 10 of 24

Thread: Convert videos in high quality for Nokia 5800 using ffmpeg

Hybrid View

  1. #1
    Join Date
    Apr 2007
    Beans
    19

    Post HOWTO: Convert videos in high quality for Nokia 5800 using ffmpeg

    I just found out a perfect working settings with ffmpeg to convert movies into a Nokia 5800 compatible format:

    Code:
    ffmpeg -i input.avi -f mp4 -vcodec mpeg4 -b 2200k -r 30 -s 640x360 -acodec libfaac -ar 32000 -ab 128k -ac 2 -threads 8 output.mp4
    I'm using a quad core CPU, and therefore -threads 8 (which still won't utilize the CPU fully).

    Hopefully a real ffmpeg guru could complement this into a more optimal way, but this works perfectly and a 2 hour movie generates an below 2GB high quality video suitable for the Nokia 5800.

    I hope this will help people trying to accomplish the same thing.
    Last edited by speakman; April 14th, 2009 at 09:46 PM.

  2. #2
    Join Date
    Sep 2006
    Beans
    3,713

    Re: Convert videos in high quality for Nokia 5800 using ffmpeg

    Looks like this phone can play MPEG4-AVC (specifications). This means that you can use the libx264 presets which can result in some excellent quality video:

    One-Pass CRF
    One-pass CRF lets you specify a quality to encode at, but the file size will be unknown:
    Code:
    ffmpeg -i input.avi -acodec libfaac -ab 128k -vcodec libx264 -vpre hq -vpre baseline -s 320x240 -threads 0 -crf 26 output.mp4
    Perhaps the phone doesn't need the baseline limitation:
    Code:
    ffmpeg -i input.avi -acodec libfaac -ab 128k -vcodec libx264 -vpre hq -s 320x240 -threads 0 -crf 26 output.mp4
    You may want to just encode a set amount of time to test this video instead of the whole thing. You can do that with the "-t" option. This example will encode the first 10 seconds:
    Code:
    ffmpeg -t 10 -i input.avi -acodec libfaac -ab 128k -vcodec libx264 -vpre hq -vpre baseline -s 320x240 -threads 0 -crf 26 output.mp4
    The most important option is crf. The lower the number, the higher the quality, and 18-30 is a sane range.

    Unfortunately, to take advantage of the presets you will need to compile FFmpeg yourself, although it isn't hard:

    HOWTO: Install and use the latest FFmpeg and x264

    See the above thread for some two-pass examples. Two-pass encoding lets you specify a bitrate (and thus a final file size), but the quality can vary.
    Last edited by FakeOutdoorsman; April 14th, 2009 at 07:08 PM. Reason: libx264 typo

  3. #3
    Join Date
    Apr 2007
    Beans
    19

    Re: Convert videos in high quality for Nokia 5800 using ffmpeg

    Thanks alot for your additions. I never got it working with libx264, but I'll test your settings soon and report.

    And thanks for the HOWTO link which I used myself but forgot to tell about.

  4. #4
    Join Date
    Dec 2007
    Location
    UK
    Beans
    25
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: Convert videos in high quality for Nokia 5800 using ffmpeg

    Here's a quick and dirty one if you want a fast (~30mins) rip of an 2.35:1 anamorphic DVD for the 5800:
    $ HandBrakeCLI -i /dev/cdrom -t 2 -w 640 -l 360 --crop 17:17:0:0 -o /home/me/<filename>.mp4

    Use the t switch to choose the right track off the DVD; the crop setting will chop if it's not 2.35

    The bits I liked are that the ripping is direct, takes about half an hour, produces pretty good mp4, and cuts about a 1.2GB output file. Half a dozen DVDs on an 8GB micro SD - enough for an intercontinental flight!

    You need to install HandBrakeCLI, of course but it's a good option for the 5800, IMHO.

  5. #5
    Join Date
    Apr 2007
    Beans
    19

    Re: Convert videos in high quality for Nokia 5800 using ffmpeg

    Great!

    One thing left; do subtitles has to be embedded in the video or is there any way to attach them into movies?

    Else; is it possible through ffmpeg/HandBrakeCLI to embedd it in the video?

  6. #6
    Join Date
    Apr 2007
    Beans
    19

    Re: Convert videos in high quality for Nokia 5800 using ffmpeg

    @FakeOutdoorsman

    I just tried your suggestions but none did work. It says either sound or video is not working, and then it starts playen the sound alone. No video.

    Any ideas how to bring the file size down using mpeg4 as in my first post?

  7. #7
    Join Date
    Sep 2006
    Beans
    3,713

    Re: Convert videos in high quality for Nokia 5800 using ffmpeg

    I rarely encode with -vcodec mpeg4, but I suppose you could simply decrease the bitrate:
    Code:
    ffmpeg -i input.avi -vcodec mpeg4 -b 512k -s 640x360 -acodec libfaac -ab 128k -ac 2 -threads 8 output.mp4
    I also changed -threads to 0 to let FFmpeg automatically choose the correct number of threads. You can add additional quality parameters, but they will slow your encode and your device may not play the resulting video:

    FFmpeg FAQ: Which are good parameters for encoding high quality MPEG-4?

    If you follow the above link make sure to change 4mv to mv4 if you are using SVN FFmpeg as the documentation is out of date.

    Update: I still think H.264 videos are possible. Try this 1 minute example:
    Code:
    ffmpeg -t 00:01:00:00 -i input.avi -acodec libfaac -ab 96k -vcodec libx264 -vpre hq -vpre ipod320 -r 30 -s 320x240 -threads 0 -b 512k -bt 512k -f ipod output.mp4
    Last edited by FakeOutdoorsman; February 23rd, 2010 at 12:45 AM. Reason: correct threads value for mpeg4

  8. #8
    Join Date
    May 2009
    Beans
    2

    Re: Convert videos in high quality for Nokia 5800 using ffmpeg

    I can convert to h264 and play on my device.
    Code:
    ffmpeg -i "input.avi" -f mp4 -vcodec libx264 -b 1000k -r 30 -s 320x240 -acodec libfaac -ar 32000 -ab 128k -ac 2 -threads 0 -async 1 "output.mp4" -crf 26
    if found it here
    Last edited by gpmelendez; May 1st, 2009 at 06:55 PM. Reason: included source of information

  9. #9
    Join Date
    Sep 2006
    Beans
    3,713

    Re: Convert videos in high quality for Nokia 5800 using ffmpeg

    Quote Originally Posted by gpmelendez View Post
    I can convert to h264 and play on my device.
    Code:
    ffmpeg -i "input.avi" -f mp4 -vcodec libx264 -b 1000k -r 30 -s 320x240 -acodec libfaac -ar 32000 -ab 128k -ac 2 -threads 0 -async 1 "output.mp4" -crf 26
    if found it here
    The syntax of the command is incorrect. FFmpeg will ignore any options declared after the output file, so -crf 26 isn't being applied. This is probably a good thing because using -b and -crf is contradictory. It is recommended to either use one of the other, but not both at the same time. See FFmpeg x264 encoding guide for more details.

Tags for this Thread

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
  •