Log in

View Full Version : Using lav filters as decoders for frame-serving to x264


Marin85
9th November 2011, 06:40
Hi,

I was wondering if anyone has any experience with using the lav filters as decoders for frame serving to x264? One can easily create a graph with lav source splitter and lav cuvid and load this into Avisynth and then load the avisynth script into MeGUI or similar. I like the idea that it offloads the decoding process from the cpu to my gpu, thus freeing up more cycles for the encoding process (?).
I did a small comparison between encoding from ffdshow decoder and from lav video decoder and in the case of lav decoder the output has slightly different colors. Since I have not touched the rather multiple output color settings in the lav video decoder configuration, I wonder which are the correct settings in order to assure that the encode has the same colors as the source?

Also, if the source has incorrect color levels, is it possible to fix them properly already via the decoder options instead of in Avisynth? If so, would that be beneficial, say performance-wise?

kypec
9th November 2011, 09:11
I like the idea that it offloads the decoding process from the cpu to my gpu, thus freeing up more cycles for the encoding process (?).
I'd suggest you to try DGDecNV (http://neuron2.net/dgdecnv/dgdecnv.html) instead. It's been designed specifically as a source filter for Avisynth. Not being DirectShow kind of filter offers excellent frame accuracy and performance. ;)

06_taro
9th November 2011, 14:34
Try direct264 (http://forum.doom9.org/showthread.php?t=141441) and use --demuxer dshow.

sneaker_ger
9th November 2011, 17:18
I did a small comparison between encoding from ffdshow decoder and from lav video decoder and in the case of lav decoder the output has slightly different colors.

That is something which shouldn't normally happen. Usually both the source and the final encode are YV12, so no color conversions are necessary. Mostly wrong colors are the fault of the playback software. What are your input and output formats? (H.264 Hi10p?)

Marin85
9th November 2011, 19:43
According to mediainfo, the input is YUV 4:2:0, 8 bits. However, it apprears to have wrong color levels (of which I am sure) and this issue is easily fixed with ColorYUV(levels="TV->PC"). But since this is applied for both decoders after the decoding, the difference should be coming from the output. My output format should be h.264 8bits YV12 1080p or maybe I have not understood your question? As for the decoder output, I am using the default settings of lav video decoder (except for the deinterlacing, but this should not be relevant here since both the input and output are progressive).

sneaker_ger
9th November 2011, 19:51
Then, it is indeed strange. Can you upload a small sample and your complete script?

Most content has TV range, btw. I wouldn't change that and leave any necessary conversion to the player, unless you have a very specific reason not to do so.

Marin85
10th November 2011, 00:36
Ok, I have uploaded now a ~50 MB sample over here (http://ifile.it/1gjk3tx) (hope no one minds the ifile host). I have also two comparison shots:

with ffdshow: http://www.imagebam.com/image/e7d5a5158423693
with lav filters: http://www.imagebam.com/image/48c68e158423743

(I have removed the information in the left upper corner because they contained some bits that are probably not appropriate for this forum.) Apart from the missing left upper corners, these shots precisely illustrate what I was referring to.

My Avisynth script is fairly simple:

DirectShowSource("c:\sample.grf",Audio=false)
Crop(0,140,0,-140)
ColorYUV(levels="TV->PC")

sneaker_ger
10th November 2011, 01:03
I get bit identical output from LAV and ffdshow on that sample. Do you have any post processing enabled in ffdshow? Do both filters output to the same colorspace?

Marin85
10th November 2011, 03:42
I get bit identical output from LAV and ffdshow on that sample. Do you have any post processing enabled in ffdshow? Do both filters output to the same colorspace?
No, I don't have any post-processing enabled in ffdshow, that I did double-check. I am sure that ffdshow is outputting the correct colorspace, so apparantly LAV was not doing so. When I think about it, I have all output colorspace formats checked by default and RGB levels for the RGB to YUV conversion set to untouched (same as input). This is what is enabled by default in LAV and what I use for watching movies. I thought that it would default to the "right" output - should I disable anything but YV12? Or can I leave the 10-bit output formats checked (for the rare cases of 10-bit h.264 playback)?

I guess this turns out to be rather a LAV filter question than AVC encoding question :rolleyes: , but I am still interested if anyone can share positive or negative experience with using lav cuvid for frame-serving to x264. I am already aware of the existence of DGDecNV.

poisondeathray
10th November 2011, 03:58
What renderer are you using ? Do you have more than 1 media player open simultaneously ?

Marin85
10th November 2011, 07:49
What renderer are you using ? Erm, the screenshots were taken via Avspmod with DirectShowSource, using the ffdshow decoder.