Welcome Guest ( Log In | Register )


Important

The forums will be closing permanently the weekend of March 15th. Please see the notice in the announcements forum for details.

Pages: (2) [1] 2  ( Go to first unread post )
Huffyuv Question, limits to # of passes w/huffyuv?
« Next Oldest | Next Newest » Track this topic | Email this topic | Print this topic
George
Posted: Mar 29 2004, 03:01 PM


Unregistered









I'm using Huffyuv for several passes on a DV file to perform various operations, i.e. 3/2 pulldown, various filters, convert fps...

Is there a limit to the number of passes through Huffyuv before one will start to see resolution loss? Thta is, is "lossless" using this codec just as the name implies no matter the number?

George
 
  Top
NuPogodi
Posted: Mar 29 2004, 03:15 PM


Advanced Member


Group: Members
Posts: 536
Member No.: 6558
Joined: 1-October 03



AFAIK, it is not only a name. "Lossless" has to mean that input & output are absolutely identical. Similar codecs exist also for audio...

[edit] here is the link to lossless audio codecs

--------------------
Optimists believe that they live in the best of existing worlds. Pessimists are afraid of that's right...
 
     Top
stephanV
Posted: Mar 29 2004, 03:19 PM


Spam killer ;)


Group: Moderators
Posts: 4348
Member No.: 8917
Joined: 18-February 04



uhm

you could get some loss by constantly swapping between YUV and RGB colorspace though (as i think VirtualDub uses RGB for filtering...)
i dont know if it would be visible though, but id suggest to do some reading into it... there might be ways around it or to keep it to a minimum

i remember it being discussed here earlier, so you could start with a search on this forum smile.gif

--------------------
useful links:
VirtualDub, Input plugins and filters, AviSynth, AVI-Mux GUI, AC3ACM by fcchandler, VirtualDub FAQ
 
    Top
Cyberman
Posted: Mar 29 2004, 04:44 PM


Advanced Member


Group: Members
Posts: 2035
Member No.: 3477
Joined: 3-April 03



VDub asks for RGB, if I remember right, if the codec supplies it - fine. So there WILL be a loss when using Huffy. It won´t be visible, I think, though I remember someone making tests.

There´s an option "Always suggest RGB format for output" - I´m checking it now, I *think* it´ll let Huffy and VDub talk in RGB.

Anyone can confirm/negate that?

--------------------
Matroska/MKV ?
 
    Top
stephanV
Posted: Mar 29 2004, 05:23 PM


Spam killer ;)


Group: Moderators
Posts: 4348
Member No.: 8917
Joined: 18-February 04



if im interpreting the codec right it can also compress in RGB, if you dont select the 'convert to YUY2' method under RGB compression method... (the conversion is said to be a little bit lossy in the codec configure screen...) im having doubts how huffyuv works now... unsure.gif

edit: well, i think im right about the RGB-compression, it only isnt as effective as YUV-compression

an uncompressed RGB file of 22.2 MB compressed to about 8.6 MB in the best RGB mode and to 5.2 MB in the best YUV mode
guess compressing in YUV is easier/works better than in RGB

This post has been edited by stephanV on Mar 29 2004, 05:47 PM

--------------------
useful links:
VirtualDub, Input plugins and filters, AviSynth, AVI-Mux GUI, AC3ACM by fcchandler, VirtualDub FAQ
 
    Top
fccHandler
Posted: Mar 29 2004, 06:11 PM


Administrator n00b


Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02



Remember also that the original YUY2 frames are already 33% smaller than RGB frames. YUY2 consumes 16 bits per pixel, while RGB consumes 24 bits per pixel, so from the start there is less data for Huffyuv to compress.

In fact, the "convert to YUY2" method does exactly that; it first converts the RGB input to YUY2, then compresses the YUY2 data. This gives you much smaller Huffyuv files, however the original RGB data can't be recovered exactly, so it's the only mode which isn't actually lossless.

As I understand it, the "always suggest RGB" box is a workaround for programs which incorrectly assume that the codec's default format is its only format. It works something like this:

