View Full Version : DVD NTSC -> x264 : which settings?
mathmax
30th March 2012, 23:59
Hello
I deinterlaced a NTSC DVD to 59.94fps. I would like to encode it with x264 but I don't know well which settings to use to keep the DVD quality.
After some research I found this post, but it's quite obscure for me how to use each parameters..
http://forum.doom9.org/showthread.php?p=1072386#post1072386
I want to preserve quality prior than encoding time. Could you advise me a command line to use?
Thanks
sneaker_ger
31st March 2012, 00:14
Those suggestions are outdated.
Currently recommended way:
1.) Choose a preset which speed you can still tolerate: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo
2.) Choose a tuning: filme, animation, grain
3.) Choose a CRF value for your quality, lower crf = more bitrate = higher quality
4.) choose a level for better hardware compatibility
Example:
x264 input -o output.h264 --preset slower --tune film --crf 18 --level 4.1
mathmax
31st March 2012, 01:08
thank you for your answer :)
1.) Choose a preset which speed you can still tolerate: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo
I'll go with slow or slower.. but my pc is not so fast. Will that make a difference? Also should I specify one pass/two passes?
2.) Choose a tuning: filme, animation, grain
my video is a concert. Should I should film or let the default value?
3.) Choose a CRF value for your quality, lower crf = more bitrate = higher quality
I was thinking to use 16. Is it worth to set a lower value like 10. I want to have the same quality as my original DVD which is 4gb per hour.
4.) choose a level for better hardware compatibility
I don't really understand this last parameter. What is the level exactly?
There are many other parameters..(http://mewiki.project357.com/wiki/X264_Settings) but I don't know if I should set them or let the default values..
sneaker_ger
31st March 2012, 01:17
I'll go with slow or slower.. but my pc is not so fast. Will that make a difference?
I don't remember any specific numbers right now, but the difference from one preset to another is not that big.
Also should I specify one pass/two passes?
CRF is a 1pass mode. Don't set "--pass X", as shown in my example.
my video is a concert. Should I should film or let the default value?
Film should be fine, or grain if it is very grainy. If you are unsure you can also omit the --tune parameter altogether.
I was thinking to use 16. Is it worth to set a lower value like 10. I want to have the same quality as my original DVD which is 4gb per hour.
10 will most likely be overkill - I wouldn't be surprised if the final encode would be larger than your source DVD! 16 is also very low, most people choose something in the 18 to 23 range. Do a few tests to see which setting is sufficient for your eyes.
I don't really understand this last parameter. What is the level exactly?
It sets the level flag in the bitstream and limits the maximum number of reference frames.
For example H.264 knows levels up to 5.2, but many players only support up to level 4.1.
Wikipedia has some info on that topic:
http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels
There are many other parameters..(http://mewiki.project357.com/wiki/X264_Settings) but I don't know if I should set them or let the default values..
Don't set anything else, unless you know what you're doing. The presets will make sure that a sane combination of parameters will be used.
mathmax
31st March 2012, 01:30
Thank you
Isn't two pass mode better than CRF ?
And I wonder if I should directly input my avisynth script or first render it in lossless format. The avisynth script is quite slow to perform and has temporal filters.
sneaker_ger
31st March 2012, 01:36
Isn't two pass mode better than CRF ?
No. CRF is on par quality-wise with 2pass at the same bitrate. 2pass is only necessary if you want to hit a specific bitrate (like encoding to a 700 MB CD), and don't want to take the quality hit of the 1pass ABR mode. (One could argue that CRF is superior to 2pass as the second pass takes additional time one could invest in even slower settings for CRF)
And I wonder if I should directly input my avisynth script or first render it in lossless format. The avisynth script is quite slow to perform and has temporal filters.
It can be faster to do that, but you really have to test and do a little math yourself.
sneaker_ger
31st March 2012, 01:48
It can be faster to do that, but you really have to test and do a little math yourself.
Quoting myself here:
Of course it only makes sense in a 2pass encode. If you are using CRF (which is highly recommended) it usually doesn't make any sense to first encode losslessly.
mathmax
31st March 2012, 02:06
Thank you
I tried to download the 64 bit version but it seems that I can't input avs file with it. It works well with the 32 bit version though.
I download here: http://www.free-codecs.com/x264_video_codec_download.htm
mandarinka
31st March 2012, 02:08
Quoting myself here:
Of course it only makes sense in a 2pass encode. If you are using CRF (which is highly recommended) it usually doesn't make any sense to first encode losslessly.
Unless you a) happen to screw up often /oops! forgot to filter the rainbowing here!/ b) tend to not be satisfied with your result /too small!/ and re-encoding stuff once or twice...
mathmax
31st March 2012, 02:37
I have a problem when playing the encoded video with windows media player (VLC is fine). The video get highly pixelated like it can't read well the format.
Here are the settings I use:
x264 input.avs -o output.mp4 --preset=slower --tune=film --crf=18 --level=4.1 --sar=8:9
and here is a short sample:
http://www.mediafire.com/file/5tfxp7pa4hjqypf/Output.mp4
And any idea what is wrong with the 64bit version? It's too bad I can't use it to input AVS files.. it would be faster to process..
sneaker_ger
31st March 2012, 02:37
I tried to download the 64 bit version but it seems that I can't input avs file with it. It works well with the 32 bit version though.
You can't directly mix 32 bit applications (AviSynth 32bit) and 64 bit applications. You can pipe, though, which is recommended in this case, as 64 bit x264 is quite a bit faster than its 32 bit version.
I recommend avs2pipemod (http://forum.doom9.org/showthread.php?p=1565165#post1565165):
avs2pipemod -y4mp source.avs | x264 - --demuxer y4m -o output.h264 --preset slower --tune film --crf 18 --level 4.1
mathmax
31st March 2012, 02:48
That means the script will be rendered by avspipemod and x264 will use the stream in real time to encode it? Or is the video file saved somewhere before it's compressed?
sneaker_ger
31st March 2012, 02:49
Here are the settings I use:
x264 input.avs -o output.mp4 --preset=slower --tune=film --crf=18 --level=4.1 --sar=8:9
and here is a short sample:
http://www.mediafire.com/file/5tfxp7pa4hjqypf/Output.mp4
I don't see anything wrong with it and it plays fine here, even on WMP.
Btw, the correct SAR for 4:3 NTSC should be 10/11 IIRC.
And I forgot: you can omit the "level" parameter for SD videos, as the level will actually be lower than 4.1, so setting "--level 4.1" might actually lower the hardware compatibility needlessly. Keep that for HD videos.
Unless you a) happen to screw up often /oops! forgot to filter the rainbowing here!/ b) tend to not be satisfied with your result /too small!/ and re-encoding stuff once or twice...
Yes.
mathmax
31st March 2012, 03:00
I don't see anything wrong with it and it plays fine here, even on WMP.
this is strange. Here is what I see:
http://img268.imageshack.us/img268/1241/wmpb.png
Btw, the correct SAR for 4:3 NTSC should be 10/11 IIRC.
Ah.. I thought sar=8:9 was for 4:3 NTSC. :-/
How should I write the parameter? sar=10:11?
what does IIRC mean?
sneaker_ger
31st March 2012, 03:09
this is strange. Here is what I see:
Nope, that's not how it looks here. Could be a DXVA (driver) error or you're using some broken decoder (very old CoreAVC) or whatever...
The only problem I see is that horizontal blurred stripe in the middle, but that is a result of your script/source and looks the same in all players.
Ah.. I thought sar=8:9 was for 4:3 NTSC. :-/
How should I write the parameter? sar=10:11?
Yes, "--sar 10:11" or "--sar=10:11".
I did a quick search and there seems to be a dispute on whether 8:9 or 10:11 is correct. The former is a little more exact and the latter follows the MPEG4 standard. Since the difference between them is so small, I'd personally follow the standard, but maybe that's just me. Discussions over correct ARs have filled whole threads in here, so I don't want to discuss it any further than this.
/edit:
after a bit of thinking: it depends on whether the active width is 720 or 704 pixels. The latter is recommended and has been used for your source (black borders on the left and right side), so 10:11 would actually be exact here.
(704/480 * 10/11 = 4/3)
(720/480 * 8/9 = 4/3)
what does IIRC mean?
If I remember correctly
mathmax
31st March 2012, 03:40
yes the blurred strip is normal. It's logo removal. :)
I get an error when I use avs2pipemod (I downloaded from the link you gave and used the 32bit version of course).
http://img3.imageshack.us/img3/2056/errorpipe.png
sneaker_ger
31st March 2012, 03:42
You have to replace the "step3.avs" in your x264 command with "- --demuxer y4m". Also choose "step3.avs" in the avs2pipe command instead of just "source.avs".
Basically avs2pipemod has to open "step3.avs" and x264 has to wait for input through a pipe.
mathmax
31st March 2012, 04:05
oh yes sorry..
It seems to be slightly faster: 0.9fps rather than 0.8fps before... but not a big difference.
what do "y4mp" and "y4m" stand for?
sneaker_ger
31st March 2012, 04:08
http://wiki.multimedia.cx/index.php?title=YUV4MPEG2
the "p" at the end means "progressive".
mathmax
31st March 2012, 04:14
thank you. I'll now encode the whole video.. hope it'll not be too long :)
It seems to be slightly faster: 0.9fps rather than 0.8fps before... but not a big difference.
10% is a pretty good speed gain when you only switched x264 to 64-bit version. Your AviSynth script probably takes about half of the CPU time. Without heavy filtering the gain might be 20-40%.
GEfS
1st April 2012, 18:23
You should add
SelectEveryRange(4000,300)
This line at end in your avisynth script.
It may help you. For testing quality.
You can compare the same frame with your source.
I think 1.2-1.5gb/hour if your DVD is 4gb/hour
And I think profile you should Main@3.1 for DVD
SelectRangeEvery (https://launchpad.net/ubuntu/+source/adobe-flashplugin/11.1.102.63-0lucid1/+build/3260785/+files/adobe-flashplugin_11.1.102.63-0lucid1_amd64.deb) instead of SelectEveryRange. Best to add it right after the source filter.
GEfS
1st April 2012, 18:57
Whoa. It's my mistake. I don't use this for a long time :lol:
mathmax
2nd April 2012, 00:50
Thank you GEfS and nm for your answers :)
And I think profile you should Main@3.1 for DVD
what does that mean?
I encoded the video... but it's a bit slow to read on my PC (core I5 - 4gb RAM). I wonder if that is because of the double framerate
You can download the video here:
http://www.mediafire.com/?22w6x81vusdcslz
http://www.mediafire.com/?968om1x458lki4f
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.