Coder Social home page Coder Social logo

Comments (7)

Ashyni avatar Ashyni commented on July 22, 2024 1

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.

from mpv-scripts.

Ashyni avatar Ashyni commented on July 22, 2024 1

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

from mpv-scripts.

pbiancardi avatar pbiancardi commented on July 22, 2024

Awesome thanks.

from mpv-scripts.

pbiancardi avatar pbiancardi commented on July 22, 2024

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?

from mpv-scripts.

pbiancardi avatar pbiancardi commented on July 22, 2024

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

from mpv-scripts.

Ashyni avatar Ashyni commented on July 22, 2024

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 ?

from mpv-scripts.

pbiancardi avatar pbiancardi commented on July 22, 2024

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.

from mpv-scripts.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.