Log in

View Full Version : Automatically pan and scan 2.35:1 and 16:9 videos to 4:3?


kolamorx
25th July 2021, 10:50
I'm looking for a Windows tool, preferably free, that can automatically pan and scan 2.35:1 and 16:9 videos to 4:3.

SeeMoreDigital
25th July 2021, 12:23
Out of interest... Why?

Nobody manufacturers 4:3 display gear anymore...

StainlessS
27th July 2021, 12:10
PotPlayer has option to "Stretch by keeping aspect ratio" which will do as you require, eg
video 2.35:1 -> 4:3 monitor
video 4:3 -> 2.35:1 monitor

Works quite well with 2.35:1 < - > 16:9 OR 16:9 < - > 4:3,
2.35 < - > 4:3 might be a bit much to expect fair results [but it will do it].

Perhaps other players have similar.

EDIT: It actually stretches 1 dimension, and crops the other, to fit the monitor.

therube
28th July 2021, 20:45
I don't know about "pan & scan", per se, but using ffplay, you can do stuff like forcing playback at a particular scale.

ffplay video.avi -fv scale=800:600


FFmpeg - Change resolution of the video with aspect ratio (https://stackoverflow.com/questions/24087249/ffmpeg-change-resolution-of-the-video-with-aspect-ratio)

FFmpeg (http://ffmpeg.org/download.html).

(ffmpeg/ffplay/ffprobe... are command line tools.)

GUI's exist that allow switching aspect ratios on-the-fly.
MPUI-hcb (https://sourceforge.net/projects/mpui-hcb/)
mpv.net (https://github.com/stax76/mpv.net) additionally does pan & scan (via GUI) - where content may actually be "cut" away. Maybe something can be automated?

manono
4th August 2021, 00:37
I'm looking for a Windows tool...that can automatically pan and scan 2.35:1 and 16:9 videos to 4:3.
There's no such thing. Do you even know what's involved?

https://en.wikipedia.org/wiki/Pan_and_scan

Do you even understand what an idiotic idea it is?

https://www.youtube.com/watch?v=5m1-pP1-5K8

pandy
12th August 2021, 15:38
As i agree with all comments about quite bizzare requirements (with respect to current technology state) then i can only say that for sure MPEG-2 support such feature called pan vector in both direction (i.e. X & Y), but even if pan vector information exist then decoder may ignore it (usually it is ignored) - i know only few products fully supporting pan vector information (by fully i mean both X&Y direction updated in real time i.e. on frame basis so pan window may be smoothly moved across video scene). In past i've used HCEnc to create such content - it is quite straightforward on this - you need prepare list of pan vectors or do this manually within HCEnc GUI. not sure about panvector status in H.264 and i'm almost 100% sure that H.265 tailored for 16:9 may be completely incapable to do panvector.

kolamorx
25th August 2021, 22:59
What is the best way to manually pan and scan 2.35:1 and 16:9 videos to 4:3?

Emulgator
28th August 2021, 13:36
I would (and do) use Vegas' Panorama/Cropping for that.
Almost on daily basis, after stabilisation.
One can conveniently add keyframes at the desired moment on the timeline, suggest 6 different acceleration curves around those keyframes (like linear, ease in/ease out and 3 more) having the desired framing moved in desired WYSIWYG manner across the source.
All planar resizing is there: shifting, zooming in and out, rotation.
And of course one can implement that as AviSynth crop script, needs just a bit more patience X-}}

kolamorx
3rd October 2021, 04:00
I've came across Adobe Premiere Pro's feature "Auto Reframe" which supposed to automatically pan and scan videos.
However, there are two problems that prevent me from using this feature:
1. This is very expensive.
2. My PC doesn't match the minimum system requirements.

Katie Boundary
3rd October 2021, 06:49
AVIsynth has a crop() filter.

Richard1485
3rd October 2021, 21:51
What is the best way to manually pan and scan 2.35:1 and 16:9 videos to 4:3?
One way is to use AviSynth's Trim() filter to break the video up into shots and then use Crop() with appropriate values for each shot; however (1) this is a lot of work (2) with true pan and scan the part of the image being extracted often varies within each shot, for which you'd need to use something like Animate() (http://avisynth.nl/index.php/Animate).That's the panning part.

https://forum.videohelp.com/images/guides/p1928732/panscan7bridespan.gif

hello_hello
4th October 2021, 08:01
In addition to Richard1485's suggestion, and this is coming from someone who's panned and scanned with Avisynth a few times, it can be incredibly tedious.

In my case I panned and scanned a couple of 4:3 sources to 16:9. If I was doing it again, which I doubt I will, I'd consider running scene change detection on the source first, then armed with the list of frame numbers for scene changes, I'd use them to add the Trims to a script, with each instance of Trim beginning on a scene change. That's where they'll be most of the time anyway and it could prevent much of the soul crushing tedium.... well, maybe not prevent it, but clamp it to unrelenting boredom.

When I tortured myself panning and scanning with Avisynth, I had to determine the cropping for each section and add it to each one along with the resizing. Often I didn't have to change the total cropping, only distribute it differently. One scene might've required 40 pixels off the bottom and 44 from the top to extract the desired picture. The next scene might need 56 from the bottom and 28 from the top, but as long as the total cropping doesn't change you only have to make sure you're cropping the picture to the correct aspect ratio once. Unfortunately though, it's only that easy in a world made of chocolate and where there's also an abundant supply of fairly dust.

Panning and scanning with just the crop filter and a resizer is do-able, but don't let that fool you into thinking it mightn't be completely mental, because it's mental.

I guess that was a longer than usual Segway into a plug for CropResize (https://forum.doom9.org/showthread.php?t=176667), but for panning and scanning it should reduce the mental to a more tolerable level. CropResize won't let you distort the picture so there's no need to keep worrying about aspect ratio. For panning and scanning to 4:3 it works something like this:

You'd determine the minimum cropping, or the amount required to remove any black or crud at the edges. Making something up here, for a 1080p source with letterbox borders that might be Crop(2, 142, -4, -140).

For CropResize it'd be (also specifying 4:3 output dimensions).

CropResize(960,720, 2,142,-4,-140)

It'll apply the specified cropping, then crop whatever extra is required for the remaining picture to have a 4:3 aspect ratio. For the above example, it'll obviously need to crop extra from each side for 4:3.
For panning and scanning, if the next scene requires different cropping, for example to move the retained picture area 34 pixels towards the right of the frame:

CropResize(960,720, 36,142,-4,-140)

After applying the cropping above, the script will crop an additional amount from each side as required to output 4:3.

There's a global GCropResize function. Specify the output dimensions along with your default cropping, and each CropResize instance will apply the cropping along with any other arguments added to GCropResize... unless of course you tell CropResize to do something different.

Each CropResize instance can create a cropping preview, and it'll look a little like the pic in Richard1485's post above, except with any luck you'll only ever need to adjust the cropping on the first frame of scene, then adjust it as required on the first frame of the next one and so on.....
Sorry.... I couldn't resist that little joke... but it's so much easier when it works that way.
You can't see a cropping change if it's on a scene change, but in the middle of one....
Now I think about, for the DVDs I panned and scanned I sometimes used "compromise cropping" for a whole scene rather than try to change it mid-scene if I could get away with it.

Anyway, using a bunch of Trims with CropResize might look like this, plus hundreds more to manually pan and scan.

Vid = last # or something
GCropResize(960,720, 2,142,-4,-140, CPreview=1)

Vid.Trim(0, 1999).CropResize() ++ \
Vid.Trim(2000, 2999).CR(0,0, 36,142,-4,-140) ++ \
Vid.Trim(3000, 3999).CR() ++ \
Vid.Trim(4000, 4999).CR(0,0, 2,142,-48,-140)

FranceBB
4th October 2021, 08:57
this is coming from someone who's panned and scanned with Avisynth a few times, it can be incredibly tedious.

I have to agree. Anyone remembers this from 2015? https://forum.doom9.org/showthread.php?t=172566

I eventually ended up doing the whole series manually in Avisynth for the company I was working for at the time (Viewster) and... it was a nightmare, honestly.

Richard1485
4th October 2021, 13:04
I eventually ended up doing the whole series manually in Avisynth for the company I was working for at the time (Viewster) and... it was a nightmare, honestly.

It must have been. A whole series! I've done manual P&S myself, and "tedious" doesn't even begin to describe the process, so I can't even imagine doing a whole series. I hope they gave you Viewster's Millions for that job. :D

StainlessS
4th October 2021, 20:33
Just floating an idea here, it may [probably] come to nothing but I wanna know how it sounds to others.
[below Posted by Richard1485]
https://forum.videohelp.com/images/guides/p1928732/panscan7bridespan.gif

I have no idea how to do this, [I aint a windows progger],
but I guess it would simplify the pan / scan if you had a movable crop box as in the image, but controlled via keyboard, left and right [or joystick].
Scan entire movie and somehow 'plant' crop box positions every now and then, recorded in some fashion.
2nd scan to tween crop box positions [somehow].
3rd scan to do the business.

Or is that too simplistic.

EDIT: How do professional systems do it?

EDIT: Could mostly [MAYBE] be done in Avisynth, if I could read keyboard cursor keys, any plugin to do that ?

Richard1485
4th October 2021, 21:34
but I guess it would simplify the pan / scan if you had a movable crop box as in the image, but controlled via keyboard, left and right [or joystick].

Yeah, it must be possible, because it's similar to what AVSEdit (https://www.youtube.com/watch?v=VWxd6YBTZZU)/AVSPMod achieved (not that I ever really used either of them). It's like having a slider (or a pair of sliders: X and Y axis) that copies its value(s) to the script, along with the current frame, if you hit a key.

Come to think of it, there was a Pan filter (http://rationalqm.us/pan.html) for VirtualDub years ago. I don't know how easy to use it was, and I don't have Wine installed to check it out, but that might be the easiest option.

StainlessS
4th October 2021, 22:41
Thanks R1485, downed AvsEdit Plus + source,
I used original AvsEdit for years and hated it, (think that one was written in delphi [or maybe VB], not sure), Plus is in C#
so probably totally different to use.
Dont know C# but i'll take a look.

I think I have source [somewhere] for some plugin that has a popup dialog box, maybe I can use that as start point
for plug that allows for keyboard communication with AVS script.

EDIT: Having totally appalling connections issues today.
EDIT: Particular problems connecting to google or USA, wonder if related to Facebook, Instagram and WhatsApp,
all being down for millions, at the moment [as reported in press].

The drop-out began around 4.30pm and problems continued to be reported around the world into Monday night,
suggesting the platforms may have been offline for all 2 billion people who use them each day.

Probably down to that ruddy FaceBook thing being connected to everything whether you use it or not.

hello_hello
5th October 2021, 06:40
Just floating an idea here, it may [probably] come to nothing but I wanna know how it sounds to others[/IMG]

I have no idea how to do this, [I aint a windows progger],
but I guess it would simplify the pan / scan if you had a movable crop box as in the image, but controlled via keyboard, left and right [or joystick].
Scan entire movie and somehow 'plant' crop box positions every now and then, recorded in some fashion.
2nd scan to tween crop box positions [somehow].
3rd scan to do the business.

You'd probably want it to zoom too. Based on my limited experience, sometimes moving the cropped area around isn't enough. For example, there might be something happening on each side of the frame (two people talking?), and moving the cropped area fully to the left might only crop half of what's on the right. Sometimes it's better to also zoom in until the right side is fully cropped.

I recall not being all that happy with the result when using Animate to adjust the cropped area. Sometimes the panning looked quite jittery so I tried to avoid it if possible.....

Well ^%&$ me! Why does every Animate/Crop example on the Avisynth wiki use Crop() to do the cropping??
Between the previous paragraph and this one I had a play with Animate, and after 10 years of using Avisynth I finally know to ask the question..... Why?? It's so obvious now I want to bang my head on the desk for a while......

Nice and smooth (a 300 pixel shift over 150 frames).

v = Version.Trim(0,149)
Animate(v, 0, 149, "Crop",
\ 0, 0, 64, 0,
\ 300, 0, 64, 0)

Not so much (a 300 pixel shift over 169 frames).

v = Version.Trim(0,169)
Animate(v, 0, 169, "Crop",
\ 0, 0, 64, 0,
\ 300, 0, 64, 0)

But when the cropping is of a sub-pixel nature....

v = Version.Trim(0,169)
Animate(v, 0, 169, "Spline36Resize",
\ 64,104, 0, 0, 64.0, 0,
\ 64,104, 300.0, 0, 64.0, 0)

Admittedly there's a truck load of monkey-see, monkey-do, for which I take full responsibility, but I could've been using Animate all this time??? Not to mention the zoom examples. It seems a few decimal points can make quite a difference there too.

As a side note, there's no shortage of artefacts when I try the zoom example on the Avisynth wiki. If I use BiliearResize it's fine, but unfortunately my poor little monkey brain doesn't understand why.

c = last.CropResize(320,240) # the source should be 320x240
Animate(c, 100,200,"BicubicResize",
\ 320,240,0,0,320,240,
\ 320,240,120,90,80,60)

As another side note, I guess I'll be updating CropResize to accept float values for cropping sometime soon.

StainlessS
5th October 2021, 12:02
Well ^%&$ me! Why does every Animate/Crop example on the Avisynth wiki use Crop() to do the cropping??
Yeah, I think there was a thread involving RaffRiff42 [and myself I think] doing the animate thing with resize ["crop" is just shorter to use in post].

hello_hello
5th October 2021, 14:19
The Animate page on the Avisynth wiki really should make mention of resizer cropping and ensuring the cropping values are float, in my opinion.

The problem with the zoom example on the wiki seems to be caused by those pesky B and C arguments. I wonder why they're in that order?

From the zoom example on the Animate page.
BicubicResize(320,240, 120,90,80,60)

https://i.postimg.cc/Z9bKyXmY/1.jpg (https://postimg.cc/Z9bKyXmY)

With b and c arguments.
BicubicResize(320,240, 0.33,0.33, 120,90,80,60)

https://i.postimg.cc/v4dmGcSV/2.jpg (https://postimg.cc/v4dmGcSV)

Gavino
6th October 2021, 18:03
... It seems a few decimal points can make quite a difference there too.
You should always use floating point values with Animate when animating a function which has float parameters.
Integer values (without decimal point) will be converted to float on entry to the animated function, but the interpolation itself will be done on an integer basis (hence potentially truncated).
As a side note, there's no shortage of artefacts when I try the zoom example on the Avisynth wiki. If I use BiliearResize it's fine, but unfortunately my poor little monkey brain doesn't understand why.
This is because (as I think you discovered later), unlike all other resizers, BicubicResize has the additional parameters b and c before the cropping parameters. (Perhaps because they existed prior to the introduction of the cropping extension). So a 'gotcha' when animating resizers is that BicubicResize is a special case and has to be explicitly given these parameters too.

So the wiki example is wrong at present (although correct if a different resizer is used in place of BicibicResize).

Richard1485
6th October 2021, 20:31
Ah, so it's just that pretty much any resizer other than BicubicResize would have done, and hello_hello just happened to choose BilinearResize. I thought that the question was why the latter, in particular, is fine in terms of artifacts. (Does the weighted average smooth them out somehow?) It's a soft resizer, so I figured that helps, but anyway I misunderstood. Thanks!

hello_hello
10th October 2021, 17:10
Well... if nothing else, CropResize makes the Ken Burns effect easy. No need to do the math in advance because the script won't distort the picture.
And it's fun watching the cropping preview animated. At least the first few times......
(This is a test version, the current CropResize doesn't accept float for cropping)

CropResize(1280,720)

v = Last.Trim(18900,18900).Loop(190)
Animate(v, 10, 179, "iCropResize",
\ 960,720, 0.0, 40.0, -400.0, -40.0,
\ 960,720, 745.0, 120.0, -250.0, -310.0)

Animate Test.mkv (https://files.videohelp.com/u/210984/Animate%20Test.mkv) (2.9MB)

Animate Cropping Preview.mkv (https://files.videohelp.com/u/210984/Animate%20Cropping%20Preview.mkv) (996kB)

https://i.postimg.cc/Z9j4fD2c/Animate-Cropping-Preview.jpg (https://postimg.cc/Z9j4fD2c)