Log in

View Full Version : Get smaller files with a grainy movie?


color
23rd September 2018, 09:15
I do got a grainy movie that I'm trying to convert to a smaller file, everytime i try in Virtualdub the file ends up around 30gb, but when using another film (same size, fps) it ends up around 2-3 gb. (okey size)

I don't know if its because the grain but I know when adding grain it can be so mutch larger. is it because of H.642 is wrong? I tried changing the settings to grainy but it only makes it larger (ca 36gb)

I did try H.645 and it works great and okey size but it won't play on my bluray-player. :/

sneaker_ger
23rd September 2018, 09:23
What H.264 encoder are you using? x264? Then if filesize is too big increase CRF.

LoRd_MuldeR
23rd September 2018, 15:05
At the moment, you are probably using CRF mode. This can produce a way smaller or larger file, at the same CRF value, depending on the "complexity" of the content.

If you need to hit a specific file size, better use 2-Pass mode. This allows you to specify the target (average) bitrate in such a way that the desired file size will be hit exactly – and you'll still get the best possible quality out of that file size.

Of course you could also try to fiddle around with the CRF value until it happens to produce a file of the desired size. But that's effectively like doing 2-Pass the hard way "by hand".

(BTW: If you try to squish a "grainy" movie into a small file size, the results may not look that great, no matter what. In that case, pre-processing with a good denoise/degrain filter, e.g. MDegrain, can work real wonders!)

StainlessS
23rd September 2018, 16:49
(BTW: If you try to squish a "grainy" movie into a small file size, the results may not look that great, no matter what. In that case, pre-processing with a good denoise/degrain filter, e.g. MDegrain, can work real wonders!)

Absolutely, here existing easy use script function for avs (suggest latest Pinterf avs+, and latest Pinterf MvTools2), courtesy of Didee.


Function MCDegrain(clip c, int "frames")
{ # By Didee, http://forum.doom9.org/showthread.php?p=1508289#post1508289

frames = default(frames, 2)
bs = (c.width>960) ? 16 : 8
super = c.MSuper(pel=2, sharp=1)
backward_vec3 = MAnalyse(super, isb = true, delta = 3, blksize=bs, overlap=bs/2)
backward_vec2 = MAnalyse(super, isb = true, delta = 2, blksize=bs, overlap=bs/2)
backward_vec1 = MAnalyse(super, isb = true, delta = 1, blksize=bs, overlap=bs/2)
forward_vec1 = MAnalyse(super, isb = false, delta = 1, blksize=bs, overlap=bs/2)
forward_vec2 = MAnalyse(super, isb = false, delta = 2, blksize=bs, overlap=bs/2)
forward_vec3 = MAnalyse(super, isb = false, delta = 3, blksize=bs, overlap=bs/2)
(frames<=0) ? c :\
(frames==1) ? c.MDegrain1(super, backward_vec1,forward_vec1,thSAD=400) :\
(frames==2) ? c.MDegrain2(super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400) :\
c.MDegrain3(super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,backward_vec3,forward_vec3,thSAD=400)
return(last)
}



AviSource("...") # or whatever source filter
ConvertToYV12
Frames=1 # or 2 or 3, higher stronger denoise (greater temporal radius)
MCDegrain(frames=Frames) # mvtools2 in plugins dir


EDIT: Not for interlaced, Think there is an interlaced version somewhere.

EDIT: With sharpening in good matching areas and slight bluring in bad matching areas, if very grainy might not be an improvement,
but I use on almost every clip and love it.

