Try DVDFab and download streaming video, copy, convert or make Blu-rays,DVDs! Download free trial !

# Filtering help needed

Thread
1. Ok. thanks for the info
2. I have the BD of taxi driver which i want to encode to 720p. After doing the calculations for resizing the resolution is 1334x720

--sar calculation

16/9 = 1334/720*x/y
x/y = (16*720)/(9*1334) = 640/667

is this correct?
3. looks like you are mixing DAR&PAR
4. I don't understand. Can you explain what i did wrong?
5. 1080p BD ia always 1:1 SAR. Just resize to 1280x720, crop away the black borders, and encode square pixel. According to IMDB Taxi Driver was shot at 1.85:1. So you should have a ~1280x692 frame when done (1280 / 1.85 ~= 692). Or if you want a 720 pixel high picture, 1332x720 (720 * 1.85 = 1332).
6. I found this useful resizing guide
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Here is a very short guide to cropping and resizing.

1. Always first crop the 1080p source and then resize to 720p. Never do it the other way around! And no, it is not the same thing. Cropping and resizing do not "commute".

This procedure will minimize the aspect ratio error, thus giving you picture geometrically more close to the original, which is particularly important if the 720p encode is going to get upscaled, e.g. viewed on a FullHD display.

2. After cropping the 1080p source, determine the aspect ratio (short: AR) of your source: AR = horizontal / vertical.

Note that Full BDs / Remuxes without cropping usually come with resolution 1920:1080, which implies aspect ratio of 16:9=1.77(7) of the full frame. Most of the time, however, the frames contain black bars, sometimes very tiny ones, top-bottom or left-right or both (latter is common for transfers of older movies).

3. After determining the source AR, you need to compute the resolution for the 720p encode. Note that the 720p standard prescribes maximal horizontal resolution of 1280px and maximal vertical resolution of 720px. This implies the following two cases:

- if the AR > 16:9=1.77(7), then your horizontal resolution is fixed to 1280px and you need to compute the vertical resolution from the existing data: vertical=1280/AR;

- if the AR < 16:9=1.77(7), then your vertical resolution is fixed to 720px and you need to compute the horizontal resolution from the existing data: horizontal=720*AR;

Remark 1: When computing the horizontal or vertical resolution for your 720p encode, it is better to work with the AR as a fraction to avoid rounding errors.

Remark 2: The resulting horizontal or vertical resolution may happen to not be an (even) integer. In this case you will have two possible even integers to round up the result to. You will have to choose the one that minimizes the AR error.

Example:

Assume resolution after cropping for our 1080p source is 1908:1066. Then AR=1908/1066=1,789868667917448 > 1.77(7)=16:9 => the horizontal resolution is fixed to 1280px and the vertical is given by: vertical=1280/AR=(1280*1066)/1908=715,1362683438155. Thus we have two possibilities for the vertical resolution: either 716px or 714px.

1280/716=1,787709497206704 => absolute AR error=|1,787709497206704-1,789868667917448|=0,0021591707107441

1280/714=1,792717086834734 => absolute AR error=|1,792717086834734-1,789868667917448|=0,002848418917286

Thus the best vertical resolution is 716px.

Hope this helps!

-----------------------------------------------------------------------------------------------------------------------------------------------------------
7. Originally Posted by x264
1. Always first crop the 1080p source and then resize to 720p. Never do it the other way around!
Nonsense. You're talking about fractions of a single percent here, nothing to worry over, especially given it's way easier to resize first to 1280x720 before then cropping.

