Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > New and alternative video codecs

Reply
 
Thread Tools Search this Thread Display Modes
Old 2nd December 2004, 03:10   #1  |  Link
Zarxrax
Registered User
 
Zarxrax's Avatar
 
Join Date: Dec 2001
Location: Concord, NC
Posts: 1,168
Lagarith lossless codec

I'm announcing this for my friend since he's never joined this forum. He has made a very nice lossless codec called Lagarith. It supports a number of colorspaces (RGB24, RGB32, RGBA, YUY2, and YV12). It runs at about half the speed of huffyuv, so it can work well for capturing video on most systems. The compression ratio is slightly better than corepng (I didnt enable delta frames in corepng in my test).
It is an interframe codec (all keyframes) so it works very well for editing. It does have a null frames option though, which you can enable to make it encode null frames if there is no difference from one frame to the next. It's also open source.
A reduced resolution mode is currently being implemented, which will be a extremely nice feature for video editors.

I personally use this as my standard lossless codec now, replacing huffyuv and vble. From all the lossless codecs that I have tried, it offers the best mix of compression, speed, and stability, in my opinion.

For more information and to download it, go here:
http://lags.leetcode.net/codec.html
Zarxrax is offline   Reply With Quote
Old 2nd December 2004, 05:11   #2  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,547
looks good. you can never have too many lossless codecs

btw, love the avatar
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 2nd December 2004, 06:39   #3  |  Link
akupenguin
x264 developer
 
akupenguin's Avatar
 
Join Date: Sep 2004
Posts: 2,393
Cool, a new codec is always good news.

Nitpick posted here because I don't see any method of feedback on the site:
Quote:
from http://lags.leetcode.net/codec.html
Pixel values are first predicted using Paeth prediction (the same method used when "Predict Median" is selected in Huffyuv).
Huffyuv's prediction (which Lagarith also uses) is "median(L,T,L+T-LT)". Paeth (used in e.g. PNG) is "whichever of L,T,LT is nearest to median(L,T,L+T-LT)".
akupenguin is offline   Reply With Quote
Old 2nd December 2004, 08:15   #4  |  Link
Soulhunter
Bored...
 
Soulhunter's Avatar
 
Join Date: Apr 2003
Location: Unknown
Posts: 2,812
Wow, very nice codec...


Bye
__________________

Visit my IRC channel
Soulhunter is offline   Reply With Quote
Old 2nd December 2004, 08:29   #5  |  Link
akupenguin
x264 developer
 
akupenguin's Avatar
 
Join Date: Sep 2004
Posts: 2,393
Since the compression method sounds similar to ffv1, lets see how they compare.

