View Full Version : Bluray/AVCHD Compliant x264 encoding. Black Bars/ cropping ?
ACrowley
5th February 2009, 15:02
Hi
I want encode/author some Bluray reencodes Files and HDTV Caps to AVCHD.
I use megui with Sharktooth AVCHD standalone Profile.
Standalone Player is a Sony BDP S350 + Sony Bravia 40Z4500 40" 200hz FullHD 24p
Usually i crop all my Bluray/HDTV encodes to 1920x800 (816 etc) or 1280x544(,536,528 etc) since Years for PC Playback only. So I never had to think about encoding without proper cropping/Resize.
But now i need more compliant Streams with my new Bluray SA Player.
When i author a 1920x800 Video File to AVCHD, i get a Full Screen Playback without Black Bars on my Sony BDP S350... sure, because it was cropped. My Sony BDP S350 plays 1920x800 x264 Files , but with incorrect AR
Now, what should i do to get compliant 1920x1080 or 1280x720 encodes ? Should i leave and encode 1920x1080 fully uncropped with Black Bars? Or cropping + adding black bars in my avs ?
And when ,isnt it a Problem for x264 efficiency when i encode with Black Bars ?
Sagekilla
5th February 2009, 16:32
You can safely leave the black bars and encode at the original 1080p. The black bars will take up an -extremely- insignificant amount of bits. Since they're almost always pure black, x264 will encode them very well. If you're concerned whether it's completely black and has no noise though, you can crop the borders then add them back in again to be sure. Shouldn't be necessary though.
Audionut
5th February 2009, 16:37
Crop and resize, then add borders. So for your 1280x*** stuff for example.
***source(c:\yoursource.***)
crop(0,144,-0,-144)
spline36resize(1280,528)
addborders(0,96,0,96)
You need to maintain 1920x1080 or 1280x720.
Black bars won't hurt x264.
Snowknight26
5th February 2009, 19:32
Maybe not the black bars themselves, but the abrupt change from the film -> black bars might.
Sharc
5th February 2009, 23:15
You may also want to take advantage of anamorphic encoding:
I usually crop the pictures to remove the black borders (e.g 132 pixels on top and bottom), then resize the remaining active picture to 1280x720 and set the sar accordingly for anamorphic encoding (45:34 in this case) instead of adding useless black borders. Works perfectly for PC / projector playback. I could not yet test the technique on a BD standalone, but I imagine it should work there as well, because anamorphic encoding is included in the BluRay spec IIRC.
ACrowley
6th February 2009, 00:23
Crop and resize, then add borders. So for your 1280x*** stuff for example.
***source(c:\yoursource.***)
crop(0,144,-0,-144)
spline36resize(1280,528)
addborders(0,96,0,96)
You need to maintain 1920x1080 or 1280x720.
Black bars won't hurt x264.
ah ok
So for a 1080p (190x800) encode its :
Crop(2, 140, -2, -140) # i have to crop 2 black lines left and right
spline36resize(1920,800)
addborders(0,140,0,140)
Sagekilla
6th February 2009, 05:36
If you don't want to have to worry about sharp transitions, crop a little bit extra. Do a Crop(2,144,-2,-144) and AddBorders(0,144,0,144). Then you'll have 9 MBs high of pure black, with no film inside of it.
ajp_anton
6th February 2009, 06:36
If you don't want to have to worry about sharp transitions, crop a little bit extra. Do a Crop(2,144,-2,-144) and AddBorders(0,144,0,144). Then you'll have 9 MBs high of pure black, with no film inside of it.You would have 9 MBs (macroblocks) at the top, but not at the bottom, as the video in the middle is 49.5 MBs. Remember that 1080 is 67.5 MBs.
If the video is 800 pixels high, use crop(0,140,0,-140) and addborders(0,144,0,136) if you dont mind the picture being not exactly in the middle.
ACrowley
6th February 2009, 09:51
You would have 9 MBs (macroblocks) at the top, but not at the bottom, as the video in the middle is 49.5 MBs. Remember that 1080 is 67.5 MBs.
If the video is 800 pixels high, use crop(0,140,0,-140) and addborders(0,144,0,136) if you dont mind the picture being not exactly in the middle.
Ok...but i think i want the picture in the Middle...
However, my Target is only AVCHD, to play it on Sony BDP S350....ive no Bluray burner.
And the Maximum Bitrate/VBV Buffer (~17-18 Mbps) is imho a little bit to low for 1080p encoding.
turbojet
6th February 2009, 10:15
You may also want to take advantage of anamorphic encoding:
I usually crop the pictures to remove the black borders (e.g 132 pixels on top and bottom), then resize the remaining active picture to 1280x720 and set the sar accordingly for anamorphic encoding (45:34 in this case) instead of adding useless black borders. Works perfectly for PC / projector playback. I could not yet test the technique on a BD standalone, but I imagine it should work there as well, because anamorphic encoding is included in the BluRay spec IIRC.
Interesting idea, I will try this on a BD player soon.
Do you know of a calculator or formula to get the correct sar?
Also have you done any compressibility and quality tests of anamorphic vs encode with borders?
Audionut
6th February 2009, 11:07
If your keeping it at 1080p just re-encode it. No need to crop and resize and addborders.
17Mbps is more than enough for 1080p with x264.
See here. http://forum.doom9.org/showthread.php?p=1245053#post1245053
Ok, so it's animation and it's not perfect. But it is only 1.5Mbps.
turbojet
6th February 2009, 11:36
Ya 17 mbps avg bitrate is plenty with 1080p x264.
I agree with ACrowley though that 17-18 mbps max bitrate is too low for most movies at 1080p but it also depends on the average bitrate.
I've done many 1080p at 5-10 mbps avg bitrate (25 mbps max) that exceed 20 mbps at least a few times during the movie.
ACrowley
6th February 2009, 12:31
@ Audionut
I was talking about "maximum Bitrate".."not" average Bitrate.
Ofcourse 17Mbps Average ist Nonsense for x264. That was not the Point
Usually i encode 1080p with 40-50Mbs maximum Bitrate/VBV Buffer .
I use "average" Bitrates for 1080p x264 around 8-12Mbps which is enough in "Fact".
The final Slice i/p/b Quantizer are always under 21
It depends on the Source. Sometimes you get 1080p at 7Mbps with 18 Quantizers ,other grainy high Action Videos with 12Mbps and 21-23 Quantizers
But in Fact Quantizers around 18-23 are totally enough, no need to give more Bitrate. Its a Waste of Space.
~17Mbps "Maximum" Bitrate is a little bit low for 1080p Bluray Sources.
The Problem with AVCHD Encodes for standalones is the maximum Bitrate.
Ofcourse 17Mbps maximum is enough for 720p.
But for Movies like Casino Royal Bluray /300 / BlackHawk Down etc...17Mbps maximum for 1080p isnt enough in those Cases, imho
Mhhh...i think i should by a Bluray Burner :) No Problem anymore with ~40Mbps maximum Bitrates :)
Ok, when i directly encode to 1080p (1920x1080 Compliant Resolution for SA Players)..should i crop and add Borders or not ? Is there any Benefit/disadvantage against cropping+add Borders ?
sorry, my English i not good...
Audionut
6th February 2009, 13:17
@ Audionut
I was talking about "maximum Bitrate".."not" average Bitrate.
I never mentioned average bitrate!!!
You should really do your own tests. My best guess is that your using your own eyes to view the footage. And it's your own perception of whether it looks good or not.
Is there any Benefit/disadvantage against cropping+add Borders ?
Waste of CPU cycles.
Sagittaire
6th February 2009, 14:18
Well In practice all the HDDVD was at 20 Mbps for maxrate with VC1 ... and the quality was not so bad ... :devil:
ACrowley
6th February 2009, 19:34
I never mentioned average bitrate!!!
You should really do your own tests. My best guess is that your using your own eyes to view the footage. And it's your own perception of whether it looks good or not.
Waste of CPU cycles.
Ah Ok ,Thx for you help :)....
but as i say, 17Mbps Maximum Bitrate for x264 1080p can be to low for some HD Sources, "imho".
But i was doing some WVC1 1080p encodes with 18Mbps Peak Bitrate, and they all was looking very good ,as Sagittaire said about VC1
Yes, ive to test it, maybe my Sony BDP S350 can handle 1080p ~20Mbps. That would be Ok for me
And i have to say that i must use DVD5/9. Sadly i have no Bluray burner. That is the Problem because the Bitrate is restricted for DVD.
Sharc
6th February 2009, 20:29
Interesting idea, I will try this on a BD player soon.
Do you know of a calculator or formula to get the correct sar?
Also have you done any compressibility and quality tests of anamorphic vs encode with borders?
Assuming a sar of 1:1 for the original (normal case for BD):
sar = (resized_height x cropped_width) : (cropped_height x resized_width)
Example:
Original picture = 1920 x 1080
- Border top = 132
- Border bottom = 132
- No left and no right borders
=> cropped active picture = 1920 x 816
You want to resize the active picture to 1280 x 720 (compliant BD resolution)
--sar = (720x1920) : (816x1280)=1382400:1044480=45:34
Quality is better, because with anamorphic resizing you preserve the original vertical resolution better (fully exploiting 1280x720 for the active picture) than by wasting some of the vertical resolution with useless borders.
Sagittaire
6th February 2009, 20:42
1920x1080 and 1280x720 are not anamorphic for BluRay and must be at 1:1. Anamorphic ratio has nothing to do with black borders ...
Sharc
6th February 2009, 21:22
I didn't say that. Just read my post carefully.
Sagittaire
6th February 2009, 21:34
Quality is better, because with anamorphic resizing you preserve the original vertical resolution better (fully exploiting 1280x720 for the active picture) than by wasting some of the vertical resolution with useless borders.
Make anamorphic encoding 1920x816@1280x720 is really not standard and not really usefull.
Sharc
6th February 2009, 22:29
Make anamorphic encoding 1920x816@1280x720 is really not standard and not really usefull.
not useful?
Compare the resolutions of the active picture:
- Original picture with sar 1:1 => 1920 x 816 = 1'566'720 pixels
- Normal resizing with sar 1:1 => 1280 x 544 = 696'320 pixels
- Anamorphic with sar 45:34 => 1280 x 720 = 921'600 pixels
I see anamorphic as a good compromise for putting a 2 hours movie plus 2 ac3/640 kbps language tracks on an BD5.
Non-usual, yes.
Sagittaire
6th February 2009, 23:41
not useful?
Compare the resolutions of the active picture:
- Original picture with sar 1:1 => 1920 x 816 = 1'566'720 pixels
- Normal resizing with sar 1:1 => 1280 x 544 = 696'320 pixels
- Anamorphic with sar 45:34 => 1280 x 720 = 921'600 pixels
I see anamorphic as a good compromise for putting a 2 hours movie plus 2 ac3/640 kbps language tracks on an BD5.
Non-usual, yes.
Well I don't think that 1280x720 with sar at 45:35 is compliant with BD spec. Display for 720p is always 16/9.
If you want reduce resolution you must use 1440*1080 ( 1440 x 816 = 1175040)
Sharc
7th February 2009, 09:10
Well I don't think that 1280x720 with sar at 45:34 is compliant with BD spec. Display for 720p is always 16/9.
If you want reduce resolution you must use 1440*1080 ( 1440 x 816 = 1175040)
... but then I am back to accepting top and bottom borders and an even bigger frame size.
1280x720 is a standard BD resolution, as is 1440x1080. So there is no problem at all from a frame size point of view with BD compliance.
The only question is if the playback device can cope with material which is encoded with sar other than 1:1. This also depends how the sar is signalled - i.e. in the video stream or in the container. Only tests will tell. Perhaps turbojet will come up with test results.
Sagittaire
7th February 2009, 10:14
... but then I am back to accepting top and bottom borders and an even bigger frame size.
1280x720 is a standard BD resolution, as is 1440x1080. So there is no problem at all from a frame size point of view with BD compliance.
The only question is if the playback device can cope with material which is encoded with sar other than 1:1. This also depends how the sar is signalled - i.e. in the video stream or in the container. Only tests will tell. Perhaps turbojet will come up with test results.
well no test needed ... 1280x720 must be at ratio 1:1 for BD. If you want anamorphic resolution you must use 720x480, 720x576 or 1440x1080.
Sharc
7th February 2009, 10:40
well no test needed ... 1280x720 must be at ratio 1:1 for BD. If you you anamorphic resolution you must use 720x480, 720x576 or 1440x1080.
Hmmm... is this really fixed in the BD standard? Means 1280x720 anamorphic works only for PC playback like mpc, vlc etc.?
Sagittaire
7th February 2009, 11:00
Hmmm... is this really fixed in the BD standard? Means 1280x720 anamorphic works only for PC playback like mpc, vlc etc.?
Yes you can't choose ratio like you want for DVD, HDDVD or BD. For 1280x720 diplay must be 16/9 or 4/3.
Sharc
7th February 2009, 15:05
Yes you can't choose ratio like you want for DVD, HDDVD or BD. For 1280x720 diplay must be 16/9 or 4/3.
I see. I was well aware of the DVD restrictions, but I thought BD, HDDVD and and their standalone players would be more flexible in this respect.
Thanks.
ACrowley
9th February 2009, 09:45
I see. I was well aware of the DVD restrictions, but I thought BD, HDDVD and and their standalone players would be more flexible in this respect.
Thanks.
My Sony BDP S350 "generally" plays 1920x800 /1280x544.
But in 16:9 Full screen cause 1920x800 is cropped
Sharc
9th February 2009, 19:43
If I understand it correctly, this means it plays cropped (0,140,-0,-140) -- and resized -- BD pictures correctly, without need to adding borders, as long as the sar remains 1:1 which is true in your case.
ACrowley
10th February 2009, 12:26
If I understand it correctly, this means it plays cropped (0,140,-0,-140) -- and resized -- BD pictures correctly, without need to adding borders, as long as the sar remains 1:1 which is true in your case.
NO! That means the Sony BDP S350 "generally" ( generally=no decoding Errors or incompatible Warnings etc) plays 1920x800 /1280x544 .
"But" the Picture is scaled to Full screen (1,778:1 instead of 2,35:1) without Black Borders (because 1920x800 is cropped without Black Bars).
So you have to add Borders when you want it with OAR.
When you like it with 16:9 Fullscreen....your choice
Sharc
10th February 2009, 20:10
Thanks for clarification. I was misled by what you meant with "generally".
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.