- You compress YUY2 data into a file with Huffyuv
- You then try to load that file into a program which only supports RGB
- During negotiations, the program asks Huffyuv to suggest a good decompression format, and Huffyuv logically says YUY2
- The program wrongly assumes that it can't load the file now

--------------------
May the FOURCC be with you...
 
     Top
stephanV
Posted: Mar 29 2004, 07:09 PM


Spam killer ;)


Group: Moderators
Posts: 4348
Member No.: 8917
Joined: 18-February 04



QUOTE (fccHandler @ Mar 29 2004, 08:11 PM)
Remember also that the original YUY2 frames are already 33% smaller than RGB frames. YUY2 consumes 16 bits per pixel, while RGB consumes 24 bits per pixel, so from the start there is less data for Huffyuv to compress.

that would be a better explanation of the smaller file size yes (i didnt know YUY2 was 16-bit, should have done more reading, i guess) biggrin.gif

anyway, since compression in RGB is possible, you can just happily avoid all problems this conversion might give at the cost of a slightly larger file size (taking uncompressed RGB as reference point)

--------------------
useful links:
VirtualDub, Input plugins and filters, AviSynth, AVI-Mux GUI, AC3ACM by fcchandler, VirtualDub FAQ
 
    Top
George
Posted: Mar 29 2004, 07:21 PM


Unregistered









...soooo in mind-numbing newby terms do I lose all that much with say three or 4 passes?

What codec (forget about HD space) would be the ideal to use for multiple passes in VD if I'm coming off a DV25 file to start and returning there on the final pass?

George
 
  Top
stephanV
Posted: Mar 29 2004, 07:33 PM


Spam killer ;)


Group: Moderators
Posts: 4348
Member No.: 8917
Joined: 18-February 04



using huffyuv wouldnt give you any loss in quality whatsoever
it copies the frames pixel by pixel, but stores that in a lossless compressed way (kinda like a bmp in winzip i guess)

so if you compress the same file over and over again (say x times) no quality loss will occur; file x will be an exact copy of your original video (if you use the RGB compression method)

now, of course you wanna use filters, so your video will change in appearance of course, but at least you dont have to worry that huffyuv messes up your result, like f.e. a mpeg4 codec would. everything you see is a result of the filters you are using and NOT of using f.e. a too low bitrate

so the way to go would be using huffyuv (in RGB) for all intermediate steps

hope its clear now biggrin.gif

regards - stephan

--------------------
useful links:
VirtualDub, Input plugins and filters, AviSynth, AVI-Mux GUI, AC3ACM by fcchandler, VirtualDub FAQ
 
    Top
George
  Posted: Mar 29 2004, 08:28 PM


Unregistered









Thanks, Stephan and to the others who replied.

This is very much appreciated!

George rolleyes.gif
 
  Top
NuPogodi
Posted: Mar 30 2004, 08:24 AM


Advanced Member


Group: Members
Posts: 536
Member No.: 6558
Joined: 1-October 03



i'm, as always, too late... but let me "insert my 5 cents"... as the quality losses are due to RGB-YUV conversion, the intensity component Y has to be independent (ok, nearly independent) of how many times you've done this conversion. The main damage should be expected for U & V (or RGB) components. However, one knows that the human eye is quite sensitive to Y and much less sensitive to U & V.

I did some tests how harmful is RGB-to-YUV conversion before... just wrote AVS-script which N-times converted a clip from RGB to YUY2 (or RGB-YV12-...-RGB-YUY2, i don't remember exactly). Vdub was in "Fast recompress" mode, i used Huffuyv codec... then, compared initial and encoded clips to estimate PSNR (separately, for Y and UV components). well, after 100 RGB-YUV conversions the Y-component decreased only on 2...3dB and remained on the level 50dB, UV went down to ~25dB. And what? such encoded clip looked, imho, MUCH better than that i encoded with "lossy" codec without RGB-YUV cycling (if i'not mistaken it was ffvfw in the 100%-quality mode -> PSNR(Y)~40db, PSNR(UV)~35db). So, my conclusion was that RGB-to-YUV conversions are much less dangerous for human eye than "loosy" reencoding that decreases PSNR(Y).

