frank lampard
2nd June 2009, 05:17
I've been searching for settings to encode video with the best picture quality that the 5800s built in Real Player can view. Since google couldn't help me (or maybe I didn't search for the right phrase), I started experimenting myself.
If you know more, please share!
I'm using MeGUI (http://sourceforge.net/projects/megui) to encode (it has both an XViD (mencoder) and a H264 (x264) encoder contained. I also use Avisynth (http://avisynth.org) to crop and resize my videos to the right resolution before encoding.
To encode the audio I use Nero AAC codec (http://www.nero.com/eng/downloads-ne...-aac-codec.php).
All of theese programs can be obtained legally for free on the respective web pages.
I'll first speak of the video settings, since audio is a bit less important (the 5800 will play most things you can throw at it, exceptions include flac).
According to Nokias documentation the 5800 can play h264 files, this is partially correct, since it can play h264 files encoded with in baseline profile (level 1), but only resolutions up to about 350x200 (these are not exact numbers, but I haven't been able to encode videos in the full 640x360 resolution and have the phone play it :/).
Therefore I focused my experimenting to the less cpu-demanding (thus less memory-efficient) XViD codec. It turns out the 5800 the batman-video included on the phone is encoded with some kind of mpeg4 asp (XViD/DiVX/whatever) settings.
Okay you're probably not interested in my adventures into codec-land (wikipedia/google/random search engines and explanations) .
Here are the settings I came up with that seems to work best:
THE GUIDE
Fire up MeGUI!
Import your avisynth clip into both the video and audio inputs.
If you don't know how to make such a script, you can start with a very simple one:
A text file that contains:
DirectShowSource("Location of your source video file.avi")
Spline36Resize(640,360)
Save the text file as myencode.avs and import that one.
You can do a lot of interesting things with Avisynth, but I won't be covering that in this guide, please google for it if you are interested! (Or use avisynths own wiki-page)
Video settings
Select an XViD preset such as "XViD: *scratchpad*" and press "Config".
Under General:
- 2-pass encoding (single pass is possible too, but you'll get better quality per bitrate with 2-pass (turn on turbo mode, otherwise it will take _ages_)
- The bitrate field is some kind of maximum bitrate, most videos I encoded never went above ~2000 kbps so setting it somewhere above that should work, I dont know the maximum bitrate the 5800 supports though
- Leave the logfile as it is.
Under Tools:
- VHQ-mode should be set to "4 - Wide search". Setting it lower works and makes the encoding quicker but lowers quality.
- Use VHQ for B-frames can be set to whatever since we will disable B-frames entirely later.
- QPel should be off.
- GMC should be off.
(The 5800 doesn't support theese things)
- Chroma motion should be on.
- Closed GOP should be on.
- Quantization type should be set to H.263. I haven't been able to make the videos play with any other setting here, though it may be possible, if you can make it work, please tell me!
Under Other Settings:
Please do experiment with theese settings since I think most things here only change quality very slightly.
- Trellis Quant should be set to on.
- Adaptive Quantization should be set to on.
- Interlaced should be set to off.
- Packed bitstream should be set to off.
- Max keyframe int can be left at the default value of 300 I think. (I don't know what this does)
- Nb of B-frames should be set to 0. The 5800 cannot decode B-frames!
- Threads can be set to whatever you wish since it only concerns encoding time (if youve got a multicore processor you might gain some time by increasing this number).
- FourCC should be set to MP4V. Otherwise the 5800 might not be able to play it, I think this has nothing to do with quality but is just a text string.
- Motion Search Precision should be set to 6 - Ultra High. You can decrease it if you wish (makes the encoding quicker), but you will loose quality.
I didn't touch the advanced tab, please try poking around there!
In the end, press "New" to save the preset under a new name so you wont have to fix all the settings again when you encode your next clip.
After setting the video encoding options you should "RAWASP" as file format, then you will get an m4v file which we will mux (pack) into an mp4-container later together with the audio.
Audio settings
After putting the "neroAacEnc.exe" file which you got from nero into meguis main folder (C:\Program Files\megui), you should select "Nero AAC: *scratchpad* and press "Config".
Under Audio Options:
- Force decoding via DirectShow should be off.
- Apply dynamic range compression should be off in most cases, though this depends on the source audio and if you intend to play the video with the 5800-speakers or headphones. If there is a lot of difference between quiet and loud sounds in the video (Like you can't hear the dialog because of the background music), you should try setting this on.
- Output channels should be set to Downmix multichannel to stereo. There is no point in having 5.1 audio..
- Sample rate can be left at "Keep original", I think the phone can handle everything you can set here.
- Normalize peaks to might be set to on and 100. This way the volumes of your different clips will be roughly the same, though this is _not_ necessary.
Under Nero AAC Options:
- Choose Variable bit rate and set it to somewhere around 0.75. Increasing this will increase both wuality and size, so you should probably try different settings, I find 0.75 adequate.
- AAC Profile should be set to AAC-LC (thanks Simi69!). Since we are going to be above 80 kbps bitrate with the audio, this one should be best.
Again, save this preset under a new name so you won't have to fiddle with it later.
After pressing OK, you can pick either MP4-AAC or M4A as Extension, both will work fine, since we'll be packing it together with the video in an mp4 later anyway.
THE ENCODING
Now should be a good time to press "Enqueue" on both the video and on the audio. Then press the "Queue" tab and Start the encoding. Now go and have a cup of coffee or whatever, since this will take some time (on my 2.0 ghz Core 2 Duo laptop it takes roughly twice the time of the clip, so 10 min clip = 20 min encoding time).
THE MUXING
In the Tools menu pick Muxer->MP4 muxer.
- In Video input select the m4v file that the video encoding created.
- In Audio input select the mp4 or m4a file that the audio encoding created.
Press Queue. And then again in the Queue tab press start. This will combine the video and audio into a new file called something-muxed.mp4
That is your clip. congrats!:)
If you know more, please share!
I'm using MeGUI (http://sourceforge.net/projects/megui) to encode (it has both an XViD (mencoder) and a H264 (x264) encoder contained. I also use Avisynth (http://avisynth.org) to crop and resize my videos to the right resolution before encoding.
To encode the audio I use Nero AAC codec (http://www.nero.com/eng/downloads-ne...-aac-codec.php).
All of theese programs can be obtained legally for free on the respective web pages.
I'll first speak of the video settings, since audio is a bit less important (the 5800 will play most things you can throw at it, exceptions include flac).
According to Nokias documentation the 5800 can play h264 files, this is partially correct, since it can play h264 files encoded with in baseline profile (level 1), but only resolutions up to about 350x200 (these are not exact numbers, but I haven't been able to encode videos in the full 640x360 resolution and have the phone play it :/).
Therefore I focused my experimenting to the less cpu-demanding (thus less memory-efficient) XViD codec. It turns out the 5800 the batman-video included on the phone is encoded with some kind of mpeg4 asp (XViD/DiVX/whatever) settings.
Okay you're probably not interested in my adventures into codec-land (wikipedia/google/random search engines and explanations) .
Here are the settings I came up with that seems to work best:
THE GUIDE
Fire up MeGUI!
Import your avisynth clip into both the video and audio inputs.
If you don't know how to make such a script, you can start with a very simple one:
A text file that contains:
DirectShowSource("Location of your source video file.avi")
Spline36Resize(640,360)
Save the text file as myencode.avs and import that one.
You can do a lot of interesting things with Avisynth, but I won't be covering that in this guide, please google for it if you are interested! (Or use avisynths own wiki-page)
Video settings
Select an XViD preset such as "XViD: *scratchpad*" and press "Config".
Under General:
- 2-pass encoding (single pass is possible too, but you'll get better quality per bitrate with 2-pass (turn on turbo mode, otherwise it will take _ages_)
- The bitrate field is some kind of maximum bitrate, most videos I encoded never went above ~2000 kbps so setting it somewhere above that should work, I dont know the maximum bitrate the 5800 supports though
- Leave the logfile as it is.
Under Tools:
- VHQ-mode should be set to "4 - Wide search". Setting it lower works and makes the encoding quicker but lowers quality.
- Use VHQ for B-frames can be set to whatever since we will disable B-frames entirely later.
- QPel should be off.
- GMC should be off.
(The 5800 doesn't support theese things)
- Chroma motion should be on.
- Closed GOP should be on.
- Quantization type should be set to H.263. I haven't been able to make the videos play with any other setting here, though it may be possible, if you can make it work, please tell me!
Under Other Settings:
Please do experiment with theese settings since I think most things here only change quality very slightly.
- Trellis Quant should be set to on.
- Adaptive Quantization should be set to on.
- Interlaced should be set to off.
- Packed bitstream should be set to off.
- Max keyframe int can be left at the default value of 300 I think. (I don't know what this does)
- Nb of B-frames should be set to 0. The 5800 cannot decode B-frames!
- Threads can be set to whatever you wish since it only concerns encoding time (if youve got a multicore processor you might gain some time by increasing this number).
- FourCC should be set to MP4V. Otherwise the 5800 might not be able to play it, I think this has nothing to do with quality but is just a text string.
- Motion Search Precision should be set to 6 - Ultra High. You can decrease it if you wish (makes the encoding quicker), but you will loose quality.
I didn't touch the advanced tab, please try poking around there!
In the end, press "New" to save the preset under a new name so you wont have to fix all the settings again when you encode your next clip.
After setting the video encoding options you should "RAWASP" as file format, then you will get an m4v file which we will mux (pack) into an mp4-container later together with the audio.
Audio settings
After putting the "neroAacEnc.exe" file which you got from nero into meguis main folder (C:\Program Files\megui), you should select "Nero AAC: *scratchpad* and press "Config".
Under Audio Options:
- Force decoding via DirectShow should be off.
- Apply dynamic range compression should be off in most cases, though this depends on the source audio and if you intend to play the video with the 5800-speakers or headphones. If there is a lot of difference between quiet and loud sounds in the video (Like you can't hear the dialog because of the background music), you should try setting this on.
- Output channels should be set to Downmix multichannel to stereo. There is no point in having 5.1 audio..
- Sample rate can be left at "Keep original", I think the phone can handle everything you can set here.
- Normalize peaks to might be set to on and 100. This way the volumes of your different clips will be roughly the same, though this is _not_ necessary.
Under Nero AAC Options:
- Choose Variable bit rate and set it to somewhere around 0.75. Increasing this will increase both wuality and size, so you should probably try different settings, I find 0.75 adequate.
- AAC Profile should be set to AAC-LC (thanks Simi69!). Since we are going to be above 80 kbps bitrate with the audio, this one should be best.
Again, save this preset under a new name so you won't have to fiddle with it later.
After pressing OK, you can pick either MP4-AAC or M4A as Extension, both will work fine, since we'll be packing it together with the video in an mp4 later anyway.
THE ENCODING
Now should be a good time to press "Enqueue" on both the video and on the audio. Then press the "Queue" tab and Start the encoding. Now go and have a cup of coffee or whatever, since this will take some time (on my 2.0 ghz Core 2 Duo laptop it takes roughly twice the time of the clip, so 10 min clip = 20 min encoding time).
THE MUXING
In the Tools menu pick Muxer->MP4 muxer.
- In Video input select the m4v file that the video encoding created.
- In Audio input select the mp4 or m4a file that the audio encoding created.
Press Queue. And then again in the Queue tab press start. This will combine the video and audio into a new file called something-muxed.mp4
That is your clip. congrats!:)