Log in

View Full Version : Trying to re-encode some anime


Tylerr
6th January 2015, 23:07
I'm trying to re-encode some of my anime to make some space on my hard drives. Most of them are from a time when i didn't care about space (some episodes taking up 2gb+ lol..)

But once i do it its done and i'll be deleting the old files so there won't be any do overs. So can anyone look at these settings i'm using below and give suggestions?

This is 10bit btw

Encoding settings : cabac=1 / ref=3 / deblock=1:-1:-1 / analyse=0x3:0x133 /
me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 /
trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-2 /
threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 /
bluray_compat=0 / constrained_intra=0 / bframes=4 / b_pyramid=2 / b_adapt=2 / b_bias=0 /
direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 /
intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=19.0 / qcomp=0.60 / qpmin=0 /
qpmax=81 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

mandarinka
7th January 2015, 03:39
1) CRF 19 sucks (sorry).
...
2) raise ref, it helps a lot with anime and 3 is way small. You could safely raise bframes too, 6 to 9 (dunno, maybe even more) could be reasonably useful with today's digital anime.
3) I would knock aq-strength to 0.8, that seems to be the sweetspot for anime. Maybe even use 0.6, because you go low-bitrate and thus the quality will suck already.
4) You should indeed go 10-bit, because banding is likely to appear.
5) deblock to 0/0 or 1/1. Lowering it isn't for people who go low bitrate :D

Edit: BTW, since you are going to re-encode a huge dump of files - you could gain some compression boost from using-threads instead of threads=auto and run encodes in parallel, one encode on each cpu core available.

foxyshadis
7th January 2015, 06:52
If you're out entirely to save space, chop the opening and ending off, too. You can futz around with ordered chapters to make it seamless, or just leave them separate files, but that usually cuts a LOT out of a typical anime series.

Tylerr
7th January 2015, 13:01
what should i put the ref frames at? I had it higher but didn't notice a quality or big compression gain outside a few MB (or does it do something else?)

took way longer to encode though

Groucho2004
7th January 2015, 13:15
what should i put the ref frames at? I had it higher but didn't notice a quality or compression gain.
How about sticking to the presets and "tune" options? The developers put a lot of work into tuning the preset parameters and one would assume that they know what they are doing.

Tylerr
7th January 2015, 17:02
Hmm well i lowered the aq-strength to 0.8 and it lowered the filesize by about 15mb

Then i did the animation tuning and it was about 50mb lower, so i'm going to put the crf to down 17 and try that

Which one of these looks better? (Image0 is the original encode, 1 and 2 are my re-encodes)

Original
http://s7.postimg.org/44b05r0ah/Image0.png

Encode 1
http://s3.postimg.org/i74chzl1d/Image1.png

Encode 2
http://s1.postimg.org/dpdndcxh9/Image2.png

mandarinka
7th January 2015, 21:53
How about sticking to the presets and "tune" options? The developers put a lot of work into tuning the preset parameters and one would assume that they know what they are doing.

Well, I don't think it was *that* much work. Often it was just our of experience or even gut feeling... the settings often help here and harm there, so the tunings especially aren't ultra-reliable.

Tylerr
9th January 2015, 01:22
Guess i'll just use this this


Encoding settings : cabac=1 / ref=6 / deblock=1:1:1 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=0.40:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-2 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=5 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=17.0 / qcomp=0.60 / qpmin=0 / qpmax=81 / qpstep=4 / ip_ratio=1.40 / aq=1:0.60

jondak
9th January 2015, 14:27
On your initial encode is encoded with crf 19. Crf 17 which you want to use will have more bitrate then your source. I would say you can try crf 20-22.

I usually use crf 16-18 for dvd encodes and crf 20-22 for bluray with the appropriate tune.

If the resulting bitrate is still too high you can try a denoizing filter.

Also i dont know how you store your sound in the file. I usualy just copy the original audio track over. If you do the same you can shave a some space by re-encoding the audio to aac or similar.

Tylerr
9th January 2015, 15:28
No the original file has a crf of 16. The first episode has an overall bit rate of 2511 for the original, my encode has 1767

and the audio is already aac.

