View Full Version : WVC-1 banding/blocking
bluesk1d
23rd July 2007, 15:07
I understand that the wvc-1 encoder doesnt pad bits and that even if you specify some CBR value, it will not necessarily use all of it if it doesn't think it needs to. I backed up The Matrix HD DVD the other day and the resulting bit rate was less than half of what I specified (rate specified was for DVD9 and the file ended up well below DVD5). Needless to say there was significantly more banding and blocking in the dark areas (the whole movie is dark) than the source. The dark underwater scenes in U-571 were particularly bad. I currently use Zambelli's wmcvbs in single pass with the preset "better" for all my encodes. Which setting would be the one to change to help ease dark area blocking (changing to 2-pass, changing preset to "best", etc.)?
benwaggoner
24th July 2007, 02:24
The best feature to help with banding is DQuant. You'll need to be using Advanced Profile for that. The default I & P Regular DQuant is fine.
Also -v_percopt 2 (Adaptive Deadzone) can further help banding issues in content with film grain.
Why are you using CBR? 2-pass VBR would be a lot better. And if you're doing 1-pass CBR, make sure you turn on Lookahead=16.
bluesk1d
24th July 2007, 14:45
Im sure VBR would be better but unfortunately this is for playback on the 360 and it really doesn't like VBR. It especially doesn't like it while streaming. Does the "better" preset have DQuant and v_percopt turned on? I won't be home for a while to look at the vbs to try to determine that. If it isnt, what would need to be added to the wmcvbs command line in order to turn on and define DQuant?
:thanks:
I encode most of my stuff for the 360 using quality vbr and it works fine, I stream it using TVersity. Have you updated your 360 with the spring update? Also, there's a bug in the spring update which makes high res WMV7/8 choppy so use only WMV9/VC1.
benwaggoner
24th July 2007, 19:04
Im sure VBR would be better but unfortunately this is for playback on the 360 and it really doesn't like VBR. It especially doesn't like it while streaming. Does the "better" preset have DQuant and v_percopt turned on? I won't be home for a while to look at the vbs to try to determine that. If it isnt, what would need to be added to the wmcvbs command line in order to turn on and define DQuant?
:thanks:
I actually wouldn't mess with the bands in the current WMCmd.vbs. We've learned more about the codec in recent months and Zambelli will need to refactor them to acccount for that.
Tell me something about the content you're encoding and how long you're willing to wait for it, and I can offer some recommendations.
benwaggoner
24th July 2007, 19:09
Oh, I see what you said above. For SD film source with a good quality encode without exceptionally slow encoding times, I'd do something like:
-v_codec WVC1
-v_mode 3
-v_keydist 8
-v_bitrate 2000
-v_performance 80
-v_pixelratio 40:33 (assuming you're passing in pixels directly - Xbox doesn't need square pixels)
-v_bframedist 1
-v_dquantoption 2
-v_loopfilter 1
-v_mmatch 0
-v_mslevel 4
-v_msrange 0
-v_percopt 2
bluesk1d
25th July 2007, 00:00
I will have to do some testing with these options. One other reason I was using CBR was to encode to DVD9 file size.
My current command line is this:
cscript.exe WMCmd.vbs" -input "X.avs" -output "X.wmv" -v_codec WVC1 -videoonly -v_mode 0 -v_preset better -v_bitrate X -v_keydist 30 -v_buffer 60000 -v_quality 100
I know there are conflicting opinions on the 60 sec buffer but it results in consistent smooth playback with no dropped frames on the PC or 360
Here is the "better" section of wmcmd.vbs which I have been using exclusively
case "better" ' Complexity = 3 / Lookahead = 16 / Loopfilter = On / B frames = 1 / MS Level = Auto w True Chroma / MS Range = Auto
if g_intVideoPerformance = -1 then g_intVideoPerformance = 60
if g_intVideoLookahead = -128 then g_intVideoLookahead = 16
if g_intVideoLoopfilter = -128 then g_intVideoLoopfilter = 1
if g_intVideoBFrameDist = -128 then g_intVideoBFrameDist = 1
if g_intVideoMSLevel = -128 then g_intVideoMSLevel = 4
if g_intVideoMSRange = -128 then g_intVideoMSRange = -1
Here is the "best" preset which I have not tried
case "best" ' Complexity = 4 / Lookahead = 16 / Loopfilter = On / B frames = 1 / MS Level = Integer Chroma / MS Range = Auto / Motion Match = Auto
if g_intVideoPerformance = -1 then g_intVideoPerformance = 80
if g_intVideoLookahead = -128 then g_intVideoLookahead = 16
if g_intVideoLoopfilter = -128 then g_intVideoLoopfilter = 1
if g_intVideoBFrameDist = -128 then g_intVideoBFrameDist = 1
if g_intVideoMSLevel = -128 then g_intVideoMSLevel = 1
if g_intVideoMSRange = -128 then g_intVideoMSRange = -1
if g_intVideoMMatch = -128 then g_intVideoMMatch = -1
benwaggoner
25th July 2007, 01:11
Ah, you're doing 1-pass CBR. In that case, you want Lookahead on. Still, 2-pass VBR would give you a much more efficient encode.
-v_keydist 30 is a little on the low size. 96?
Also, -v_quality 100 is going to cause a LOT of dropped frames - you're setting a really high minimum quality bar. If you can't go to 2-pass VBR, try reducing -v_quality to at least 90.
Ah, you're doing 1-pass CBR. In that case, you want Lookahead on. Still, 2-pass VBR would give you a much more efficient encode.
-v_keydist 30 is a little on the low size. 96?
Also, -v_quality 100 is going to cause a LOT of dropped frames - you're setting a really high minimum quality bar. If you can't go to 2-pass VBR, try reducing -v_quality to at least 90.
-v_keydist 30 is low? Really? 96 sounds like a huuge number!? In your Elephant´s Dream encode you use something like 6?
benwaggoner
25th July 2007, 17:55
-v_keydist 30 is low? Really? 96 sounds like a huuge number!? In your Elephant´s Dream encode you use something like 6?
Sorry :) - I was just using a different interal compression tool that gives keydist in frames. Keydist of 4-10 seconds is the typical range I'll use. I've never really seen more than 10 help with the modern implementations.
Sorry :) - I was just using a different interal compression tool that gives keydist in frames. Keydist of 4-10 seconds is the typical range I'll use. I've never really seen more than 10 help with the modern implementations.
Thanks for clearing that up, hehe. :)
bluesk1d
25th July 2007, 21:21
Also, -v_quality 100 is going to cause a LOT of dropped frames - you're setting a really high minimum quality bar. If you can't go to 2-pass VBR, try reducing -v_quality to at least 90.
A lot of people say to expect this but I have never had any dropped frames on any of my encodes. Perhaps the 60 second buffer helps that.
benwaggoner
26th July 2007, 01:08
A lot of people say to expect this but I have never had any dropped frames on any of my encodes. Perhaps the 60 second buffer helps that.
Yes, a 60-second buffer averages out a lot of things!
Still, 2-pass VBR would be a better choice, since it gives you no dropped frames and better control over peak data rate.
Note that the analysis pass in WMV is substantially faster than the encoding pass, so it doesn't take a full 2x more time to do 2-pass. I just did a very aggressive encode where the analysis pass was a full 10x faster than the encode pass (although I was doing crazy stuff like running in single-thread mode with full chroma search).
bluesk1d
27th July 2007, 17:22
So since I normally encode 1 pass CBR to DVD9 file size, I wouldnt even know where to begin for 2 pass VBR. Is there any way to make an educated guess at file size based on the complexity of the average movie? Id like to get as close to dvd5 or dvd9 as possible without going over obviously.
What would be a good wmcmd.vbs command line to start with?
:thanks:
benwaggoner
28th July 2007, 16:13
So since I normally encode 1 pass CBR to DVD9 file size, I wouldnt even know where to begin for 2 pass VBR. Is there any way to make an educated guess at file size based on the complexity of the average movie? Id like to get as close to dvd5 or dvd9 as possible without going over obviously.
2-pass VBR is actually more deterministic than CBR, since you get two passes. You can specify average bitrate as well as peak bitrate. So to convert your encoding from CBR to VBR, you can just change your
-v_mode 0
to
-v_mode 3
For HD I recommend -v_mode 4 so you can set a peak, but an SD encode playing back on a 360 won't ever get any peaks challenging for either the drive or player.
2-pass VBR also works for audio, which can improve quality. Thus:
-a_mode 3
What would be a good wmcmd.vbs command line to start with?[/QUOTE]
zambelli
29th July 2007, 04:42
bluesk1d, if you're seeing lower final bitrates than expected in feature-length CBR encoding, make sure your source content is getting properly decoded and IVTC'ed before it's served to the encoder. I think there are some issues in the existing HD-DVD backup workflow that seem to serve 29.97 fps with repeated frames even when the source is 23.976 fps. I typically see lower-than-expected bitrates in WME9 only when the source contains lots of repeated frames. If your final bitrate is 80% of your target bitrate, that's often a good indicator that some weird 23.976-->29.97 frame repetition is happening in the source processing (24 / 30 = 0.80).
bluesk1d
30th July 2007, 15:06
bluesk1d, if you're seeing lower final bitrates than expected in feature-length CBR encoding, make sure your source content is getting properly decoded and IVTC'ed before it's served to the encoder. I think there are some issues in the existing HD-DVD backup workflow that seem to serve 29.97 fps with repeated frames even when the source is 23.976 fps. I typically see lower-than-expected bitrates in WME9 only when the source contains lots of repeated frames. If your final bitrate is 80% of your target bitrate, that's often a good indicator that some weird 23.976-->29.97 frame repetition is happening in the source processing (24 / 30 = 0.80).
What would the culprit here be if this was the case? I am not too sure what to check. I use haali splitter and the windows media decoder DMO directly referencing the evo file ripped from the disk with either Fab or AnyDVD.
zambelli
30th July 2007, 23:26
What would the culprit here be if this was the case? I am not too sure what to check. I use haali splitter and the windows media decoder DMO directly referencing the evo file ripped from the disk with either Fab or AnyDVD.
I don't know exactly, but as a test, try writing out the .avs to a YV12 AVI first using VirtualDub. You don't have to write out the whole thing, just a 5 minute segment would be sufficient. Then open the .avi in VDub and make sure the framerate is 23.976 and that frames aren't being repeated (you'll have to framestep through the video to ensure this). If everything looks OK, try encoding that .avi to WMV and see if the bitrate is still falling short.
bluesk1d
3rd August 2007, 14:44
2-pass VBR is actually more deterministic than CBR, since you get two passes. You can specify average bitrate as well as peak bitrate. So to convert your encoding from CBR to VBR, you can just change your
-v_mode 0
to
-v_mode 3
For HD I recommend -v_mode 4 so you can set a peak, but an SD encode playing back on a 360 won't ever get any peaks challenging for either the drive or player.
2-pass VBR also works for audio, which can improve quality. Thus:
-a_mode 3
What would be a good wmcmd.vbs command line to start with?[/QUOTE]
Thanks for your help on this. Simply adding the dquant option helped a ton and also got rid of my problem where the encodes were sometimes half the size they should be. One more question: With 2-pass VBR does the average bitrate value you enter take into account the peaks that it uses? If it does, then you could obviously easily predict the file size with the bitrate value. With feature length HD content what would you recommend for a specified max peak bitrate if using mode4? Is the default 1.5x the average bitrate in mode3 not enough?
benwaggoner
3rd August 2007, 22:38
Thanks for your help on this. Simply adding the dquant option helped a ton and also got rid of my problem where the encodes were sometimes half the size they should be. One more question: With 2-pass VBR does the average bitrate value you enter take into account the peaks that it uses? If it does, then you could obviously easily predict the file size with the bitrate value. With feature length HD content what would you recommend for a specified max peak bitrate if using mode4? Is the default 1.5x the average bitrate in mode3 not enough?
Happy to help!
Yes, your file size with 2-pass VBR (in audio and video) in Windows Media should be very accurate, and let you predict final file size within a very tight range. As for what peak to use? It really depends on where it's going to play back. For example, targeting the Zune I'll use a 1500 Kbps peak, no matter if my average is going to be 500 or 1000.
So, where are you going to be playing the file back?
benwaggoner
3rd August 2007, 22:43
Also, I just did a blog post giving examples of encoding for device playback with WMV and MPEG-4 that might be interesting for you:
http://on10.net/Blogs/benwagg/hands-on-with-the-temporary-insanity-trailer/
bluesk1d
4th August 2007, 02:17
Happy to help!
Yes, your file size with 2-pass VBR (in audio and video) in Windows Media should be very accurate, and let you predict final file size within a very tight range. As for what peak to use? It really depends on where it's going to play back. For example, targeting the Zune I'll use a 1500 Kbps peak, no matter if my average is going to be 500 or 1000.
So, where are you going to be playing the file back?
The files are being played back from burned media on the 360 or a PC running XP (mostly the 360 since its attached to my 1080P display/surround receiver). The bitrates vary between 7 and 11Mbps depending on the length of the movie. I use Zambellis WMV bitrate calculator to determine the bitrate to use in order to have the movie fill a dual layer blank DVD. I heard some people have issues with VBR on the 360 so I would guess the peaks shouldnt be TOO high but Im not the expert here =P
benwaggoner
4th August 2007, 02:56
The files are being played back from burned media on the 360 or a PC running XP (mostly the 360 since its attached to my 1080P display/surround receiver). The bitrates vary between 7 and 11Mbps depending on the length of the movie. I use Zambellis WMV bitrate calculator to determine the bitrate to use in order to have the movie fill a dual layer blank DVD. I heard some people have issues with VBR on the 360 so I would guess the peaks shouldnt be TOO high but Im not the expert here =P
Oh, the 360 can handle crazy peaks. Over ethernet I've had 1080i with 40 Mbps peaks work.
Off good quality DVD-R media, I think 20 Mbps peaks should be safe.
CruNcher
4th August 2007, 07:43
@benwaggoner
hmm why did they used cineform with a FX1 makes no sense to me i mean you can edit the .m2t (Mpeg-2 HP HD 25 MBps) virtualy everywhere encoding this into (intermediate) lossy Cineform makes no sense or did only you get the source in cineform ? intermediate H.264 (x264 cabac) would have been a better choice here btw (for Mpeg-2 8-bit Material ;) but then the H.264 encoding would have had an advantage also.
Btw: Did you @ Microsoft test how VC-1 would do as a intermediate solution (sounds especialy interesting because of the lower (decoding) complexity Microsoft advertises) ? i mean in my last test i didn't test it only Canopus,Cineform and H.264 (x264 cabac) over 10 generations H.264 (x264 cabac) shown the best results and ofcourse compression with Mpeg-2 8-bit Source (but looking at Sagittaires Speed test of the VC-1 Decoder wmvdecod.dll 11.00.5721.5145 vs CoreAVC 1.3/5 seems to make this allready a win situation for H.264 without even testing it)
Again, another H.264 encoder could have done a better job here, although at the cost of higher decode requirements, by using features like CABAC and multiple reference frames. High Profile, and hence 8x8 blocks, are not compatible with QuickTime's H.264 decoder, nor those in the AppleTV or iPod. The iPod-required Simple Profile doesn't support B-frames or CABAC.
At least you mention this but fact is X264,Mainconcept/Elecard and Ateme would all yield better quality (you use Dquant those have Psy Optimizations) @ the same settings then Quicktimes H.264 (Quicktime Player Windows Consumer Encoder) dunno if this also applies for the encoder working inside FCP tough.
And Apple does it right here for their Mobile solutions it's better to go with low complexity encodes on small displays you don't see the difference if useing Cabac 10% bitrate save and B-frames but you have a imense power lose (decoding) for their Internet Trailers its the same the 10% bitrate advantage compared to the quality difference is marginal for this usage scenario (HVS) somebody should finaly proof that H.264 (Sony PSP, Ipod) can be as complex and good looking as a VC-1 encode on a Mobile device such as the Zune with even the same battery life (even longer).
And also it's very unserious of you to not mention the encoding speed of both encodes.
and you should change the H.264: to H.264: Apple Quicktime Player Windows Consumer Encoder and the VC-1: to VC-1: Microsoft WMP11 (1 year old) Consumer Encoder
Apple imho goes a very balanced way especialy with the Source they working, if they had a better encoder with psy optimizations and all the goodies the rest has it would be perfectly balanced in terms of Encoding/Decoding/Detail Preservation/(HVS) Quality these 4 factors have to be taken into account and tweaked for a overall good encoder (and that takes alot of time and research) (and who really knows what for a Encoder Apple is useing, for their Trailer surely not the Quicktime Player Windows Consumer Encoder ;) )
Here's some samples from the available clips that show different levels of banding. Sorry the luma levels don't quite match - it's surprisingly difficult to get exact level screen grabs out of the QuickTime and DirectShow pipelines.
Why didn't you decode it with a Directshow Decoder as (CoreAVC) then :P
anyways you should shake hands with Apple both of you give out old outdated technology (1 year old encoder jesus) (it wouldn't suprise me if somebody takes up the VC-1 Encoder source and put's out improvements faster then Microsofts Codec team themselves (for the public use) Elecard/Mainconcept might have allready done so on the commercial side maybe it get's soon public) to consumers and can't keep up, because of to much release politics inside (bundle the new version with WMP12 in the next year most probably) :D
EDIT: OooPs could some Mod move this Post into that thread http://forum.doom9.org/showthread.php?t=128226 thx ;)
benwaggoner
4th August 2007, 19:15
@ CruNcher
Just a couple of points:
This is actually with an only few weeks old version of the QuickTime 7.2 H.264 encoder. The cite some improvements in H.264, but I haven't seen anyone share any details on those yet.
As far as using old encoders, well, that's how most content gets done. Here on Doom9, folks are using the latest builds of stuff a lot, but most consumers and big web sites use official builds of codecs, and don't switch them very often so they don't have to continually be doing compliance testing.
Yeah, I should go back and redo the screen shots via AVS. As it was I came to bed two hours late working on that post :).
As for the use of CineForm, it's much easier to edit it, since it's I-frame only, and offers a bunch of real-time effects. I've been impressed with its multigenerational quality when going round trip into After Effects and such. The director made this post about his editorial workflow:
http://blog.halsteadyorkcompany.com/?p=20
As for VC-1 as an intermediate, it's actually used by some post houses for that. However, since it's an interframe codec, it's not really appropriate for stuff that's going to be further edited or processed.
I'm more excited about the potential of a Motion JPEG XR.
CruNcher
4th August 2007, 21:18
However, since it's an interframe codec
isn't it possible to turn off interframes and only use intraframe coding in VC-1 ? if it is where is the problem, absolutely no problem for H.264 (all important Vendors support minkey and maxkey (and constant quant encoding) and i tested with 10 generations x264 cabac intraframe (Source: Mpeg-2 8-bit HD) and it was more efficient then CineForm and Canopus (and it was almost as fast @ decoding with CoreAVC (Preview and Encoding) and should be even faster with the 2nd Generation H.264 Hardware accelleration (only for Preview Purpose as of now soon could change) by Nvidia/Ati so perfect for small budget post productions, because it's free compared with Cineform and Canopus *rofl*) that says alot if you ask me (sure CineForm has the 10-bit advantage but for 8-bit source this is marginal) :D
Every average joey could yield 20% less Bitrate for the same Quality (slightly better) then CineForm or Canopus reach currently for HDV (editing) this is perfect :P
I'm more excited about the potential of a Motion JPEG XR.
This doesn't suprise me but there is still Dirac and Snow and who the hell needs HDR 32 bit geez i would be happy with full 10 bit support (everywhere) :D
benwaggoner
5th August 2007, 06:11
isn't it possible to turn off interframes and only use intraframe coding in VC-1 ? if it is where is the problem, absolutely no problem for H.264 (all important Vendors support minkey and maxkey (and constant quant encoding) and i tested with 10 generations x264 cabac intraframe (Source: Mpeg-2 8-bit HD) and it was more efficient then CineForm and Canopus (and it was almost as fast @ decoding with CoreAVC (Preview and Encoding) and should be even faster with the 2nd Generation H.264 Hardware accelleration (only for Preview Purpose as of now soon could change) by Nvidia/Ati so perfect for small budget post productions, because it's free compared with Cineform and Canopus *rofl*) that says alot if you ask me (sure CineForm has the 10-bit advantage but for 8-bit source this is marginal) :D
Sure, VC-1 can run in pure intraframe mode.
As for H.264 in intraframe, they're actually working on a new profile for that, without CABAC and a simpler loop filter, to provide adequate performance for HD. CABAC can get scary at really high bitrates.
In general, wavelet or similar codecs are more efficient for intraframe than DCT-based codecs (which really shine when motion estimation is mixed in).
Every average joey could yield 20% less Bitrate for the same Quality (slightly better) then CineForm or Canopus reach currently for HDV (editing) this is perfect :P
Sure - Cineform isn't supposed to have more compression efficiency than JPEG 2000. It was meant to have better decode/encode performance with competitive compression efficiency and less annoying artifacts than JPEG.
This doesn't suprise me but there is still Dirac and Snow and who the hell needs HDR 32 bit geez i would be happy with full 10 bit support (everywhere) :D
JPEG-XR supports pretty arbitrary colorspaces, so you could pretty much do whatever set of primaries and subsampling you wanted (like Y'CbCrA, 12-bit, whatever). I like a small decoder that can handle pretty much any kind of image.
bluesk1d
7th August 2007, 18:22
Oh, the 360 can handle crazy peaks. Over ethernet I've had 1080i with 40 Mbps peaks work.
Off good quality DVD-R media, I think 20 Mbps peaks should be safe.
That raises another question... What have you found to be a good cost/performance blank dual layer media? I have some cheap (approximately $1.50/each) Memorex DVD+R DL and the 360 has issues mounting it. It normally has to be in the drive when the 360 powers on to even read it. Once it recognizes a disc it never has a problem playing back a file though.
zambelli
7th August 2007, 18:44
It's not the cheapest, but generally Verbatim DVD+R has always been the most reliable media, for both single and dual layer.
benwaggoner
7th August 2007, 20:03
That raises another question... What have you found to be a good cost/performance blank dual layer media? I have some cheap (approximately $1.50/each) Memorex DVD+R DL and the 360 has issues mounting it. It normally has to be in the drive when the 360 powers on to even read it. Once it recognizes a disc it never has a problem playing back a file though.
I've mainly used Reitek DVD-5 SL media with my 360, just because that's what my current spindle has.
Sagittaire
7th August 2007, 20:05
I've mainly used Reitek DVD-5 SL media with my 360, just because that's what my current spindle has.
You don't have PS3 ... it's curious ... :devil:
foxyshadis
8th August 2007, 01:00
You don't have PS3 ... it's curious ... :devil:
Indeed, it's all about the PSTRIPLE (http://video.google.com/videosearch?q=chad+warden).
</gratuitous excuse to post chad warden for epic lulz>
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.