View Full Version : lossless YV12 codecs (was: YV12 FAQ)
ariga
28th November 2005, 11:06
I am looking for a lossless YV12 codec to save the output of avisynth. Seems like vble and loco can do it. But neither can handle interlaced video, is that correct ? Are there any new codecs now ?
Boulder
28th November 2005, 13:07
I am looking for a lossless YV12 codec to save the output of avisynth. Seems like vble and loco can do it. But neither can handle interlaced video, is that correct ? Are there any new codecs now ?
ffdshow has a YV12-capable HuffYUV codec. You need to install the vfw support for it to be available I think.
ariga
28th November 2005, 15:19
That's nice. But ffdshow looks like one of the all-in-one codec packs. Will it interfere with my existing codec setup ? Is it possible to limit it to just the yv12 encoding/decoding ?
Also, how can I determine which codec is being used by avisynth (or other app) at any time ?
Wilbert
28th November 2005, 15:23
Look in the documentation of AviSource and the fourCC option.
I splitted the thread from the sticky if you don't mind.
That's nice. But ffdshow looks like one of the all-in-one codec packs. Will it interfere with my existing codec setup ?
No, you can select which decoders in ffdshow should be used for decoding some format.
Is it possible to limit it to just the yv12 encoding/decoding ?
Yes, that's also possible.
Poutnik
28th November 2005, 16:35
I am looking for a lossless YV12 codec to save the output of avisynth. Seems like vble and loco can do it. But neither can handle interlaced video, is that correct ? Are there any new codecs now ?
You can try Lagarith lossless codec, supporting RGBs, YUY2 and YV12
Edit: Not sure about interlacing....
http://lags.leetcode.net/codec.html
Anonymouses
28th November 2005, 18:22
That's nice. But ffdshow looks like one of the all-in-one codec packs. Will it interfere with my existing codec setup ? Is it possible to limit it to just the yv12 encoding/decoding ?
It's not a codec pack. And yes you can limit it to only encode/decode whatever you want. If you don't want it decoding something you just disable that feature.
Hellworm
28th November 2005, 22:47
In ffdshow you can also try FFV1, pretty good compression, slow, can handle yv12, afaik.
Don' t know about interlaced.
IanB
28th November 2005, 23:07
Think about it guys. A YV12 frame does not know it is interlaced it just has 3 planes of data a Y plane and 2 of 0.25 sized U and V planes. A lossless codec will just store the plane data and return it unchanged.
As for being able to tell the codec the plane data is interlaced there may be a slight improvement in correlation within a single field that might allow a slightly better compression but it is probably not worth the hassle with intermediate workfiles. If your are really worried about it do a SeparateFields() at the end of the script and an AssumeFieldBased().Weave() when you re-import the data.
Wilbert
28th November 2005, 23:35
Think about it guys. A YV12 frame does not know it is interlaced it just has 3 planes of data a Y plane and 2 of 0.25 sized U and V planes. A lossless codec will just store the plane data and return it unchanged.
As for being able to tell the codec the plane data is interlaced (...)
I guess it only matters when you feed or request RGB from the codec.
IanB
29th November 2005, 00:24
I guess it only matters when you feed or request RGB from the codec.Which you probably should not do, else why bother with the lossless "YV12" codec. Letting arbitary unknown code do your colour space translations is fraught.
GrofLuigi
29th November 2005, 00:37
I have used Loco codec few times to store interlaced YV12 with no visible problems, although in the readme it says "interlaced support is todo".
GL
ariga
29th November 2005, 09:33
The author of Lagarith claims (http://lags.leetcode.net/codecstats.html) the codec is fast and compresses better than other codecs. (FFV1 only slightly better but slower). Tried it, works well, supports interlacing (but then IanB pointed out, it's irrelevant if there's no colorspace conversion)
Is this a good way to determine if the codec is lossless ?
orig=AviSource("orig_pal_dv.avi") # 50 frames, 7041 KB
lags=AviSource("lags_pal.avi") # 50 frames, 10900 KB
Subtract(orig, lags).Histogram("levels")
BTW, uncompressed YV12 was 30385 KB.
EDIT: Interlacing support not available !! Mail from author...On Tue, 29 Nov 2005 Ben Greenwood(RIT Student) wrote :
Adding support for interlaced video is on my 'to-do' list for Lagarith, athough I have no idea when it will be implemented. The reason it is not in there yet is that interlaced YV12 is kinda messy to deal with during colorspace conversions. As the posts say, you should be fine as long as you do not do any colorspace conversions within Lagarith when working with interlaced video.
foxyshadis
29th November 2005, 12:46
An easier method is a PSNR (or any other metric) comparison. In fact, MSU has a tool (http://www.compression.ru/video/quality_measure/video_measurement_tool_en.html) for this.
Which brings me around to my suggestion, the MSU Lossless (http://www.compression.ru/video/ls-codec/index_en.html) codec is basically the most efficient lossless available, more so than lag or loco, and still reasonably fast (it's around half the speed of huffyuv on mine, I think, but I use the fastest mode). And it does support interlaced YV12, fwiw.
ariga
30th November 2005, 14:44
With uncompressed YV12 (480 frames of 720x576 @ 25fps) 292 MB
Codec Duration Size Settings
MSUD 1:58 137 MB !! Lossless; Mode=Maximise speed; Enable delta frames
MSUD 0:59 121 MB Lossless; Mode=Maximise speed
MSUD 0:59 121 MB Lossless; Mode=Max compression,slow decomp
LAGS 0:22 130 MB Default settings
Lagarith decompression took the same time. Excellent for intermediate files.
MSU decompression was similarly slow. I'd say good for archiving only.
gamr
30th November 2005, 14:55
am i still the only 1 using vble? can post it on a site if anyone wants it (last i knew it was hard to find)
ariga
30th November 2005, 15:35
Links vble and loco are available via the YV12 FAQ, particularly in this thread (http://forum.doom9.org/showthread.php?s=&threadid=53305)
But it would help if comparison/stats were posted here along with the time. Mostly the comparison is only w.r.t size and not time.
Alain2
30th November 2005, 21:21
What about Helix codec 1.2 (http://forum.doom9.org/showthread.php?s=&threadid=56972) ? Don't know if it handles interlaced video though
foxyshadis
1st December 2005, 05:13
Guess I was wrong. I'll give lagarith a try then.
Poutnik
1st December 2005, 06:28
What about Helix codec 1.2 (http://forum.doom9.org/showthread.php?s=&threadid=56972) ? Don't know if it handles interlaced video though
I am afraid this codec support YV12 in non uncompressed way,
or I recall badly....
Leak
1st December 2005, 11:26
I am afraid this codec support YV12 in non uncompressed way,
or I recall badly....
Yep. The Helix codec takes uncompressed YV12 or I420 and converts it to YUY2 or RGB - so it's more of a colorspace converter than a "real" codec.
Livesms
4th March 2008, 13:16
I'm trying to find fast/efficient YV12 lossless codec.
I havea already tested AlparySoft Lossless Codec v 2.0 b9570.40607
Now I found here Lagarith lossless codec (supporting RGBs, YUY2 and YV12). Latest version v1.3.14 (http://lags.leetcode.net/codec.html)
With my test sample 93 frames 512*384 i'got
ASLC 11153408
Lagarith 8089600
But after final encode and comparing encoded material (using ASLC and Lagarith) I found, that Lagarith do not give lossless encode with YV12
Here is MSU comparing graph
http://keep4u.ru/imgs/s/080304/15/15d1e51a00a2211c2c.jpg (http://keep4u.ru/full/080304/15d1e51a00a2211c2c/jpg)
foxyshadis
4th March 2008, 20:40
Your comparison is broken. I assume you're using cartoons where every other frame is duplicated? You'll see that kind of pattern anytime you compare videos that are one frame off, for whatever reason. It's also possible but less likely that there's a colorspace conversion in there somewhere.
It is quite certainly lossless, though.
IanB
4th March 2008, 21:01
To visually compare near identical filesA=AviSource("File_A.avi")
B=AviSource("File_B.avi")
Subtract(A, B)
N=8 # Adjust sensitivity here
Levels(128-N, 1.0, 128+N, 0, 255)
StackHorizontal(A, Last, B)
Livesms
4th March 2008, 22:20
Your comparison is broken. I assume you're using cartoons where every other frame is duplicated?
No, just TV capture with MVDegrain2 :)
It's also possible but less likely that there's a colorspace conversion in there somewhere.
I think it is, but where this colorspace conversion occures?
It is quite certainly lossless, though.
I've tests with
Alparysoft lossless codec
Loco (http://forum.doom9.org/showthread.php?p=312334#post312334)
VBLE (http://forum.doom9.org/showthread.php?p=443290#post443290)
All with real lossless results.
Only Lagarith gives some strange results for me.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.