My benchmarks on a random chapter of a random DVD I had on hand (Ghost in the Shell 2; mostly CG, cropped but not filtered)
YUY2 (because that's what all these codecs have in common), 704x384, 2000 frames
There were no duplicate frames in this clip, so that feature of lagarith wasn't tested. But note that MEncoder has a similar duplicate frame remover that can be applied to any codec, so ffv1, ffvhuff, and ljpeg would benefit the same amount.
This is just one source; YMMV.
Code:
  Codec           Bitrate   Enc fps   Dec fps 
raw:              103705
huffyuv 2.1.1:     31524     93.41     71.61
ljpeg:             28965     44.85     45.63
huffyuv ccesp:     28170     96.48     72.54
ffvhuff:           24308     86.81     70.42
lagarith:          23242     41.08     29.88
ffv1(cavlc):       19756     27.99     26.31
msu:               17676      0.83     10.63
ffv1(range coder): 17221     23.23     25.77

Last edited by akupenguin; 1st May 2008 at 11:52. Reason: typo
akupenguin is offline   Reply With Quote
Old 2nd December 2004, 19:06   #6  |  Link
TEB
Registered User
 
Join Date: Feb 2003
Location: Palmcoast of Norway
Posts: 268
good codec.. very stable..

but its about 20% worse at enc than ffv1 and around 3% slower at encoding.

Does anyone know how to force the encoder into 422 or 420 mode?
TEB is offline   Reply With Quote
Old 2nd December 2004, 23:09   #7  |  Link
Shinobu
Satsuki'S Softs Maker
 
Shinobu's Avatar
 
Join Date: Feb 2003
Posts: 180
A multi thread implmentation will be cool, i can beta test it (dual athlon mp on tyan thunder k7).
Also a "compression level" will be realy cool (don't know if it's easily implementable) so every computer could use it for capture ^^.

++
Shinobu is offline   Reply With Quote
Old 3rd December 2004, 08:22   #8  |  Link
Atamido
Seņor Member
 
Atamido's Avatar
 
Join Date: May 2002
Location: Austin, Texas
Posts: 915
AFAIK, FFV1 only works in YV12, so if you're feeding it anything except that you are not encoding lossless. An AVISynth script could compare the original to decoded FFV1 to make sure.

Also, CorePNG with Auto-Delta frames at the maximum compression level would likely beat all of these for size, but unless you have an Athlon 30,000+, you aren't going to be capturing with it in real time.
Atamido is offline   Reply With Quote
Old 3rd December 2004, 18:20   #9  |  Link
akupenguin
x264 developer
 
akupenguin's Avatar
 
Join Date: Sep 2004
Posts: 2,393
FFV1 works in YUV of any subsampling ratio (4:4:4, 4:2:2, 4:2:0, 4:1:1, 4:1:0) and also RGB. Yes, I made sure all of the encodes in my test are lossless.

Last edited by akupenguin; 6th November 2011 at 18:35.
akupenguin is offline   Reply With Quote
Old 4th December 2004, 04:06   #10  |  Link
akupenguin
x264 developer
 
akupenguin's Avatar
 
Join Date: Sep 2004
Posts: 2,393
Lagarith doesn't seem to be affected by the "null frames" option when encoding YUV. Is it supposed to be working? (Yes, I'm sure the frames are perfectly identical.) I also can't get it to encode RGB (vdub crashes when I begin encoding).

edit: SirLagsalot just fixed RGB.


Another chapter of another random DVD ("Ghiblies 2", 672x432, 2500 frames, cropped but not filtered).
Yes, I made sure all of these are really lossless.

YV12:
Code:
  Codec     Bitrate   Enc fps   Dec fps 
raw           83529
corepng(6i)   23903      7.31    47.49
ffvhuff       22264    156.46    86.09
lagarith      20975     44.79    32.89
corepng(9p)   18007      0.68    51.09
ffv1          15368     28.62    29.80
snow          13838      7.46    15.43

With duplicate frame removal:
ffvhuff       18440    163.06   104.61
lagarith      17346     50.89    39.72
snow          13685      8.50    16.76
ffv1          12737     33.93    36.09

RGB:
Code:
  Codec       Bitrate   Enc fps   Dec fps 
raw            167048
hyffyuv ccesp   54583    48.79    59.29
corepng(6i)     52360     3.82    35.49
corepng(6p)     41752     2.29    28.24
corepng(9p)     40122     0.55    29.04
lagarith        39539    19.42    17.56
ffv1            29937    13.86    14.76

With duplicate frame removal:
huffyuv ccesp   45388    58.86    71.53
lagarith        32771    23.93    20.80
ffv1            24891    16.68    18.00
where (6i) means CorePNG 0.8.2 on defaults, and (9p) means best + auto-delta.

Last edited by akupenguin; 4th December 2004 at 07:47.
akupenguin is offline   Reply With Quote
Old 4th December 2004, 16:28   #11  |  Link
CruNcher
Registered User
 
CruNcher's Avatar
 
Join Date: Apr 2002
Location: Germany
Posts: 4,927
2605 1:44 Pal 25 Fps 720x576 (Real) (cleaned DVD)
Code:
flawed look below for correct results
__________________
all my compares are riddles so please try to decipher them yourselves :)

It is about Time

Join the Revolution NOW before it is to Late !

http://forum.doom9.org/showthread.php?t=168004

Last edited by CruNcher; 5th December 2004 at 12:13.
CruNcher is offline   Reply With Quote
Old 4th December 2004, 18:14   #12  |  Link
Zarxrax
Registered User
 
Zarxrax's Avatar
 
Join Date: Dec 2001
Location: Concord, NC
Posts: 1,168
After seeing the good results of ffv1, i decided to try a comparison myself, and see if I could actually get the codec working this time. I've never been able to get either ff huffyuv or ffv1 working the couple times that I tried them in the past.

