Best setting to reencode an AVI

Discuss about generic usage of MediaCoder.

Moderator: HuggiL

Post Reply
Dingus
Beginner
Beginner
Posts: 4
Joined: Tue Mar 31, 2009 11:48 pm

Best setting to reencode an AVI

Post by Dingus » Tue Mar 31, 2009 11:59 pm

Hello,
I'm new here. I have an AVI file with the follow specifications :
Video
Codec : Xvid
Resolution : 640x352
Fps : 25
Audio
Codec : mpga
2 channels
48000 hz
126 kb/s
Its size is about 700 Mb.

I want to encode it to get the smallest size with the same quality. What do you suggest as container, codecs and so on ?
Thank you.

User avatar
Placio74
Advanced
Advanced
Posts: 455
Joined: Sun Sep 17, 2006 11:02 pm
Location: Poland
Contact:

Re: Best setting to reencode an AVI

Post by Placio74 » Wed Apr 01, 2009 2:05 am

Dingus wrote:I want to encode it to get the smallest size with the same quality.
Not possible.
Rather with near quality.

Try with MP4 or MKV container, H.264 video and AAC audio.
VideoAudio.pl - Serwis o technologii wideo & audio

Dingus
Beginner
Beginner
Posts: 4
Joined: Tue Mar 31, 2009 11:48 pm

Re: Best setting to reencode an AVI

Post by Dingus » Wed Apr 01, 2009 3:14 am

Ok, I'm going to try this and tell you what the final size is.
Thanks for replying.

ladycoder
Expert
Expert
Posts: 588
Joined: Fri Nov 24, 2006 5:29 am

Re: Best setting to reencode an AVI

Post by ladycoder » Wed Apr 01, 2009 5:38 am

Almost guarantee it was made with 2-pass encoding to get that size originally.

Dingus
Beginner
Beginner
Posts: 4
Joined: Tue Mar 31, 2009 11:48 pm

Re: Best setting to reencode an AVI

Post by Dingus » Wed Apr 01, 2009 9:29 pm

Placio74 wrote:
Dingus wrote:I want to encode it to get the smallest size with the same quality.
Not possible.
Rather with near quality.

Try with MP4 or MKV container, H.264 video and AAC audio.
I have reencoded it with H264, mkv container and Helix MP3, 2-pass. The final size is 640 Mb instead of 698 Mb, disapointing result. For the video the codec is avc1 but for audio it is only mpga, the audio is faulty of the too big size. I tried to use AAC but it complained about a codec and no output file.


I do not understand how guys can achieve a super high compression. Here is an example of 2 hours 20 minutes MKV movie :
Video
codec : avc1
resolution : 1056x432 (!)
fps : 23.976
Audio
mp4a
2 channels
48000 Hz
Extension AAC : SBR
The file size is only 500 Mb !

User avatar
Placio74
Advanced
Advanced
Posts: 455
Joined: Sun Sep 17, 2006 11:02 pm
Location: Poland
Contact:

Re: Best setting to reencode an AVI

Post by Placio74 » Wed Apr 01, 2009 10:28 pm

Dingus wrote:... I tried to use AAC but it complained about a codec and no output file. ...
Nero Encoder or FAAC?

What's used video and audio bitrate?

BTW
Use MediaInfo (in text view insted basic) to check wideo file properties.
VideoAudio.pl - Serwis o technologii wideo & audio

Dingus
Beginner
Beginner
Posts: 4
Joined: Tue Mar 31, 2009 11:48 pm

Re: Best setting to reencode an AVI

Post by Dingus » Thu Apr 02, 2009 4:52 am

Placio74 wrote:
Dingus wrote:... I tried to use AAC but it complained about a codec and no output file. ...
Nero Encoder or FAAC?
What's used video and audio bitrate?
I have used others settings. For video H264 with Matroska container, multiplexer and remuxer (both enabled) are MKVmerge. Format : H.264 and Mode : Quality-based. 50 : don't know what it is when quality-based is enabled... (50 what ?)
For Audio, this time I used Nero encoder, Profile : HE-AAC V2
Rate mode : Target Quality
Bitrate/Quality : 25 (25 what ?)

The final size is a MKV file of 500 Mb from a 700 Mb AVI, much better now.
So here are the specs of this latter file :
Video :
Codec : avc1
640x352
fps : 25
Audio :
MP4a
2 channels
48000 Hz
Extension AAC : SBR + PS

Note : I don't know it this PS stuff makes the file bigger, first time I meet it.

velis
Amateur
Amateur
Posts: 39
Joined: Thu Apr 02, 2009 1:31 am
Location: Slovenia

Re: Best setting to reencode an AVI

Post by velis » Thu Apr 02, 2009 7:29 am

Disclaimer: I'm no expert.

That said,

For h264 you should use 2 or 3 pass bitrate based encoding. Also for AAC. This way you can yourself define the target file size.

Quality based coding doesn't do what you want. In theory, if you set quality to 100, this will mean that the encoded video + audio should produce more or less the same images as the original codec produced. However, since the original codec was also lossy, rendering the movie from a 700MB xvid file will produce frames with artifacts. Because of this, 100 is moot setting for quality based encoding because the codec will be trying to duplicate the artifacts too. Generally, specifying quality 100 will result in enormous file sizes.

H264 produces similar quality encodings at 1/3 to 1/2 of bitrate of previous MPEG4 codecs (which xvid is).
So you have to check out the original bitrate for this movie and use that (divided by 2 - 3) for 2 or 3 pass H264 encoding.
Since you wil be moving the audio from mpga to AAC, you can also lower the bitrate from 128 to 96 or even less. However, the audio part is much harder to compare for differences.

You can then compare the two videos (the original and the transcoded one) using a simple aviSynth script with a Subtract function.
Any differences will be visible in the produced video. The easier you see "noise" in the generated subtract video, the more differences there are. You can also use analyze=true parameter if you don't trust your eyes.

So my suggestion would be to first reencode the movie to H264 + AAC at original bitrates and then at reduced bitrates. The original bitrates conversion will tell you how much you lost to the transcoding itself (more or less, ideally, you should use some huge bitrates for that, but it isn't really necessary). Then just run the comparison aviSynth on each and see if the lower bitrates are enough. You can make the difference clips display side by side using StackVertical or StackHorizontal. This way you can compare differences from both encodings at once. You can also subtract the new files themseves to see how much difference there is between them.

As for H264, don't use baseline profile. It disables B frames which are quite important for bitrate / quality. Use at least main profile unless you want to play the result on some portable player.

Post Reply