PDA

View Full Version : Video decoding with ffdshow - it won't get black


LigH
5th October 2010, 10:04
During my tests with WebM vs. MP4-AVC I found that playback via ffdshow always resulted in TV-scale output, which got pretty obvious in dark scenes which go down to pitch black in the PNGs released by the Blender project. So I made a little test with a very simple video:

BlankClip(1000, 640, 360, "YV12", 25)

This I converted to MPEG4-AVC using x264 rev. 1723, to Xvid using VirtualDubMod and Xvid 1.3, and to MJPEG using VirtualDubMod and ffdshow's VfW MJPEG codec. For playback I used MPC-HC 1.4.2505.0 and ffdshow rev. 3550.

Here are my results so far:

*.avs in VirtualDubMod, screenshot as PNG: PC-Scale (0, 0, 0).
*.mp4 in MPC-HC via ffdshow: no matter which renderer in MPC-HC, wether or not level correction in ffdshow, automatic or forced PC scale output -- always TV scale (16, 16, 16)
*.264 via DGAVCDec and AviSynth in VirtualDubMod: PC scale
*.xvid.avi: decoded by Xvid in VirtualDubMod = PC scale; decoded by ffdshow in MPC-HC = TV-Scale (*)
*.mjpg.avi: decoded by ffdshow-VfW in VirtualDubMod = TV scale; decoded by ffdshow in MPC-HC = TV scale (*)

(*) If level correction is enabled in Post-processing: gradual from TV scale to PC scale while playback advances; the second time I play the video after stopping, it starts in PC scale.

No matter what I try, I can't enforce ffdshow to decode a video in PC scale output for the whole first time.

Dark Shikari
5th October 2010, 12:13
Some video formats don't have a way to signal that the stream is supposed to be TV scale, or if they do, there's no reliable way that players pay attention to.

MJPEG should be PC scale, as JPEG uses 0-255 internally (it doesn't have a TV scale mode).

The solution I have for dealing with these is just to prevent colorspace conversions from happening. That is, do everything with the same app for decoding (ffmpeg) and don't convert out of YV12 until the final step (PNG screenshots).

Groucho2004
5th October 2010, 12:55
Try to change the "Dynamic Range" in the NVidia Control Panel to "0-255" (if you are using a NVidia card).
"Video" -> "Adjust Video Color settings" -> "Advanced"

LigH
5th October 2010, 13:37
Internal decoders in MPC-HC are disabled. ffdshow is active during playback; allowed output modes are only packed formats (RGB##; YUY2 etc., NV12), because YV12 output sometimes looked crappy (shifted planes), depending on the driver version (9600 GT here, 6800 GS there). I could not find a "Dynamic Range" control in the Nvidia Control Panel for this 9600 GT; PureVideo controls are set to "Use player settings" (or similar; german OS). I disabled ffdshow's DXVA decoder.

When I disable ffdshow decoding for Xvid and use the Xvid decoder, TV scale output appears only if I allow YUV output. If I enforce RGB output for the Xvid decoder, I get PC scale with deep blackness.

The result is similar when I enforce RGB## output in ffdshow (PC scale) or packed YUV output (TV scale at first); but it is quite confusing for me that MPEG4-ASP video by Xvid gets gradually darker while playing back (as if "Full range Level correction" in the Post-processing tab works adaptively), but MPEG4-AVC video by x264 stays gray (TV scale) -- possibly because the whole Post-processing tab is ignored for AVC decoding? And if ffdshow is able to get adaptively darker during playback, why can't it start playback with PC scale in YUV output mode?

The effect is the same for all YUV able renderers I tried: Hardware overlay; VMR9 (renderless); Haali renderer; EVR Cust. pres.; madVR.
__

Ah, there it is!

Thank you, Groucho2004 -- this setting indeed changed the YUV video display.

Thinking about it, it appears logical: The decoder doesn't make any YUV/RGB conversion when the output is sent as YUV to the renderer. So the renderer ... or the graphic card itself ... is then responsible for displaying PC scale video on a PC RGB monitor.

Thanks to Didée in the german board too, for reinforcing this solution.

Groucho2004
5th October 2010, 13:45
Yeah, I had the same problem and it was driving me nuts when I got my GT240.

Unfortunately, the default driver setting is "Limited (16-235)" and few people know about this.

LigH
5th October 2010, 13:54
Probably a "safety" default in case one connects a TV set via HDMI.