@George: it was certainly my own experience, but it says that you can use huffuyv so many times as you want (i hope 100 attempts would be enough?) the most critical point is the final compression by ffvfw, DivX, WMV9, etc. BTW, why you do not use AviSynth to test how your filters change the original clip? it is much faster, it does not require re-encoding, you do not need to free several GBs on your HDD, etc. imho, again...

--------------------
Optimists believe that they live in the best of existing worlds. Pessimists are afraid of that's right...
 
     Top
stephanV
Posted: Mar 30 2004, 09:00 AM


Spam killer ;)


Group: Moderators
Posts: 4348
Member No.: 8917
Joined: 18-February 04



QUOTE (NuPogodi @ Mar 30 2004, 10:24 AM)
i'm, as always, too late... but let me "insert my 5 cents"

better late then never... biggrin.gif

anyway, so what you say RGB to YUV is lossy but hardly noticable (i mean 100 times, gosh!) biggrin.gif

BTW - yesterday i was having a discussion on DivX forum (what am i doing there you ask? tongue.gif) with a guy, who claimed that huffy WAS lossy... then again, he also didnt knew what RGB was... wacko.gif


--------------------
useful links:
VirtualDub, Input plugins and filters, AviSynth, AVI-Mux GUI, AC3ACM by fcchandler, VirtualDub FAQ
 
    Top
NuPogodi
Posted: Mar 30 2004, 10:39 AM


Advanced Member


Group: Members
Posts: 536
Member No.: 6558
Joined: 1-October 03



QUOTE
BTW - yesterday i was having a discussion on DivX forum (what am i doing there you ask?) with a guy, who claimed that huffy WAS lossy... then again, he also didnt knew what RGB was... 
i have no grounds to not trust the authors of huffuyv, who announced this codec IS lossless. i mean the codec itself, but not the procedure RGB-YUV which preceded encoding. since simple recalculating from one colorspace to another may give floats which should be replaced by integers, one should not wonder that one loses something. Are these losses comparable with those in which "lossy" codecs result? The mathematician's answer (PSNR): intensity - "no", color - "yes", but the human's answer is "no".
PS i apologize... i'd not like to hurt mathematicians, they are humans too...

--------------------
Optimists believe that they live in the best of existing worlds. Pessimists are afraid of that's right...
 
     Top
stephanV
Posted: Mar 30 2004, 10:54 AM


Spam killer ;)


Group: Moderators
Posts: 4348
Member No.: 8917
Joined: 18-February 04



QUOTE (NuPogodi @ Mar 30 2004, 12:39 PM)
i have no grounds to not trust the authors of huffuyv

me neither

well again, that guy i was discussing with also claimed that ANY type video-compression was lossy...
well nevermind... let him think that... biggrin.gif

--------------------
useful links:
VirtualDub, Input plugins and filters, AviSynth, AVI-Mux GUI, AC3ACM by fcchandler, VirtualDub FAQ
 
    Top
NuPogodi
Posted: Mar 30 2004, 11:13 AM


Advanced Member


Group: Members
Posts: 536
Member No.: 6558
Joined: 1-October 03



Well, Stephan, can you answer me what for you usually use huffuyv? i mean not tests, but a practice. till now, i used it only once (for practical purposes, ceratinly) when i had to do the 2-pass encoding with VERY hard filtering (deinterlace + several noise reduction filters + crop + resize). so, i decided to encode 1st pass by huffuyv and not to repeat filtering twice. but, i must confess, i obtained not so much profit in time to compensate disconveniences (viz., a necessity to free my HDD).

--------------------
Optimists believe that they live in the best of existing worlds. Pessimists are afraid of that's right...
 
     Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
18 replies since Mar 29 2004, 03:01 PM Track this topic | Email this topic | Print this topic
Pages: (2) [1] 2 
<< Back to Codec Discussion