Code:
Video is YV12, animated source, 1:40 in length.

Codec/settings             Encode Speed    Size
vble                               0:48   395MB
lagarith                           1:15   330MB
ffv1 vcl   Context 0   kf dist 1   1:47   281MB
ffv1 ac    Context 0   kf dist 1   2:40   268MB
ff huffyuv        (resulting files are corrupt)
Well, at least ffv1 works now.
My results basically show a pretty linear relation between the amount of compression verses the encoding speed. Lagarith seems to be a good intermediate range codec: good compression, and good speed.

Last edited by Zarxrax; 4th December 2004 at 18:20.
Zarxrax is offline   Reply With Quote
Old 4th December 2004, 19:21   #13  |  Link
Atamido
Seņor Member
 
Atamido's Avatar
 
Join Date: May 2002
Location: Austin, Texas
Posts: 915
Quote:
Originally posted by akupenguin
FFV1 works in YUV of any subsampling ratio (4:4:4, 4:2:2, 4:2:0, 4:1:1, 4:1:0) and also RGBA. Yes, I made sure all of the encodes in my test are lossless.
Interesting, I wonder when they added that? But if you checked to make sure the output was bit identical, it's all good.
Atamido is offline   Reply With Quote
Old 4th December 2004, 21:01   #14  |  Link
akupenguin
x264 developer
 
akupenguin's Avatar
 
Join Date: Sep 2004
Posts: 2,393
Quote:
Originally posted by Zarxrax
ff huffyuv (resulting files are corrupt)
What version of libavcodec? There have been some recent fixes and improvements. Last week it was split into two codecs: "ffhuffyuv" is compatible with the the original, and "ffvhuff" contains our improvements (YV12, adaptive huffman tables).

For best results, use vcodec=ffvhuff:vstrict=-1:pred=2:context=1


And you've tried ffv1 with context=1 and keyint=10 or 20 and decided that the compression gain is not worth the speed or the addition of P-frames? (FFV1 isn't actually temporally predicted, it just uses P-frames to avoid resetting CABAC contexts.)
akupenguin is offline   Reply With Quote
Old 4th December 2004, 22:00   #15  |  Link
Zarxrax
Registered User
 
Zarxrax's Avatar
 
Join Date: Dec 2001
Location: Concord, NC
Posts: 1,168
Quote:
Originally posted by akupenguin
What version of libavcodec? There have been some recent fixes and improvements. Last week it was split into two codecs: "ffhuffyuv" is compatible with the the original, and "ffvhuff" contains our improvements (YV12, adaptive huffman tables).
My ffdshow is dated Dec 1, 2004.

Quote:
Originally posted by akupenguin
And you've tried ffv1 with context=1 and keyint=10 or 20 and decided that the compression gain is not worth the speed or the addition of P-frames? (FFV1 isn't actually temporally predicted, it just uses P-frames to avoid resetting CABAC contexts.)
I actually wasn't sure what the context setting did, so I left it at the defaults, which I assumed would result in the best compression. I didn't enable P-frames because the other codecs that I tested do not support this feature, thus it would not be a fair comparison. Also, P-frames are worthless for the applications that I typically use lossless files for, so it does not interest me.
Zarxrax is offline   Reply With Quote
Old 5th December 2004, 02:09   #16  |  Link
akupenguin
x264 developer
 
akupenguin's Avatar
 
Join Date: Sep 2004
Posts: 2,393
Looks like ffvhuff hasn't been included in ffdshow yet.

Quote:
Originally posted by Zarxrax
I actually wasn't sure what the context setting did, so I left it at the defaults, which I assumed would result in the best compression.
In all of lavc's codecs, the defaults are near the fastest settings. I don't know if this is intentional, or if they just didn't want to change the default behavior when adding a new feature.
Quote:
I didn't enable P-frames because the other codecs that I tested do not support this feature, thus it would not be a fair comparison.
What kind of reason is that? Different codecs have different features. You don't turn off FFV1's Arithmetic coding just because Huffyuv doesn't support it.
Quote:
Also, P-frames are worthless for the applications that I typically use lossless files for, so it does not interest me.
OK, if you need frame-accurate cutting and seeking. It was only about a 5% improvement.

