Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question on use with Anamorphic Lens #17

Open
pbiancardi opened this issue May 22, 2023 · 7 comments
Open

Question on use with Anamorphic Lens #17

pbiancardi opened this issue May 22, 2023 · 7 comments

Comments

@pbiancardi
Copy link

If I want this script to crop and stretch scope movies (2.39 / 2.35) but ignore everything else would I just change this line?

ratios = "24/9 2.4 2.39 2.35 2.2 2 1.85 16/9 5/3 1.5 4/3 1.25 9/16"

change to -

ratios = "2.4 2.39 2.35 2.2",

Will this now ignore 1.78 / 1.85?

@Ashyni
Copy link
Owner

Ashyni commented May 22, 2023

Hello,

Yes, if you want only these ratios, you can edit mpv.conf to add (This will override the default ones):
script-opts-append=dynamic_crop-ratios=2.4 2.39 2.35 2.2

Or edit the script line ratios directly with :
ratios = "2.4 2.39 2.35 2.2",

Will this now ignore 1.78 / 1.85?

Any of the above will match, and the rest is ignored.

@pbiancardi
Copy link
Author

Awesome thanks.

@Ashyni
Copy link
Owner

Ashyni commented May 22, 2023

You may also need to disable new_fallback_timer (set to 0), to have a strict behavior:
script-opts-append=dynamic_crop-new_fallback_timer=0

@pbiancardi pbiancardi reopened this May 22, 2023
@pbiancardi
Copy link
Author

This acutally isnt working. If I remove no-keepaspect from my .conf black bars are never cropped (but if I keep it in then even 4:3 is stretched to 16:9 which I do not want).

Is dynamic-crop.lua supposed to stretch the picture to get rid of the top and bottom black bars on a scope film?

@pbiancardi
Copy link
Author

Have it now - I have to take the information this script provides and tell MPV to anamorphically stretch the video if aspect is greater than 2.00 -

[AnamorphicLens]
profile-cond= dwidth / dheight >= 2
profile-restore=copy
video-scale-y=1.33

@Ashyni
Copy link
Owner

Ashyni commented May 23, 2023

Is dynamic-crop.lua supposed to stretch the picture to get rid of the top and bottom black bars on a scope film?

The script configure the crop filter with appropriate value, only if needed, then mpv handle the rest (video resolution is adjusted and scaled if necessary).
Example with 1920x1080 crop with 1920x804, fullscreen on 3440x1440:

[   4.305][d][cplayer] Run command: vf, flags=64, args=[operation="append", value="@dynamic_crop-crop:lavfi-crop=w=1920:h=804:x=0:y=138"]
[   4.318][v][vf] User filter list:
[   4.318][v][vf]   lavfi (dynamic_crop-cropdetect)
[   4.318][v][vf]   lavfi-crop (dynamic_crop-crop)
[   4.346][v][ffmpeg] dyn_cd: x1:0 x2:1919 y1:138 y2:941 w:1920 h:804 x:0 y:138 pts:3340000 t:3.340000 limit:0.062745 crop=1920:804:0:138
[   4.347][v][vf] [lavfi-crop] 1920x1080 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[   4.387][d][ffmpeg] mpv_src_default_in: w:1920 h:1080 pixfmt:yuv420p tb:1/1000000 fr:992008/41375 sar:1/1
[   4.387][d][ffmpeg] filter: w:1920 h:1080 sar:1/1 -> w:1920 h:804 sar:1/1
[   4.387][v][vf] [autorotate] 1920x804 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[   4.388][v][vf] [convert] 1920x804 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[   4.388][v][vf] [out] 1920x804 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[   4.388][v][ffmpeg] dyn_cd: x1:0 x2:1919 y1:138 y2:941 w:1920 h:804 x:0 y:138 pts:3381000 t:3.381000 limit:0.062745 crop=1920:804:0:138
[   4.472][i][cplayer] VO: [gpu-next] 1920x804 yuv420p
[   4.472][v][cplayer] VO: Description: Video output based on libplacebo
[   4.472][v][vo/gpu-next] reconfig to 1920x804 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[   4.472][d][vo/gpu-next] max content size: 3440x1440
[   4.472][d][vo/gpu-next] monitor size: 3440x1440
[   4.472][v][vo/gpu-next/win32] reset window bounds: 0:0:3440:1440
[   4.473][d][vo/gpu-next/libplacebo] Requested alpha compositing mode: VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR
[   4.473][d][vo/gpu-next/libplacebo] Requested surface transform: VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR
[   4.473][d][vo/gpu-next/libplacebo] Requested image count: 4 (min 2 max 8)
[   4.473][d][vo/gpu-next/libplacebo] Requested image size: 1920x804 (min 3440x1440 < cur 3440x1440 < max 3440x1440)
[   4.473][d][vo/gpu-next/libplacebo] (Re)creating swapchain of size 3440x1440
[   4.476][v][vo/gpu-next] Window size: 3440x1440 (Borders: l=0 t=0 r=0 b=0)
[   4.476][v][vo/gpu-next] Video source: 1920x804 (1:1)
[   4.476][v][vo/gpu-next] Video display: (0, 0) 1920x804 -> (0, 0) 3440x1440
[   4.476][v][vo/gpu-next] Video scale: 1.791667/1.791045
[   4.476][v][vo/gpu-next] OSD borders: l=0 t=0 r=0 b=0
[   4.476][v][vo/gpu-next] Video borders: l=0 t=0 r=0 b=0

