PDA

View Full Version : Reencoding video and 2pass encoding effect on audio?


geniv
12th June 2002, 00:43
I'm not as expeienced in encoding nor can tell quality difference as sensitive as some of you knowledgable pros here perhaps someone can help me.

my question about reencoding and 2 pass encoding has 2 parts. Video and Audio quality.

Let say captured video in Virtual Dub:
- 352x240 resolution
- Divx5.0.2 codec at 1500k bitrate
- CD quality Uncompress audio.

Video
1- In general do I get noticable quality gain if I cap video at highbitrate (1500k) and then rencode it to 400k bitrate as oppose to capping directly at 400k bitrate? what about capping at 1500k then 2pass reencoding to 400k?

I always think that if u reencode from an already encoded source (with the exception of lossless enocded source, huff or mjpeg) you are encoding from a "tampered" and none pure source. basically encoding from a picture that already have compression artifacts. and u will get not so great result.


Audio
2- say I have uncompress CD quality audio as souce and I'm doing 2 pass encoding on the video. and I set the audio to encode to 128k mp3 audio in the fast past. on the second pass let the audio setting stay the same (128k mp3). will this degrade my audio quality?

my thinking is on the first pass I use the "Pure" source and encode it to 128k mp3. the on the 2nd pass wouldn't I reencode a 128k mp3 from a compressed 128k mp3 source, thus giving me less quality?

so for the audio part of a 2 pass encoding. should I just set the first pass to 128k mp3 encode and on the 2nd pass I just do "direct stream copy" for the audio part?


Thanks in advance for your help and tips.

DSPguru
12th June 2002, 01:26
yea, you shouldn't reencode your the mp3 to mp3. 'cause there will be quality loss.

QuoVadis
12th June 2002, 02:07
Errr, no. As long as you reencode the mp3 with the same bitrate *and* the same encoder as you did before you'll have no "noticable" quality loss (at least not if you do it just once). The frequency bands are clipped in the first encoding and the second one can't clip anything out that hasn't been clipped in the first encoding.
If you even use the same encoder for the second pass, also the same frequency coding tables are used and the difference is not noticable for the common human ear.

lark
12th June 2002, 04:00
noticeable difference or not,
why should you re-encode anyway?
direct stream copy should be faster,
because there's no processing...

regards
t :)

-h
12th June 2002, 04:08
Errr, no. As long as you reencode the mp3 with the same bitrate *and* the same encoder as you did before you'll have no "noticable" quality loss (at least not if you do it just once). The frequency bands are clipped in the first encoding and the second one can't clip anything out that hasn't been clipped in the first encoding.
If you even use the same encoder for the second pass, also the same frequency coding tables are used and the difference is not noticable for the common human ear.

Hm, how many times have you tried this yourself? :)

It's a famously bad thing to do, even when converting to a higher bitrate during the re-encoding step.

-h

geniv
12th June 2002, 05:51
noticable or not so my suspicion was right about renecoding audio.

so I do a direct stream copy on the second pass then.

now what about the video part can anyone help me?

theReal
12th June 2002, 07:06
geniv, if you encode to mp3 in the first pass and set it to "direct stream copy" in the second, you will get the direct stream copy from the source vid, which is still uncompressed pcm.

Set the audio to "no audio" in the first pass and encode it to mp3 in the second pass.

About your video encoding: 1500 is not a high bitrate for real-time captures. Better set it to quality based with a low quantizer (2-4), then you'll profit from reencoding - but of course the captured file will almost be as big as if you captured with a high mjpeg quality(which isn't lossless, btw).

If you don't have enough space, I think capturing directly to 400 might almost be better than re-encoding from 1500. I'm not sure, try it out!

QuoVadis
12th June 2002, 11:54
@h: I did not advise him to reencode the audio stream as it doesn't make any sense. I simply said that under certain circumstances the quality loss of a second encoding can be minimized. And if you are forced to do so (maybe if you need to sample down an audio track for space reasons, you always shoud take the same encoder as in the first step).

duartix
12th June 2002, 13:08
Unless you are limited by filesize, I suggest you encode directly in just one pass with a fixed quantizer (quality mode).

@theReal
if you encode to mp3 in the first pass and set it to "direct stream copy" in the second, you will get the direct stream copy from the source vid, which is still uncompressed pcm. Well you've got me confused as hell here.
Why is it still PCM if he compressed it to mp3 in the first pass?
If this may be the issue, I believe he is capturing directly to AVI in the first pass.

theReal
12th June 2002, 19:47
the first pass and the second pass are both calculated from the source avi (which is divx video + pcm audio in this case). If in the first pass you encode the audio to mp3, the source avi is not changed and the newly created mp3 is muxed with the dummy avi file from the first pass. The second pass either overwrites this dummy avi, or writes a new avi file.
In both cases, the second pass will stream the audio directly from the source avi - which is still uncompressed pcm (wouldn't it be strange if the first pass changed your source avi?)


I usually encode the audio seperately, so I save the audio as .wav, then do both passes without audio. I encode the audio to VBR mp3 with Razorlame (a good lame frontend) and mux audio and video with Nandub in the end.