Last edited by akupenguin; 31st May 2008 at 00:52. Reason: typo
akupenguin is offline   Reply With Quote
Old 5th December 2004, 09:23   #17  |  Link
RadicalEd
Registered User
 
Join Date: Dec 2001
Posts: 987
I've managed to get intra-only FFV1 to encode and decode at the same rates and faster compared to Laga, with decent compression gain. I hate to be such a dick, but I've never really seen the point of lagarith... the algorithms are pretty mundane, and it doesn't really fill any niche.

I'll post my test results tomorrow or Monday when I'm home.
RadicalEd is offline   Reply With Quote
Old 5th December 2004, 12:14   #18  |  Link
CruNcher
Registered User
 
CruNcher's Avatar
 
Join Date: Apr 2002
Location: Germany
Posts: 4,927
Sorry but the results i posted before were borked here are the correct ones

2605 1:44 Pal 25 Fps 720x576 (Real) (cleaned DVD)


Code:
                           size  enc   dec  
ffv1 (AC)                 293 MB 2:46  2:28/19 Fps
ffv1 (VLC)                316 MB 2:06  2:00/22 Fps
lagarith                  356 MB 1:58  2:05/22 Fps
vble-gr3                  368 MB 2:57  1:33/28 Fps
vble-gr2                  369 MB 7:01  1:48/24 Fps
milk                      371 MB 3:16  3:05/15 Fps
vble2-gr2-lite            375 MB 2:57  2:00/22 Fps
loco                      401 MB 1:55  2:11/21 Fps
vble                      416 MB 1:20  3:16/13 Fps
huffyuv12 median          468 MB 1:22  2:22/20 Fps
ffdshow huffyuv12 median  689 MB 1:50  2:50/18 Fps
4545 3:09 Film 24 Fps 640x480 (CG)


Code:
                            size  enc   dec  
ffv1 (AC)                 297 MB 3:40  2:51/30 Fps
ffv1 (VLC)                325 MB 2:46  2:20/33 Fps
milk                      370 MB 4:00  3:17/23 Fps
lagarith                  390 MB 2:28  2:20/33 Fps
vble-gr2                  390 MB 9:20  2:10/36 Fps
vble-gr3                  393 MB 3:47  1:50/38 Fps
vble2-gr2-lite            407 MB 3:56  2:26/33 Fps
loco                      427 MB 2:33  2:32/32 Fps
vble                      520 MB 1:50  3:47/20 Fps
huffyuv12 median          556 MB 1:48  3:14/24 Fps
ffdshow huffyuv12 median  872 MB 1:50  2:40/28 Fps
__________________
all my compares are riddles so please try to decipher them yourselves :)

It is about Time

Join the Revolution NOW before it is to Late !

http://forum.doom9.org/showthread.php?t=168004

Last edited by CruNcher; 5th December 2004 at 17:09.
CruNcher is offline   Reply With Quote
Old 5th December 2004, 13:15   #19  |  Link
dragongodz
....
 
dragongodz's Avatar
 
Join Date: May 2002
Location: Australia
Posts: 2,797
Quote:
Lagarith doesn't seem to be affected by the "null frames" option when encoding YUV. Is it supposed to be working?
did you use version 1.2.4(updated 12-04-04, same build that has the RGB fix)) to test that ?

Quote:
I hate to be such a dick, but I've never really seen the point of lagarith... the algorithms are pretty mundane, and it doesn't really fill any niche.
whats that to you ? the guy wanted to write a lossless codec and did. he has made it available for anyone that wants to try it or use it etc. he even made it open source so if anyone wants to improve it they can do that aswell. its not up to you or anyone else to say its pointless because it has cost you nothing and you are not being forced to use it.
dragongodz is offline   Reply With Quote
Old 5th December 2004, 18:39   #20  |  Link
RadicalEd
Registered User
 
Join Date: Dec 2001
Posts: 987
Well, if you like it, use it. I still don't see any practical use, FFV1 pretty much covers all bases. I guess I'm just too supportive of FFV1 :P Laga and me go back a ways though. The story of my distaste for it is too long and political to go into without being OT, so I'll step off here.
RadicalEd is offline   Reply With Quote
Reply

Tags
lagarith

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:40.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.