Function MCDegrainSharp(clip c, int "frames", float "bblur", float "csharp", bool "bsrch",bool "Precise") {
# From:- http://forum.doom9.org/showthread.php?p=1737045#post1737045
# Based on MCDegrain By Didee, http://forum.doom9.org/showthread.php?t=161594
# Also based on DiDee observations in this thread: http://forum.doom9.org/showthread.php?t=161580
# "Denoise with MDegrainX, do slight sharpening where motionmatch is good, do slight blurring where motionmatch is bad"
# In areas where MAnalyse cannot find good matches, the blur() will be dominant.
# In areas where good matches are found, the sharpen()'ed pixels will overweight the blur()'ed pixels
# when the pixel averaging is performed.
#
# Mod by StainlessS to add Precise, 3 Sept 2015.
frames = default(frames, 2)
bblur = default(bblur, 0.6)
csharp = default(csharp, 0.6)
bsrch = default(bsrch, true)
Precise=Default(Precise,False) # Use MRecalculate
bs = (c.width>960) ? 16 : 8
c2 = c.blur(bblur)
super = bsrch ? c2.MSuper(pel=2, sharp=1) : c.MSuper(pel=2, sharp=1)
super_rend = c.sharpen(csharp).MSuper(pel=2, sharp=1,levels=1) # Only 1 Level required for sharpened Super (not MAnalyse-ing)
backward_vec3 = MAnalyse(super, isb = true, delta = 3, blksize=bs, overlap=bs/2)
backward_vec2 = MAnalyse(super, isb = true, delta = 2, blksize=bs, overlap=bs/2)
backward_vec1 = MAnalyse(super, isb = true, delta = 1, blksize=bs, overlap=bs/2)
forward_vec1 = MAnalyse(super, isb = false, delta = 1, blksize=bs, overlap=bs/2)
forward_vec2 = MAnalyse(super, isb = false, delta = 2, blksize=bs, overlap=bs/2)
forward_vec3 = MAnalyse(super, isb = false, delta = 3, blksize=bs, overlap=bs/2)
# If Precise, then recalculate on Prefiltered (blurred) Super (NOT the sharpened render super)
backward_vec3 = (Precise) ? MRecalculate(super, backward_vec3, blksize=bs/2, overlap=bs/4,thSAD=100) : backward_vec3
backward_vec2 = (Precise) ? MRecalculate(super, backward_vec2, blksize=bs/2, overlap=bs/4,thSAD=100) : backward_vec2
backward_vec1 = (Precise) ? MRecalculate(super, backward_vec1, blksize=bs/2, overlap=bs/4,thSAD=100) : backward_vec1
forward_vec1 = (Precise) ? MRecalculate(super, forward_vec1 , blksize=bs/2, overlap=bs/4,thSAD=100) : forward_vec1
forward_vec2 = (Precise) ? MRecalculate(super, forward_vec2 , blksize=bs/2, overlap=bs/4,thSAD=100) : forward_vec2
forward_vec3 = (Precise) ? MRecalculate(super, forward_vec3 , blksize=bs/2, overlap=bs/4,thSAD=100) : forward_vec3
#
(frames<=0) ? c :\
(frames==1) ? c2.MDegrain1(super_rend, backward_vec1,forward_vec1,thSAD=400) :\
(frames==2) ? c2.MDegrain2(super_rend, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400) \
: c2.MDegrain3(super_rend, backward_vec1,forward_vec1,backward_vec2,forward_vec2,backward_vec3,forward_vec3,thSAD=400)
return(last)
}

color
28th September 2018, 13:46
Sorry for late answer. I did try to lower the quality but it didn't look good. I did try Degrain and it did work great, that made the file Mitch smaller. I don't really understand why grainy movies just become so big.

I use x264.

Btw what is h264? Isn't that the same?

StainlessS
28th September 2018, 14:00
I don't really understand why grainy movies just become so big.
Grain looks like detail, so the encoder tries its best to retain the 'detail', and so is big.

wonkey_monkey
28th September 2018, 14:45
I use x264.

Btw what is h264? Isn't that the same?

H.264 is a codec, x264 is a specific implementation of an H.264 encoder.

color
28th September 2018, 20:17
Oh, now I understand a little bit better. :)

LoRd_MuldeR
29th September 2018, 01:16
I don't really understand why grainy movies just become so big.

In simple terms, video compression works by "predicting" each frame (picture) from the preceding frame(s) and then only storing the so-called "residual", i.e. the difference between the predicted picture and the actual picture.

This exploits the fact that, in most videos, the difference between consecutive frames (pictures) is relatively small – which means that the "next" frame usually can be predicted pretty accurately and thus the residual will be small.

However, noise or grain is random by definition. Consequently, when noise/grain dominates in the video, then prediction of the picture can not work very well! As a consequence, the residual (i.e. data to be stored) will be huge :eek:

In other words, if the video contains a lot of noise/grain (i.e. random data), then we either need to spend a whole lot of bits in order to accurately represent that video, or we need to accept "subpar" quality...


https://image.slidesharecdn.com/historyofvideocodingdec14-141201111303-conversion-gate01/95/a-short-history-of-video-coding-6-638.jpg?cb=1417515025 https://image.slidesharecdn.com/historyofvideocodingdec14-141201111303-conversion-gate01/95/a-short-history-of-video-coding-8-638.jpg?cb=1417515025

color
30th September 2018, 11:15
Thank you for explaining. :)

Forteen88
11th October 2018, 12:17
http://avisynth.nl/index.php/Temporal_Degrain
by Didée & Sagekilla

This script seems to be great against videos with dancing grain,
Temporal Degrain is a very slow, multi-stage temporal denoiser originally created for killing the dancing grain present in 300
Although I don't know if MCDegrain (by Didée) is also good for that.