Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 15th June 2020, 16:40   #1  |  Link
Thunderbolt8
Registered User
 
Join Date: Sep 2006
Posts: 2,197
At which step does AddBorders get applied?

I want to crop parts of a movie, encode it and add black bars again afterwards because Intro and End are full frame and I cannot have different ARs within the same file.

so what I would like to be able to do is Crop -> encode -> Addborders all within the same encode. Is this possible?

E.g. with
Quote:
Crop(0, 92, 0, -92)
AddBorders(0, 92, 0, 92)
in the script. What I need for this to work is that crop gets applied before the encoding process, but Addborders only applied AFTER the frame has already been encoded as last step of the processing. Is this possible (the way I did or in general)?
__________________
Laptop Lenovo Legion 5 17IMH05: i5-10300H, 16 GB Ram, NVIDIA GTX 1650 Ti (+ Intel UHD 630), Windows 10 x64, madVR (x64), MPC-HC (x64), LAV Filter (x64), XySubfilter (x64) (K-lite codec pack)
Thunderbolt8 is offline   Reply With Quote
Old 15th June 2020, 16:57   #2  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by Thunderbolt8 View Post
what I would like to be able to do is Crop -> encode -> Addborders all within the same encode. Is this possible?
Nope.
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline   Reply With Quote
Old 15th June 2020, 17:01   #3  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
If it can be done, then can crop in Avisynth, and addborders using eg ffmpeg during encode, no idea how to do that. [perhaps x264 can also add borders, dont know]
Avisynth only processes uncompressed video/audio, nothing whatever to do with encoded clip.
Simplest would be to just trim into 3 parts, intro, main, exit, and use crop/addborders on main,
however LetterBox is better option than crop/addborders, does it in single step, and faster.
And of course splice before encode eg Intro ++ Main ++ Exit.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 15th June 2020, 17:08   #4  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
I was referring to this:
Quote:
Originally Posted by Thunderbolt8 View Post
Addborders only applied AFTER the frame has already been encoded as last step of the processing
I'm rather sure that this is impossible with any encoder. However, I'm certainly not the source of all knowledge...
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline   Reply With Quote
Old 15th June 2020, 17:07   #5  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,420
Encode as separate files with the desired cropping per section, use Matroska's linked chapters or ordered chapters feature to make it seamless on playback. No need to use AddBorders at all.
qyot27 is offline   Reply With Quote
Old 15th June 2020, 18:26   #6  |  Link
Thunderbolt8
Registered User
 
Join Date: Sep 2006
Posts: 2,197
Quote:
Originally Posted by qyot27 View Post
Encode as separate files with the desired cropping per section, use Matroska's linked chapters or ordered chapters feature to make it seamless on playback. No need to use AddBorders at all.
unfortunately my smart TVs cant deal with linked chapters or ordered chapters in matroska.
__________________
Laptop Lenovo Legion 5 17IMH05: i5-10300H, 16 GB Ram, NVIDIA GTX 1650 Ti (+ Intel UHD 630), Windows 10 x64, madVR (x64), MPC-HC (x64), LAV Filter (x64), XySubfilter (x64) (K-lite codec pack)
Thunderbolt8 is offline   Reply With Quote
Old 15th June 2020, 17:16   #7  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
impossible with any encoder
Maybe, but I think ffmpeg could possibly do it as an extra step after encode, but I'm just guessin'.
anyways, qyot27 seems to have it well sussed out.

EDIT: Crap, gotta run like hell to try catch shop open.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 15th June 2020, 18:40   #8  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,420
The thing you're essentially asking for is either a variable resolution file (which arguably *might* be possible with MKV, but most probably not; MPEG-2 TS can get around it via streaming chunks, where each chunk can have its own resolutionı), or variable anamorphic flagging per-frame/GOP (which AFAIK, nothing supports). Capable software or hardware players will do auto-letterboxing/auto-pillarboxing if the AR of the video doesn't match the display AR, but to have resolution changes in a single file one of the segments has to be hard letterboxed/pillarboxed beforehand, and that cannot be done at playback, it has to be done before encoding.

ıyes, this is what happens when watching an online stream from TV broadcasters, at least in the US. The main program may be a constant resolution, so long as your internet connection is good, but the advertisements can vary wildly. If you're not careful, a stream downloader could bork your output file if you don't compensate for this.

So either you fix the sections of the video using Trim so you can keep the 4:3 content untouched while letterboxing the 16:9 parts (or Trim so you can pillarbox the 4:3 sections and leave the 16:9 ones alone) and Splice them back together at the end of the script before giving the script to the encoder, as StainlessS suggested, or you can have the segments as separate files with their own properties and attempt to do whatever is possible to make it seamless on playback (if being played off a USB stick, just having the files named sequentially might trick the TV enough to be passable, with a pause between the segments being more/less noticeable based on the TV...if the TV is set to just autoplay the next file and not go back to the file menu). If MKV won't work for the purpose, you're probably out of luck. A playlist file is a dumb measure that, again, a TV probably can't handle, and probably won't be seamless even on a computer.
qyot27 is offline   Reply With Quote
Old 15th June 2020, 18:57   #9  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,420
Example of a 640x480 video with 4:3 intro/outro and 16:9 hard-letterboxed main segment, switching it to a 16:9 848x480 video so the main segment looks correct on modern TVs, with the intro/outro pillarboxed:
Code:
v=FFMS2("input",atrack=-1)
v1=v.Trim(0,5000).AddBorders(104,0,104,0) #adds pillarboxing to sides of 640x480 video to make it 848x480
v2=v.Trim(5001,25000).Crop(0,64,0,-64).BilinearResize(848,480) #crops existing letterboxing from 16:9 segments, resizes to 848x480
v3=v.Trim(25000,0).AddBorders(104,0,104,0) #adds pillarboxing to sides of 640x480 video to make it 848x480
v1 ++ v2 ++ v3 #puts all three segments back together

Last edited by qyot27; 15th June 2020 at 19:03.
qyot27 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:55.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.