need advice concerning encoding

If you have questions about compression/encoding/converting look here.
Myouh
Joined: Sun Dec 24, 2006 7:55 am
Location: England
Org Profile

Re: need advice concerning encoding

Post by Myouh » Wed Feb 04, 2009 11:34 am

I've never worked with AviSynth. I never need it. I don't know anything about it.

All I want to do is change the brightness/contrast of a mp4 video and reexport the video as it is.
Or modify the brightness/contrast before making the mp4, by working on premiere's exported video.

Do I really need to go into stuffs like AviSynth and FFmpegSource to do that?

User avatar
Qyot27
Surreptitious fluffy bunny
Joined: Fri Aug 30, 2002 12:08 pm
Status: Creepin' between the bullfrogs
Location: St. Pete, FL
Contact:
Org Profile

Re: need advice concerning encoding

Post by Qyot27 » Thu Feb 05, 2009 12:22 am

Myouh wrote:I've never worked with AviSynth. I never need it. I don't know anything about it.

All I want to do is change the brightness/contrast of a mp4 video and reexport the video as it is.
Or modify the brightness/contrast before making the mp4, by working on premiere's exported video.

Do I really need to go into stuffs like AviSynth and FFmpegSource to do that?
It makes it simpler to do and it saves hard drive space because you don't have to write another copy of the video with fixed brightness/contrast before encoding again; if you don't care about hard drive space, then VirtualDub has brightness/contrast filters that you can use. To do it with AviSynth, though, the filter you want to look at is Tweak. You can take a look at AviSynth's documentation for how to configure Tweak, along with all the other internal filters and even some of the notable external ones as well.

FFmpegSource is only required if you want to use something other than AVI (which you use AVISource for) or MPEG-1/MPEG-2 files (which you use MPEG2Source for, via DGIndex), and you need frame accuracy or don't have the right DirectShow filters installed (both reasons thus nixing DirectShowSource's candidacy). Not that it can't also open AVI and MPEG-1/2 files, but there's little reason to use FFmpegSource for that most of the time.
Myouh wrote:wouldn't a quantizer 1 with constant quantizer give better results (in terms of image quality) than quantizer 1 with constant quality? (we don't care about the size here).
Not necessarily. And quant 1 with x264 is downright ridiculous to attempt. Anything below 10 (some would say 15) is overkill. The quants don't scale the same way they do for Xvid. Quantizer 2 in Xvid is approximately quantizer 18 in x264. There was an algebraic equation someone posted that could translate Xvid's quant values to x264's, but I don't have it offhand.

Constant Quantizer (--qp) restricts the video to being only that quantizer - which means that if that particular quantizer isn't enough for the video (which wouldn't be an issue with quant 1, but it would start to be one for quant values that are actually sane), then the quality will decrease because it'll start exhibiting artifacts. Constant Quality (--crf) will adjust the quantizer to maintain the desired quality while saving the optimal amount of bits, and redistributing where needed. Filesize is unpredictable for both --qp and --crf; predictable filesize requires the use of ABR mode, and in that scenario you need to specify a bitrate.

From MeWiki:
qp

The first of three possible ratecontrol methods. Set x264 to encode the movie in Constant Quantizer mode. The number you give here specifies the P frame quantizer. The quantizer used for I and B-frames is derived from ipratio and pbratio. CQ mode targets a certain quantizer, which means final filesize is not known (although it can be reasonably accurately estimated with some methods). A setting of 0 will produce lossless output. qp produces larger files than crf for the same visual quality. qp mode also disables adaptive quantization, since by definition "constant quantizer" implies no adaptive quantization.

Recommendation: Use crf instead

bitrate