The geometry property is also adjusted by the script to fix some behavior, you may want to disable it to be sure:
script-opts-append=dynamic_crop-fix_windowed_behavior=0

You can check if a crop filter is applied with shortcut i/I on desktop to display stats or check logs.

[AnamorphicLens]
profile-cond= dwidth / dheight >= 2
profile-restore=copy
video-scale-y=1.33

Good idea, do you achieve what you want with this?

You can also try to permanently change aspect ratio (just a random idea)
video-aspect-override=1.33

Do you use the Lens with a projector ?

@pbiancardi
Copy link
Author

Is dynamic-crop.lua supposed to stretch the picture to get rid of the top and bottom black bars on a scope film?

The script configure the crop filter with appropriate value, only if needed, then mpv handle the rest (video resolution is adjusted and scaled if necessary). Example with 1920x1080 crop with 1920x804, fullscreen on 3440x1440:

[   4.305][d][cplayer] Run command: vf, flags=64, args=[operation="append", value="@dynamic_crop-crop:lavfi-crop=w=1920:h=804:x=0:y=138"]
[   4.318][v][vf] User filter list:
[   4.318][v][vf]   lavfi (dynamic_crop-cropdetect)
[   4.318][v][vf]   lavfi-crop (dynamic_crop-crop)
[   4.346][v][ffmpeg] dyn_cd: x1:0 x2:1919 y1:138 y2:941 w:1920 h:804 x:0 y:138 pts:3340000 t:3.340000 limit:0.062745 crop=1920:804:0:138
[   4.347][v][vf] [lavfi-crop] 1920x1080 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[   4.387][d][ffmpeg] mpv_src_default_in: w:1920 h:1080 pixfmt:yuv420p tb:1/1000000 fr:992008/41375 sar:1/1
[   4.387][d][ffmpeg] filter: w:1920 h:1080 sar:1/1 -> w:1920 h:804 sar:1/1
[   4.387][v][vf] [autorotate] 1920x804 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[   4.388][v][vf] [convert] 1920x804 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[   4.388][v][vf] [out] 1920x804 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[   4.388][v][ffmpeg] dyn_cd: x1:0 x2:1919 y1:138 y2:941 w:1920 h:804 x:0 y:138 pts:3381000 t:3.381000 limit:0.062745 crop=1920:804:0:138
[   4.472][i][cplayer] VO: [gpu-next] 1920x804 yuv420p
[   4.472][v][cplayer] VO: Description: Video output based on libplacebo
[   4.472][v][vo/gpu-next] reconfig to 1920x804 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[   4.472][d][vo/gpu-next] max content size: 3440x1440
[   4.472][d][vo/gpu-next] monitor size: 3440x1440
[   4.472][v][vo/gpu-next/win32] reset window bounds: 0:0:3440:1440
[   4.473][d][vo/gpu-next/libplacebo] Requested alpha compositing mode: VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR
[   4.473][d][vo/gpu-next/libplacebo] Requested surface transform: VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR
[   4.473][d][vo/gpu-next/libplacebo] Requested image count: 4 (min 2 max 8)
[   4.473][d][vo/gpu-next/libplacebo] Requested image size: 1920x804 (min 3440x1440 < cur 3440x1440 < max 3440x1440)
[   4.473][d][vo/gpu-next/libplacebo] (Re)creating swapchain of size 3440x1440
[   4.476][v][vo/gpu-next] Window size: 3440x1440 (Borders: l=0 t=0 r=0 b=0)
[   4.476][v][vo/gpu-next] Video source: 1920x804 (1:1)
[   4.476][v][vo/gpu-next] Video display: (0, 0) 1920x804 -> (0, 0) 3440x1440
[   4.476][v][vo/gpu-next] Video scale: 1.791667/1.791045
[   4.476][v][vo/gpu-next] OSD borders: l=0 t=0 r=0 b=0
[   4.476][v][vo/gpu-next] Video borders: l=0 t=0 r=0 b=0

The geometry property is also adjusted by the script to fix some behavior, you may want to disable it to be sure: script-opts-append=dynamic_crop-fix_windowed_behavior=0

You can check if a crop filter is applied with shortcut i/I on desktop to display stats or check logs.

[AnamorphicLens]
profile-cond= dwidth / dheight >= 2
profile-restore=copy
video-scale-y=1.33

Good idea, do you achieve what you want with this?

You can also try to permanently change aspect ratio (just a random idea) video-aspect-override=1.33

Do you use the Lens with a projector ?
Yes this working now.

Yes override to 1.33 is same as video-scale-y=1.33. Yes I have a lens but it is on a sled so I do not want it in place unless the movie is scope, I want it out of the way if movie is not scope. So my next step is to find a way to control the 12v trigger on the lens and have MPV only trigger it when it detects a scope movie.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants