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 > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 24th January 2023, 21:25   #1  |  Link
coolgit
Registered User
 
Join Date: Apr 2019
Posts: 170
Change yuv individual pixel colour

Is there a function/plugin that can change pixel with luma 17 to 16.

I got the hex numbers and loaded up an mp4 file with a hex software then replace 17 with 16.

When i checked with ColorYUV(analyze=true), both original and new file, it didn't work. Apparently it changed another colour but i don't know which.

tara
coolgit is offline   Reply With Quote
Old 24th January 2023, 21:42   #2  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,566
This mt_lut("x 17 == 16 x ?", u=2, v=2) or Expr("x 17 == 16 x ?", "") will change luma pixels with a value of 17 to 16. Chroma is copied.
Reel.Deel is offline   Reply With Quote
Old 25th January 2023, 00:37   #3  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,444
Quote:
I got the hex numbers and loaded up an mp4 file with a hex software then replace 17 with 16.
The data in an .mp4 is compressed and won't bear any direct relation to pixel values. Changing bytes directly like that is likely to corrupt the file.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 25th January 2023, 00:45   #4  |  Link
coolgit
Registered User
 
Join Date: Apr 2019
Posts: 170
Quote:
Originally Posted by Reel.Deel View Post
This mt_lut("x 17 == 16 x ?", u=2, v=2) or Expr("x 17 == 16 x ?", "") will change luma pixels with a value of 17 to 16. Chroma is copied.
Wow for that. I will try both to see which is faster.
coolgit is offline   Reply With Quote
Old 25th January 2023, 00:49   #5  |  Link
coolgit
Registered User
 
Join Date: Apr 2019
Posts: 170
Quote:
Originally Posted by wonkey_monkey View Post
The data in an .mp4 is compressed and won't bear any direct relation to pixel values. Changing bytes directly like that is likely to corrupt the file.
Well i luckily didn't get a corrupt file but one pixel colour did change to another but no idea which. It's a pity as Hex editor was super super fast.
coolgit is offline   Reply With Quote
Old 25th January 2023, 04:07   #6  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,566
Quote:
Originally Posted by coolgit View Post
Wow for that. I will try both to see which is faster.
From my experience, on 8-bit, mt_lut is almost always faster than expr.
Reel.Deel is offline   Reply With Quote
Old 25th January 2023, 13:37   #7  |  Link
coolgit
Registered User
 
Join Date: Apr 2019
Posts: 170
Quote:
Originally Posted by Reel.Deel View Post
From my experience, on 8-bit, mt_lut is almost always faster than expr.
40 minutes video... expr 7 seconds faster. Not enough difference to fuss about really.
coolgit is offline   Reply With Quote
Old 25th January 2023, 18:11   #8  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,566
Quote:
Originally Posted by coolgit View Post
40 minutes video... expr 7 seconds faster. Not enough difference to fuss about really.
Interesting. With ColorBarsHD() as the source, I get 850fps with Expr and 1200 with mt_lut. I don't have an AVX2 capable processor. But yes, it does not make a difference once the encoder gets involved
Reel.Deel is offline   Reply With Quote
Old 25th January 2023, 18:39   #9  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,444
I find mt_lut to be 30% quicker single-threaded, but expr is 30% quicker using prefetch.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 25th January 2023, 19:13   #10  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,566
Using Prefetch(4) I get 2840fps with mt_lut and 2680 with Expr. With Prefetch(6), Expr is slightly faster (3480 vs 3450) and both about 50% cpu usage.
Reel.Deel is offline   Reply With Quote
Old 25th January 2023, 19:59   #11  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,540
RD,
hows bout with
Code:
ColorBarsHD()
Loop()           # play the clip (almost) endlessly.
Prefetch(4)      # or not
(not sure if that speeds it up or not)
I aint got Avisynth installed at the moment.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 25th January 2023 at 20:03.
StainlessS is offline   Reply With Quote
Old 25th January 2023, 20:06   #12  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,566
Quote:
Originally Posted by StainlessS View Post
RD,
hows bout with
Code:
ColorBarsHD()
Loop()           # play the clip (almost) endlessly.
Prefetch(4)      # or not
(not sure if that speeds it up or not)
I aint got Avisynth installed at the moment.
I get 381839fps with that script. In AviSynth+ the ColorBar filters have a "staticframes" parameter, true by default so it only generates one frame and the rest are copied.
Reel.Deel is offline   Reply With Quote
Old 25th January 2023, 20:08   #13  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,540
OOps, I forgot to insert the the mt_lut() and Expr() bits.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 25th January 2023, 20:13   #14  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,566
Quote:
Originally Posted by StainlessS View Post
OOps, I forgot to insert the the mt_lut() and Expr() bits.
I used Loop when testing with Prefetch in post #10, only because without it, it finishes too fast.
Reel.Deel is offline   Reply With Quote
Old 25th January 2023, 20:19   #15  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,540
Makes sense.
I'm off to bed, 19:45 and I did not get to bed last night ZZZZzzzzz.....
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 26th January 2023, 00:48   #16  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 1,636
Yeah, you need sleep to charge, Staindroid
kedautinh12 is offline   Reply With Quote
Old 26th January 2023, 12:10   #17  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,540
Sleep is for wimps.

(I somtimes have to wimp out - or pass out)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 26th January 2023, 12:50   #18  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,814
Quote:
Originally Posted by coolgit View Post
Is there a function/plugin that can change pixel with luma 17 to 16.

I got the hex numbers and loaded up an mp4 file with a hex software then replace 17 with 16.

When i checked with ColorYUV(analyze=true), both original and new file, it didn't work. Apparently it changed another colour but i don't know which.

tara
Are you trying to make file legal ?
kolak is offline   Reply With Quote
Reply

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 15:40.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.