mandarinka
9th January 2015, 22:16
No the original file has a crf of 16. The first episode has an overall bit rate of 2511 for the original, my encode has 1767

and the audio is already aac.

IMHO, such a reduction is not worth the effort and the quality drop.

Tylerr
10th January 2015, 00:35
Well i don't notice any big quality drop.

rwill
10th January 2015, 10:42
Well i don't notice any big quality drop.

*cough*cough*

http://gizmodo.com/5555359/the-weirdness-of-a-youtube-video-re-uploaded-1000-times

Tylerr
10th January 2015, 14:17
I'm only encoding once.

Asmodian
11th January 2015, 00:18
It was already encoded a few times before you got it though..

Tylerr
11th January 2015, 01:57
Only once or twice if its a blu-ray version (depending on whether they used direct remuxes or not)

Same with hdtv sources

in any event its not a thousand, and people who do it use different methods than youtube does which optimizes for streaming.

rwill
11th January 2015, 09:14
Well of course you are free to re-encode your movies. I just tried to point out that there will be a quality loss which might not be truly obvious on the first inspection.

When I was in a similar situation I bought a NAS for storage and some external USB HDs for backup. This costs money though so its not valid advice for everyone.

DotJun
12th January 2015, 10:07
1. Choose a preset that will encode the video in the amount of time you are willing to wait for it to finish.
2. Choose an appropriate tune, in your case animation.
3. Pick a crf rating of 16 to 22 (higher resolution and/or cleaner sources will allow you to go higher rating).

If you aren't happy with the picture quality then go down a rating or half a rating, depending on how much time you want to put into this.

If you aren't happy with the compression amount then go up in rating.

Tylerr
16th January 2015, 12:36
heres samples of my encode and the original


http://www.mediafire.com/download/g3r7w4ksp6wbyf5/FmabOriginal.mkv
http://www.mediafire.com/download/77fr6pgovfp69c6/FmabEncode.mkv


anything i can do to improve?


settings i encoded with

Encoding settings : cabac=1 / ref=6 / deblock=1:1:1 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=0.40:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-2 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=5 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=17.0 / qcomp=0.60 / qpmin=0 / qpmax=81 / qpstep=4 / ip_ratio=1.40 / aq=1:0.60

Emulgator
17th January 2015, 21:10
Hm, the static grain makes such low bitrates possible.
But while the camera moves upwards the slot in between buildings there is sacrifice with the reencode.
I would keep the originals. The 40% less bitrate wouldn't be worth it in my eyes.
Tucked away on BD-R 25 @ 60ct/each at the moment (so 6ct/episode).

Tylerr
17th January 2015, 23:37
yeah i noticed the difference

is there no setting i can tweak to make it better?

the 40% is a lot for me since i plan on doing it for a ton of series

Tylerr
20th January 2015, 23:02
would using more ref or b frames help with that?

foxyshadis
21st January 2015, 23:46
Usually a tiny bit, but not enormously. Some rare film and anime does benefit from lots of reference frames, if it utilizes a lot of fast cutting where scenes are repeated. In most circumstances it's a waste of time going above 6.

The encoding time difference for 16 B frames isn't that much, and I've noticed some anime will gladly use all 16 often, but I'm not sure how much it helps.

Tylerr
23rd January 2015, 05:08
what helps to keep more quality during high motion scenes?

foxyshadis
23rd January 2015, 07:23
More bits, pretty much.

Pre-filtering to stabilize the image helps a lot, too, with avisynth tools like MDegrain and MCTemporalDenoise, but it takes a long time. Perhaps using --nr 100 might help -- it'll make the picture a little softer to save bits.

Maxing out the settings (--preset placebo) might give you a tiny bit more, but rarely anything worthwhile or noticeable, versus veryslow.

Motenai Yoda
23rd January 2015, 10:39
usually for b-frames there aren't much beneficts going from ie 5 to 16 cause if needed the encoder put a p-frame then other b-frames (so if first was a set of 16B now is roughly 5BP5BP4B)
I tested an still image ending, difference between 5b and 16b are so negligible that ssim and psnr increase only of a .01 and a .08