Log in

View Full Version : when cropping, sar doesn't match 1/1


jasonwoo
16th November 2012, 14:19
Hi everyone,

I am encoding a h264 source file with a resolution of 1920x1080.

I have to crop the left side for 2 pixels,so the size is 1918x1080.

And I want to resize it to 1280x720, but x264.exe report

crop [info]: cropping to 1916x1080
resize [info]: resizing to 1280x720
x264 [info]: using SAR=479/480

I noticed that without cropping ,the sar will be 1/1.

So, am I cropping and resizing in the right way? if is not, how to crop and using sar?

Thanks a lot.

jasonwoo
16th November 2012, 14:22
After some google...Here is the new command line:


--vf crop:2,0,0,0/resize:1280,720,1:1


instead of

--vf crop:2,0,0,0/resize:1280,720


so ,is there any difference between the two commands?

Keiyakusha
16th November 2012, 16:28
you're not supposed to do so. If you do such cropping, then resize 1918x1080 to 1920x1080 after (or do crop+resize in one step, depending on what you use). SAR should stay 1 in this case.

Edit: oh I missed your 2nd post somehow. That looks like achieves the same as what I was talking about above. As for the same or not - I'm not sure. Picture should be the same, but there may be the case of witting or not writing sar info to the stream (in the builds I use I don't recall resize filter at all, only crop). Someone else may comment on this.

So, am I cropping and resizing in the right way?
you was cropping and telling it to resize on playback. Which is very common solution but not good in your case.

bxyhxyh
16th November 2012, 19:25
x264's resize is little bit different on the sar. Even if you resize to AxB it will keep previous dar. (1916x1080's)

You need to use first code.

sneaker_ger
16th November 2012, 19:33
you was cropping and telling it to resize on playback. Which is very common solution but not good in your case.

More like cropping, resizing and telling the player to resize on playback on top of that.

bxyhxyh is correct. The filter will set SAR so that the previous DAR is kept, which is not always desired.