Log in

View Full Version : Seeking advice for choosing right codec


ror
17th May 2013, 17:24
Hey,

I have AVI video of size 1.5 GB which I want to halve. It has relatively high bitrate for XVID and I was hoping not to introduce new artifacts or intensify present, in process of re-encoding.

Here is info:


Video
ID : 0
Format : MPEG-4 Visual
Format profile : Advanced Simple@L5
Format settings, BVOP : 2
Format settings, QPel : No
Format settings, GMC : No warppoints
Format settings, Matrix : Custom
Codec ID : XVID
Codec ID/Hint : XviD
Duration : 1h 22mn
Bit rate : 2 153 Kbps
Width : 688 pixels
Height : 512 pixels
Display aspect ratio : 4:3
Frame rate : 25.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.244
Stream size : 1.23 GiB (91%)
Writing library : XviD 65


and a screenshot:

http://i.imgur.com/s0zjYRr.jpg

So, should I just halve the bitrate and re-encode with default XVID preset, or should I try with x264 or maybe something else (I'm not restricted on container)?

TIA

paradoxical
17th May 2013, 17:28
Why not just re-encode the source to a lower bitrate directly? You'd get much better results than doing another lossy compression to that XviD file.

ror
17th May 2013, 17:33
Why not just re-encode the source to a lower bitrate directly?

Is this some specific approach, as I don't see any difference between lowering bitrate and re-compressing - it should be same thing IMHO?

paradoxical
17th May 2013, 17:37
Is this some specific approach, as I don't see any difference between lowering bitrate and re-compressing - it should be same thing IMHO?

The difference is that you are doing multi-generational lossy compression which will degrade quality more than just doing a single lossy compression from the original source file. Each time you lossily recompress a file you do nothing but further increase artifacts.

paradoxical
17th May 2013, 17:42
So my point is that you should just compress the original source with x264 to the lower target bitrate you want. You will get much better results than recompressing your already compressed source file.

ror
17th May 2013, 17:43
Ah, I misunderstood your saying. This file is source, there is no other copy. It's old VHS rip, and there is no easy way to re-rip again.

paradoxical
17th May 2013, 17:44
Ah, I misunderstood your saying. This file is source, there is no other copy. It's old VHS rip, and there is no easy way to re-rip again.

Well then use x264 with --preset veryslow to get the best quality for further shrinking the file.

ror
17th May 2013, 17:47
OK, I'll go for it, and post a screenshot later

Cheers

ror
18th May 2013, 14:57
OK. Job done.
I was using spare low spec PC for conversion, and x264 as expected took ages to finish. I used 2pass default preset at 800kbps with VirtualDub. It took 12h or so. After that out of curiosity I reencoded again with Xvid, 2pass at 800 kbps. Both results are fine.
I guess I asked this question as I wasn't sure how Xvid would perform, but if I did some testing instead asking, probably I wouldn't have gone with x264 (because of processing time of course)

Here is screenshot (3MB):
http://s22.postimg.org/x7focz2zx/output2.jpg (http://s22.postimg.org/uq3x5pj3j/output2.png)

Columns are: original, Xvid, x284
Second row is difference with original, and third row is normalized difference.

ror
19th May 2013, 15:21
oops... sorry for misleading with above graph, but x264 frame reference is different then original xvid and reencoded xvid.

I have no idea why is it like this, which I noticed after cleaning remaining folder, but both VirtualDub, MPC or mplayer show that frame or time reference is slightly distorted for x264, which makes above graph differences unrepresentative.

x264 was stored in MKV with VirtualDub's x264 plugin internal option
It's maybe inheritance because different codec was used, or it's container issue, or maybe both, which makes above graph of apples and oranges :(

ChiDragon
19th May 2013, 18:10
That is not from VHS. The red shirt would be bleeding, for one thing.

mariush
20th May 2013, 07:42
It's 25fps, so it's probably PAL, not NTSC... which might explain the lack of bleeding.

Anyway, a single frame is not representative of the quality, a lot of quality improvement is in the quality overall, during motion, during fast scenes etc. You may have simply picked a frame that's a keyframe in both encodings, therefore the bitrate for that frame is much higher.

you also have to be careful with h264 about what color space is used... some players default to bt.709 if you don't specify it in the stream, while for SD if I remember correctly there's another color space.