The second of three ratecontrol methods. Encode the video in target bitrate mode. x264 will attempt to encode the video to target the given bitrate as the final average. The parameter given is the bitrate in kilobits/sec. (8bits = 1byte and so on). This setting is usually used in conjunction with pass for two pass encoding. Target bitrate mode means the final filesize is known, but the final quality is not (although it's possible to estimate with a reasonable degree of accuracy). It is generally not recommended to use bitrate mode without 2pass encoding.

Recommendation: Something which gives P frame quantizers around 18-26. Estimated ranges: for SD resolution: 800kbits - 2100kbits. For 720p, 3-6mbit. For 1080p, 8-15mbit+.

crf

The final ratecontrol method: Constant Ratefactor. While qp targets a certain quantizer, and bitrate targets a certain filesize, crf targets a certain 'quality'. The idea is for crf n to give the same perceptual quality as qp n, just in a smaller space. It is not extremely exact, but reasonably close (and will average out to be accurate over a large number of videos).

CRF achieves this by reducing the quality of less important frames. In this case, frames in complex or high-motion scenes, where quality is more expensive (in terms of bits) and/or less visible, will have their quantizer increased. The bits saved in cuts like this are redistributed to frames where they will be more effective. CRF mode gives almost exactly equivalent quality to 2pass at the same bitrate; the difference is that you cannot choose the output bitrate.

Recommendation: The range 18-26 is probably where you will want to look at. If you need absolutely perfect quality you could go down to 16, but it's probably not worth it. Around 19-21.5 is where a rip will look very good. Higher res encoding can generally get away with higher crf values.
I produced a video with quantizer 1, constant quality, insane mode, I got a video a little smaller than with quantizer 1, constant quality, normal mode. is that normal?
Generally, yes. The insane mode enables settings which raise the encoding precision, and more precision = better quality at same or lower filesize.
My profile on MyAnimeList | Quasistatic Regret: yeah, yeah, I finally got a blog

Myouh
Joined: Sun Dec 24, 2006 7:55 am
Location: England
Org Profile

Re: need advice concerning encoding

Post by Myouh » Thu Feb 05, 2009 6:01 am

here's what I did:
In VirtualDubmod, I clicked "file", then "open video file via AviSynth", that as you must know is enough to create a AviSynth script file with the instruction:
AVISource("C:\...........................")

now would you explain to me Zarxrax, or anyone else, why doesn't Zarx264gui accept that script as "input video"?
it's a AVI file, not MPEG here, so what's the matter?

User avatar
SenTrix
Joined: Mon Jun 23, 2008 8:25 am
Status: Editing
Location: South East England
Org Profile

Re: need advice concerning encoding

Post by SenTrix » Thu Feb 05, 2009 6:23 am

Myouh wrote:here's what I did:
In VirtualDubmod, I clicked "file", then "open video file via AviSynth", that as you must know is enough to create a AviSynth script file with the instruction:
AVISource("C:\...........................")

now would you explain to me Zarxrax, or anyone else, why doesn't Zarx264gui accept that script as "input video"?
it's a AVI file, not MPEG here, so what's the matter?
DirectShowSource/ffmpegsource("........\filename.mp4")
Image <<..:: Click Me ::..>> Image

Myouh
Joined: Sun Dec 24, 2006 7:55 am
Location: England
Org Profile

Re: need advice concerning encoding

Post by Myouh » Thu Feb 05, 2009 6:26 am

Sentrix, I said it's a AVI.

I'm using the uncompressed exported video from premiere as a source. it's not a .mp4, ok?

User avatar
SenTrix
Joined: Mon Jun 23, 2008 8:25 am
Status: Editing
Location: South East England
Org Profile

Re: need advice concerning encoding

Post by SenTrix » Thu Feb 05, 2009 6:49 am

Myouh wrote:Sentrix, I said it's a AVI.

I'm using the uncompressed exported video from premiere as a source. it's not a .mp4, ok?
My bad... wasnt really paying attention...
Image <<..:: Click Me ::..>> Image

Myouh
Joined: Sun Dec 24, 2006 7:55 am
Location: England
Org Profile

Re: need advice concerning encoding

Post by Myouh » Thu Feb 05, 2009 9:47 am

I've solved one problem.
I had to write:
AVISource("C:\...................avi").ConvertToYV12()

.ConvertToYV12() missing was the reason why Zarx264gui didn't accept my scripts.

now I need the instructions to modify the brightness and contrast.
can someone help me with those, and tell me if they should be written before or after the first instruction.

Myouh
Joined: Sun Dec 24, 2006 7:55 am
Location: England
Org Profile

Re: need advice concerning encoding

Post by Myouh » Thu Feb 05, 2009 10:14 am

I succeeded.
I always post a problem and end up sovling 80% of it myself.
Thanks everyone, anyway.

Locked

Return to “Conversion / Encoding Help”