AddBorders greatly increasing bitrate

This forum is for questions and discussion of all the aspects of handling and cleaning up your footage with Avisynth.
Twisted871
Joined: Sat Jun 26, 2010 9:57 am
Org Profile

AddBorders greatly increasing bitrate

Post by Twisted871 » Sat Jun 26, 2010 10:15 am

Hey all, I am trying to increase the resolution of a video file from 640x360 to 640x480 while keeping the aspect ratio of the actual clip the same:

Code: Select all

AviSource("clip.avi")
AddBorders(0, 60, 0, 60)
I'm loading the the script into VirtualDub(ver 1.9.9), then saving the resulting video. While the borders are added correctly, the bitrate for the clip increases substantially from 1096 kbps to 11048 kbps. Is there any way to keep the bitrate from changing so much? Thanks for any help.

User avatar
Scintilla
(for EXTREME)
Joined: Mon Mar 31, 2003 8:47 pm
Status: Quo
Location: New Jersey
Contact:
Org Profile

Re: AddBorders greatly increasing bitrate

Post by Scintilla » Sat Jun 26, 2010 6:33 pm

You should consider resizing the video to 640x352 first, then add borders of 64 on each side. This way each 8x8 macroblock will contain only borders or only picture, not both.
ImageImage
:pizza: :pizza: Image :pizza: :pizza:

User avatar
mirkosp
The Absolute Mudman
Joined: Mon Apr 24, 2006 6:24 am
Status: (」・ワ・)」(⊃・ワ・)⊃
Location: Gallarate (VA), Italy
Contact:
Org Profile

Re: AddBorders greatly increasing bitrate

Post by mirkosp » Sat Jun 26, 2010 6:33 pm

I'm guessing the clip you're importing is lossy. The thing is, once you import it in avisynth, any other program, vdub included, won't see it as the original lossy file anymore, but just as a sequence of *your colourspace here* images, and as such if you're trying to direct stream copy, it's not copying the original encode, but the avisynth frames that you can consider as uncompressed. You'll probably have to eat the bullet and re-encode, or perhaps you could do without the letterboxing, if that's an option?
PS: What Scintilla said is also good to keep in mind, although it is not the reason for your bitrate skyrocketing.
Image

User avatar
Scintilla
(for EXTREME)
Joined: Mon Mar 31, 2003 8:47 pm
Status: Quo
Location: New Jersey
Contact:
Org Profile

Re: AddBorders greatly increasing bitrate

Post by Scintilla » Sat Jun 26, 2010 6:42 pm

Oh, whoops. I thought you meant you had some lossless source clip that you encoded at 640x360 with the first bitrate resulting, and then you encoded it at 640x480 with the second bitrate resulting. What I said was the only reason I could think of for a bitrate increase, but considering how few blocks it affects, it really shouldn't produce THAT much of an increase.
ImageImage
:pizza: :pizza: Image :pizza: :pizza:

User avatar
Phantasmagoriat
Joined: Mon Feb 06, 2006 11:26 pm
Status: ☁SteamPunked≈☂
Contact:
Org Profile

Re: AddBorders greatly increasing bitrate

Post by Phantasmagoriat » Sat Jun 26, 2010 7:41 pm

yeah, sounds like you are converting from a lossy to lossless format.
What settings are you saving/re-compressing with?
...some codecs like XviD have the option to set the bitrate.

But the important thing is that you save using setting that are appropriate for your task at hand. For instance, there are codecs that are good for editing, like HUFFYUV (or anything lossless). They produce big files... but are high quality and frame-accurate (which makes them perfect for editing). There are others that are best for internet distribution like x264 or XviD. They produce smaller files... but are not suited for video editing. So yeah, the settings depend on what you are using the video file for.

also, you might find this useful: bestfit( 640,480, "addborders" )
PLAY FREEDOOM!! | Phan Picks! | THE424SHOW | YouTube | "Painkiller" | Vanilla MIDI's
"Effort to Understand; Effort to be Understood; to See through Different Eyes."

Twisted871
Joined: Sat Jun 26, 2010 9:57 am
Org Profile

Re: AddBorders greatly increasing bitrate

Post by Twisted871 » Tue Jun 29, 2010 4:03 am

mirkosp wrote: You'll probably have to eat the bullet and re-encode, or perhaps you could do without the letterboxing, if that's an option?
I'm working on a project where I need to edit together clips of various resolutions(640x480 and 640x360). So to have all of the clips looking normal in the end I need to letterbox the smaller clips.
Phantasmagoriat wrote:yeah, sounds like you are converting from a lossy to lossless format.
What settings are you saving/re-compressing with?
...some codecs like XviD have the option to set the bitrate.
I was using default settings for XviD :oops:. I set the target bitrate to 1096 and the video clip is now only doubling in size which is far more manageable.

Thanks for helping a newbie out, I'm still not very familiar with VirtualDub.

Mister Hatt
Joined: Tue Dec 25, 2007 8:26 am
Status: better than you
Contact:
Org Profile

Re: AddBorders greatly increasing bitrate

Post by Mister Hatt » Tue Jun 29, 2010 11:26 am

Stop using XviD, h264 has been better since around 2004, we're in 2010 here so it's time to upgrade maybe?

User avatar
mirkosp
The Absolute Mudman
Joined: Mon Apr 24, 2006 6:24 am
Status: (」・ワ・)」(⊃・ワ・)⊃
Location: Gallarate (VA), Italy
Contact:
Org Profile

Re: AddBorders greatly increasing bitrate

Post by mirkosp » Tue Jun 29, 2010 12:06 pm

Mister Hatt wrote:Stop using XviD, h264 has been better since around 2004, we're in 2010 here so it's time to upgrade maybe?
h264 in avi isn't very suggestable.
Although, neither is xvid for editing purposes.
Pick a lossless codec... for editing it's either plain huffyuv or lags (premiere doesn't seem to like ffhuffyv12... I'm not sure, though) if you want to go avi. If you want you can try m2ts with an intra-only high bitrate lossy h.264 (lossless h.264 breaks, so yeah...).
So all in all going for lags or huffy avi is probably the best choice for editing in premiere.
Image

Mister Hatt
Joined: Tue Dec 25, 2007 8:26 am
Status: better than you
Contact:
Org Profile

Re: AddBorders greatly increasing bitrate

Post by Mister Hatt » Wed Jun 30, 2010 11:14 am

Sorry why are we suggesting lagarith again? Too lazy to rage so leaving it to Fluff: http://mod16.org/hurfdurf/?p=142

AVI isn't very suggestable for encoding purposes, so my point still stands.

User avatar
mirkosp
The Absolute Mudman
Joined: Mon Apr 24, 2006 6:24 am
Status: (」・ワ・)」(⊃・ワ・)⊃
Location: Gallarate (VA), Italy
Contact:
Org Profile

Re: AddBorders greatly increasing bitrate

Post by mirkosp » Wed Jun 30, 2010 11:39 am

Mister Hatt wrote:Sorry why are we suggesting lagarith again?
>>Premiere/After Effects/Vegas/Alikes
We're suggesting lags because at this point it doesn't matter anymore and because Premiere/AE don't recognize FFHuffYV12 ─ I assume it's the same for vegas etc.
Image

Locked

Return to “AviSynth Help”