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 20th February 2019, 00:51   #21  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Lossy compression will not be kind to the noisy data you'll be trying to transmit. Is there a reason you can't just send an encrypted zip file containing the whole video file?
We are (me is) currently in experimental stage, perhaps we could do some denoising on random key clip before encrypting/decryption (DCTFilter I think is intended for something like that),
also probably need use of Limiter() plug at some point (on both key and Target clip).
Maybe I got it wrong on needing single bit shift, I'm not sure but suspect that may require a Left shift of 7, rather than a left shift of 1 (so that most significant bit of 8 bit clip is in bit 14,
with bit 15=0. Might also need random bits set in 15 and bit 6, to encourage x264 to think it is detail and not to screw with it.


I'm kinda interested to see if we can get this working, although zip with password would be a helluva lot easier.

EDIT: Currently, have tried encrypt/encode from original JohnMeyer Parade mp4 (~22.5MB) to 10 bit x264 CRF 18 Preset=Slower, and result
was a whopping 980MB, so a wee bit bigger than original source. This was kinda expected, we will be wanting to experiment with some kind
of multi blurring on the random key, will still obfuscate encrypted clip nicely, but with (hopefully) better compression.
Might even try pixelating the random clip, with additional blurring, lots to try out.
We are gonna hav'ta 'suck-it-and-see' what happens.
__________________
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; 20th February 2019 at 17:24.
StainlessS is offline   Reply With Quote
Old 27th February 2019, 20:44   #22  |  Link
spoRv
Registered User
 
Join Date: Nov 2016
Posts: 151
Tried using a compressed version for the difference clip (h264 and h265), and result is not good... hence, the only way to go is lossless, even if it means A HUGE file!
spoRv is offline   Reply With Quote
Old 3rd March 2019, 15:36   #23  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Tried using a compressed version for the difference clip (h264 and h265), and result is not good
Yeh not good, think maybe some of problem down to illegal TV range colors being created via the XOR-ing, [eg fully saturated chroma when BLACK] below demos it
(I modded the KEY clip genny to be a bit smoother, still no joy at all).

Code:
Function EncryptPrep(clip c) { Return c.ConvertToYV12.Limiter(min_luma=16,  max_luma=235,  min_chroma=16, max_chroma=240 ) }

Function GenRandomKey(clip c,int Seed,Int "Rad",int "Y_Lim",Int "UV_Lim") {
	Rad=Default(Rad,4)              Y_Lim=Default(Y_Lim,20)       UV_Lim=Default(UV_Lim,20)
	W=round(c.Width/(Rad*4))*4	H=round(c.Height/(Rad*4))*4
        RandomSource(Length=c.FrameCount,Width=W,Height=H,Seed=Seed)
	BicubicResize(c.Width,c.Height,1,0)
	ConvertToYV12
   	Limiter(min_luma=16+Y_Lim,  max_luma=235-Y_Lim,  min_chroma=16+UV_Lim, max_chroma=240-UV_Lim )
	return Last
}

SECRET_KEY = 123456789

AviSource("D:\Parade.avi").Trim(1000,-2000).EncryptPrep()
#Return Last

RAD=4
LIM=20
KEY       = GenRandomKey(SECRET_KEY,Rad=RAD,Y_Lim=LIM,UV_Lim=LIM)
#Return KEY

ENCRYPTED = MT_Logic(KEY,"xor",y=3,u=3,v=3)                 # Encrypt
Return ENCRYPTED

# Result of Encypted.Limiter.Decrypt suggests part problem is Illegal YUV colors created by Encryption.
#Return ENCRYPTED.Limiter.MT_Logic(KEY,"xor",y=3,u=3,v=3)

return ENCRYPTED.MT_Logic(KEY,"xor",y=3,u=3,v=3)            # Decrypt
Key frame (random)


Single frame after encrypt


Encypted.Limiter.Decrypt


Encypted..Decrypt, same as original


EDIT: Actually, the UT_Video compressed Encrypted clip is smaller than the original UT_Video encoded clip
(422MB instead of 432MB, but that might be down to using Limiter on the original clip before encrypting).

EDIT: Changing RAD to 16 produces a rather fancy effect random KEY frame.


and then encrypted
__________________
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; 3rd March 2019 at 16:06.
StainlessS is offline   Reply With Quote
Old 13th March 2019, 03:10   #24  |  Link
spoRv
Registered User
 
Join Date: Nov 2016
Posts: 151
Code:
function deconstruct(clip original, clip modified, Int "Seed" , Int "blk") {
# needs scramble/descramble: https://forum.doom9.org/showthread.php?p=1868405#post1868405
modified
coloryuv(levels="TV->PC")
MT_Logic(original,"xor",y=3,u=3,v=3)
scramble(seed=seed,blk=blk)
}

function reconstruct(clip original, clip deconstructed, Int "Seed" , Int "blk") {
# needs scramble/descramble: https://forum.doom9.org/showthread.php?p=1868405#post1868405
deconstructed
descramble(seed=seed,blk=blk)
MT_Logic(original,"xor",y=3,u=3,v=3)
coloryuv(levels="PC->TV")
}


WARNING: deconstructed video MUST be lossless/uncompressed; its size could be 50/60% bigger than original clip (using the same compression)

Thanks to StainlessS for his help!
spoRv 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 13:39.


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