In his example at the end (although it's an example of something different, the scale isn't all that far from what we're discussing), the difference is less than a tenth of a percent. It's generally said people can't begin to spot AR error unless it's about 2% or greater. Yes, we all want to be as accurate as possible, but I'd say the chances are the source has an AR error greater than the one you might create by resizing first.
8. Resizing before cropping can result in a bright row of pixels just inside the black border if you use a sharpening resizer like LanczosResize(). This is a case where cropping before resizing is better.

I would never use a mod2 frame size. Some devices will choke on that. Stick with mod4 or better.

What I sometimes do is resize first, then crop -- just to see what the final frame size should be. Then go back and crop first, and resize to the nearest mod4 frame dimensions.

There's no reason the width has to be 1280 or the height has to be 720. Use whatever sizes you want. Unless you have a device with playback restrictions.
9. Is it necessary to set --sar value or will x264 automatically set it for me?
10. Originally Posted by jagabo

I would never use a mod2 frame size. Some devices will choke on that. Stick with mod4 or better.
I watch encoded movies only on my pc.
11. Is it necessary to set --sar value or will x264 automatically set it for me?
if not specified, x264 will use '--sar 1:1'
12. Originally Posted by Selur
Is it necessary to set --sar value or will x264 automatically set it for me?
if not specified, x264 will use '--sar 1:1'
That isn't quite true. If no sar is specified on the command line there will be no sar specified in the video. In the absence of any sar information players will assume square pixel.
13. Should i use .dts extension when i extract this audio track using eac3to?
14. .dtsma is typically used for DTS-MA
.dts would normally be used when extracting just the core dts-stream
15. How do you find out how many b-frames are actually used in a video?

x264 [info]: consecutive B-frames: 5.4% 26.1% 54.3% 8.4% 4.0% 1.2% 0.3% 0.1% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.2%
16. look at the whole output:
...
x264 [info]: profile Main, level 4.1
x264 [info]: frame I:3 Avg QP:16.67 size: 18751
x264 [info]: frame P:168 Avg QP:13.30 size: 11986
x264 [info]: frame B:258 Avg QP:15.27 size: 4010
x264 [info]: consecutive B-frames: 6.3% 31.2% 28.0% 34.5%
x264 [info]: mb I I16..4: 47.2% 0.0% 52.8%
x264 [info]: mb P I16..4: 28.2% 0.0% 0.0% P16..4: 68.0% 0.0% 0.0% 0.0% 0.0% skip: 3.8%
x264 [info]: mb B I16..4: 3.4% 0.0% 0.0% B16..8: 47.3% 0.0% 0.0% direct:12.3% skip:37.0% L0:30.9% L1:35.3% BI:33.7%
x264 [info]: final ratefactor: 13.38
...
"frame X: Y" outputs how many (Y) frames of type X got encoded
17. What do those percentages in the consecutive b-frames row tell us?
18. for my output:
x264 [info]: frame B:258 Avg QP:15.27 size: 4010
x264 [info]: consecutive B-frames: 6.3% 31.2% 28.0% 34.5%
-> 6.3% of all the b-frames are on their own
31.2% of all the b-frames are in a group of two (two consecutive b-frames)
28% of all the b-frames are in a group of three (three consecutive b-frames)
34.5% of all the b-frames are in a group of four (four consecutive b-frames)

Cu Selur

ps.: fixed the sentence from above
pps.: read: http://mewiki.project357.com/wiki/X264_Stats_Output
19. so for your source anything above --bframes 4 is a waste of time?
20. No, since there are only 4 column, it means that I restricted the number of consqutive B-brames.
When I use "--bframes 16" I get:
Code:
```"G:\Hybrid\x264.exe" --pass 2 --bitrate 1500 --profile high --level 4.1 --ref 16 --bframes 16 --direct auto --sync-lookahead 28 --qcomp 0.5 --no-mbtree --partitions i4x4,p8x8,b8x8 --no-fast-pskip --subme 5 --trellis 0 --weightp 1 --aq-mode 0 --vbv-maxrate 62500 --vbv-bufsize 78125 --non-deterministic --colormatrix bt470bg --stats "H:\Temp\test_new_06_37_26_4710_01.stats" --input-csp i420  --fps 25000/1000 --input-res 640x352 --output "H:\Temp\test_new_06_37_26_4710_02.264" -
raw [info]: 640x352p 0:0 @ 25/1 fps (cfr)
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
x264 [info]: profile High, level 4.1
x264 [info]: frame I:3     Avg QP:11.33  size: 26497
x264 [info]: frame P:161   Avg QP:13.02  size: 12430
x264 [info]: frame B:265   Avg QP:14.66  size:  4252
x264 [info]: consecutive B-frames:  5.8% 31.2% 27.3% 13.1% 19.8%  2.8%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%  0.0%
x264 [info]: mb I  I16..4:  0.9% 69.2% 29.9%
x264 [info]: mb P  I16..4: 12.2%  0.0% 11.4%  P16..4: 25.3% 22.5% 27.5%  0.0%  0.0%    skip: 1.1%
x264 [info]: mb B  I16..4:  2.0%  0.0%  0.7%  B16..8: 43.7% 23.1%  4.4%  direct: 6.1%  skip:19.9%  L0:39.7% L1:38.9% BI:21.4%
x264 [info]: 8x8 transform intra:4.3% inter:35.0%
x264 [info]: direct mvs  spatial:80.8% temporal:19.2%
x264 [info]: coded y,uvDC,uvAC intra: 68.3% 55.1% 27.4% inter: 25.5% 16.1% 1.1%
x264 [info]: i16 v,h,dc,p: 29% 16% 43% 12%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 19% 52%  2%  1%  1%  1%  1%  2%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 19% 21%  4%  6%  7%  5%  5%  4%
x264 [info]: i8c dc,h,v,p: 52% 19% 25%  4%
x264 [info]: Weighted P-Frames: Y:0.6% UV:0.0%
x264 [info]: ref P L0: 68.3% 15.3%  5.1%  2.5%  1.8%  1.5%  1.2%  0.7%  0.6%  0.6%  0.5%  0.5%  0.5%  0.5%  0.4%  0.1%
x264 [info]: ref B L0: 81.5% 12.8%  2.1%  0.9%  0.6%  0.5%  0.4%  0.2%  0.2%  0.2%  0.2%  0.2%  0.1%  0.1%  0.1%
x264 [info]: ref B L1: 92.5%  7.5%
x264 [info]: kb/s:1495.42
encoded 429 frames, 148.80 fps, 1495.42 kb/s```
-> more than 6-bframes in a row didn't get used with this source
Years ago a lot of folks did some testing and the most used are normally 3-4 bframes and everything above 6 is really rare for non cartoon content, so using more than 6-bframes in a row does rarely do more than slowing down the encoding.
21. Thanks for the explanation .
22. Ref
This is a no-brainer parameter that requires no testing but is critical for yielding the highest possible quality without breaking standalone device (Popcorn Hour, WDTV Live, Roku) playback. Taken directly from the HD encoding guide:
Once you have cropped your source in AvsPmod or whatever other script editor you are using, take the equation 8388608 / (width after cropping x height after cropping), inputting your source's width and height in what I hope are obvious enough placeholders. Take the result and round it down to the nearest whole number. This is the number you are to use for the --ref setting.
http://www.reddit.com/r/trackers/comments/wevh2/good_beginning_x264_reference_guide/
Is this the correct?
23. Too bad they didn't care to elaborate where their magic number '8388608' came from.
My guess is that they try to stay compatible to a specific profile&level and do not care to explain properly (at least in a side note) why they use this number.
http://forum.doom9.org/showthread.php?t=142758 might be interesting.

-> Personally, I wouldn't use that formula.
24. Ok. How do i know what --ref value that i should set for my source?
• your source does not really matter when you need to specify the reference count or any other x264 setting, only the target format does.
• unless you need to be compatible to a specific hardware decoder <> profile&level-combination you can use as many references as you like
(more references <> potentially more compression for the same quality, but more stress on decoder)
• if you need to obey a specific restriction (profile&level or similar), you need to either:
- use a gui which makes sure you do not violate the restriction (in example Hybrid does this for the profile@level restrictions and Blu-ray compatibility (if configured accordingly)
or
- you need to calculate the max number of allowed references for your restriction.
The doom9-thread I linked to above explains how this is done for the normal profile@level restrictions.
The quote you quoted uses some unspecified (and probably simplified) restriction.

Cu Selur
25. Which resizing should i use for photos? Is it ok if i use spline resizer for this? I resized the photo with irfanview but it looks very bad.
26. Use whichever resizer looks best for the particular photo. If your source is already sharp a sharp resizer will create oversharpening halos. And are you upscaling or downscaling? And by how much?
27. I'm downscaling from 825x1163 to 150x211. I want to use it as avatar.

image
28. Resized to 150x212. Bilinear, Bicubic, Spline16, Lanczos:

29. How do i install avisynth+ 2172 MT-test?. I downloaded the rar file from the cloud.pados.hu but there is no installer after extracting the folder. I'm using windows 10 x64

In the extracted folder there are two folders i386 and x64.

Also where i should i copy the devil.dll to? system32 folder or SysWOW64.

Edit: Selur gave me the answer in pm

dll location depends on whether you use a 32bit or 64bit avisynth(+) version.
32bit dlls belong into the SysWOW64 folder
64bit dlls belong into the system32 folder

Statistics