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 > Hardware & Software > Software players

Reply
 
Thread Tools Search this Thread Display Modes
Old 12th October 2020, 11:35   #41  |  Link
butterw2
Registered User
 
Join Date: Jun 2020
Posts: 303
The mpc-be resizer uses pixel scale for the tex.x coordinate.
ex tex.x: 421.5 for a 1000x1000 output frame, whereas the typical hlsl scale, used in mpc-hc/be user shaders is [0, 1.]

For 2x magnification, the corresponding input texel center would be at: 210.75 -0.75 +0.5=210.5 in output frame coordinates, given the half-pixel offset of texel centers in hlsl.

The perf of my port is (6 texture, 79 arithmetic) for X-pass (I've removed the t==0 case because it's not required).
I would expect a significant perf improvement in 2-pass (12 texture, 158 arithmetic) vs xbmc(36, 199) because the number of texture fetches is much lower.
That said I haven't measured frame times, the bottleneck may be different on igpu (vs dgpu) and going 2-pass (vs single pass) may introduce additional overhead with avisynthshader.

I am not clear how you use the lanczos shader in your app, is it fixed 2x upscaling, arbitrary ratio resize or is it 1x interpolation ?

float4 p2: register(c2); //(W, H, px, py)
Does the avisynth script define the content of the registers ? Why does avisynthshader need the c2 register here ? Is there a difference between c2 and the values in c0 and c1 (as used by mpc-hc) ?

While it isn't off-topic here (an avisynthshader script could potentially be used for testing and maybe even in realtime ?), you are welcome to reply in your own thread if you wish.


# Mpc-hc/be Registers

player(cpu).>> registers
.................>> frame (ex: RGBA) >> pixel Shader1(gpu) >> processing surface >> pixel Shader2 >> Output

Shaders must be compiled, before they are executed (ex .cso). They can be cached on disk.
The application executing the shader can pass parameters to it through registers.

Registers contains read-only data set by the application. They can be updated every frame and are readable by user pixel shaders.
These parameters are made available by mpc-hc/be: all individual values are floats
Code:
sampler s0: register(s0); //the input frame texture
float4 p0:  register(c0);  
#define W p0.x //(p0[0]) //image Width
#define H p0.y //p0[1])  //image Height
#define Counter (p0[2])  //frame counter, ! it doesn't get reset when you stop video.
#define Clock (p0[3]) //time counter in seconds
float2 p1:  register(c1); //p1.xy
#define px p1.x //1/W 
#define py p1.y //1/H
Testing parameter/variable values
A crude method to test the content of H would be as follows:
if (abs(H-1080)<0.001) return float4(1, 0, 0, 1); //return a red pixel/screen if H is close to 1080
rounding point error means testing for equality doesn't always work with floats !
In this case (and with int variables) it is safe to write: if (H==1080) return float4(1, 0, 0, 1);

Last edited by butterw2; 25th November 2020 at 11:27. Reason: +Registers
butterw2 is offline   Reply With Quote
Old 12th October 2020, 21:11   #42  |  Link
Alexkral
Registered User
 
Join Date: Oct 2018
Posts: 319
I was referring to the metrics (psnr and ssim), I didn't test the speed.

The VDSR network learns to estimate a residual image, which is the difference between a high-resolution reference image and a low-resolution image that has been upscaled to match the size of the reference image. The low-resolution image in usually upscaled using bicubic interpolation, but I have obtained better results using Lanczos. I trained several models with different scaling factors, which are used depending on the upscaling ratio. VDSR allows for multiscale training, but it hasn't worked well for me. So it is arbitrary ratio.

In AviSynth Shader, when using the Width and Height parameters to resize the texture, the c0 and c1 registers are set to the output values, so I need to use another parameter to set another register with the input values.
__________________
AviSynth AiUpscale

Last edited by Alexkral; 12th October 2020 at 21:36.
Alexkral is offline   Reply With Quote
Old 14th October 2020, 09:01   #43  |  Link
butterw2
Registered User
 
Join Date: Jun 2020
Posts: 303
What is the benefit of training with a pixel shader resizer vs the built-in avisynth cpu implementation ?

The code for a 2-pass separable resizer (an approximation in this case) is maybe easier to understand because you only deal with 1 dimension at a time. I'm not sure how far you want to go with this or if it is even desirable, but I would assume it is possible to modify the code to achieve a larger kernel (lanczos4, etc.) without degrading performance (meaning speed) vs xbmc lanczos3.

Edit: Since you are an AvisynthShader user, are there any adaptation steps needed to made shaders compatible or does any hlsl effects shader for mpc-hc work by default ?

Last edited by butterw2; 19th October 2020 at 17:45.
butterw2 is offline   Reply With Quote
Old 14th October 2020, 16:16   #44  |  Link
Alexkral
Registered User
 
Join Date: Oct 2018
Posts: 319
There is no benefit when training, the results of the shader and the AviSynth and Matlab implementations are very similar, in fact I use Matlab's Lanczos for training and then the shader for testing in the app. The benefit comes when testing, because the bottleneck in AviSynth Shader is in the memory transfers between the CPU and the GPU, so it is slower to send the upscaled texture, than to upscale it in the GPU. This is what prevents me from using AviSynth's SincResize.

Anyway, I'm doing some tests now with the modified xbmc code and the difference in the results doesn't seem to be too significant, so I don't think using Lanczos4 would make any difference.

As for AviSynth Shader, other than what I said about the registers, I think there are only a few issues with some color formats. Using RGB as input/output, the order of the channels in the shader is changed to BGRA and they must be returned in that order.
__________________
AviSynth AiUpscale
Alexkral is offline   Reply With Quote
Old 15th October 2020, 12:52   #45  |  Link
butterw2
Registered User
 
Join Date: Jun 2020
Posts: 303
# Effects available as video pixel shaders (gpu) Grayscale and bi-color Effects

The effects listed here are meant to be used in video players (.hlsl: mpc-hc/be, etc., .hook/glsl: mpv).
It may also be possible to use them for processing/encoding of video or images. Typical video player input is compressed yuv420 (color video with chroma subsampling). Mpc-hc shaders operate on pre or post resize RGB, whereas mpv shaders can additionnaly operate on source YUV (or RGB).
Many effects have parameters that can be adjusted in the source file, and some guidance will be provided as to further customizations.

Effects apply a visual style to a video. They modify the aspect of the displayed content to change the viewing experience. They are not meant to be used permanently.
Some effects are deliberately designed to degrade the displayed video quality or imitate the elements of past video/film technology.
Some are intended for use with specific types content (Internet Videos, Music Videos, Home Captures) rather than Movies.


## Grayscale Effects (in 8bit output is 256 shades of gray)

Monochrome
- In mpv, you can zero the chroma channels from the source YUV (NoChroma.hook). This is the recommended approach if the content is in fact grayscale.
- The more general approach is to calculate luma = dot(color_RGB, LumaCoeff_RGB). The value of LumaCoeff will change how the picture looks (SweetFx.Monochrome
provides values corresponding to different film types, ex: Agfa 200X). The sum of the R, G And B components of LumaCoeff should be equal to 1.

Edge Detection
Most edge detection methods work on and output Luma. The algorithms use an adjustable detection Threshold.
- Sobel_Edge.hlsl, Sobel.hook
- Frei-Chen.hook
- Edge_Sharpen.hlsl (mod/perf optimization of mpc-hc version).
One application of Edge Detection is edge sharpening. Colored Edges can also be overlayed on the original image for stylistic effect.

Halftone dots.hlsl art effect, for video rather than movies
greyscale (mostly black and white) dot pattern, can be used twice. The mpv version (dots.hook) keeps chroma by default.



A color tinted image can be obtained from grayscale, by using the grayscale values as one of the color channels, ex: red channel.
To obtain a tinted image of any tint (ex: Sepia): color_RGB = luma * TintCoeff_RGB;
A sepia effect should ideally not change the original brightness. The white color from the original should not be changed too much. https://github.com/butterw/bShaders/...fects/Sepia.md

In mpv, the source chroma NoChroma shader could be modified to apply small offset to the grayscale value (0.5, 0.5) to get tint.


## Bi-Color Effects (Output palette only contains 2 colors)
These effects typically output Black + White output by default, but this can be changed to any color combination.

bi-Threshold.
A Binary Threshold applied to a greyscale image (typ. luma)
To avoid a full-range black and white, which can be glaring, you can clamp the output, for instance to 16-235 RGB levels.

Stipple Effect
Grayscale dithering: A grayscale image can be transformed into a bw (2-color) image with an error-diffusion algorithm (ex: atkinson, floyd-steinberg). These algorithms cannot be efficiently implemented as pixel shaders as they are not parallel, but it may be possible to use compute shaders.


# Color desaturation
The intermediate image between the color original (C) and the grayscale version (G) is a desaturated color image. It is obtained by performing a linear interpolation between C and G with s the desired strength of the effect (s is a weight between [0, 1.0] 0: C, 1: G).
desaturated_color = lerp(C, G, s); // in glsl: mix(C, G, s)

lerp(x, y, s) = x*(1-s) + y*s = x + s(y-x), with x, y: RGB vectors.

# Alpha Blending (Transparency)
The same function is used for RGB alpha blending between the color image (C) and the background (B):
alpha between [0, 1.0] 0: B (transparent image), 1.0:C (opaque)
alpha_blended_RGB = lerp(B, C, alpha)

Note: the alpha channel is present but unused in mpc-hc and mpv RGBA colors.

Last edited by butterw2; 18th February 2021 at 16:37. Reason: +Grayscale dithering
butterw2 is offline   Reply With Quote
Old 19th October 2020, 15:38   #46  |  Link
butterw2
Registered User
 
Join Date: Jun 2020
Posts: 303
# Lightweight Noise/FilmGrain Shaders

On a low intensity setting, Noise/FilmGrain improves perceptual quality of most compressed videos. In particular content with low or no noise, (ex: the source noise may have been removed at encoding to improve compressibility). It may also help mask artifacts.

The main reason not to use Filmgrain in mpc-hc/be was the performance hit on lower end systems. These new shaders offer a major speed improvement over previously available shaders without creating a visible noise pattern.

https://github.com/butterw/bShaders/...ilmGrain_Noise
- bNoise.hlsl (1 texture, 12 arithmetic)
- FilmGrain1.hlsl (1 texture, 30 arithmetic) mpv FilmGrain.glsl port.

FilmGrain/Noise refers to dynamic additive grayscale noise with a gaussian distribution for FilmGrain and a band-limited uniform distribution for Noise.

Some limited quality testing was done based on the output noise histogram obtained through screenshots, but more feedback would be welcome.

Last edited by butterw2; 19th October 2020 at 17:45.
butterw2 is offline   Reply With Quote
Old 23rd October 2020, 09:28   #47  |  Link
butterw2
Registered User
 
Join Date: Jun 2020
Posts: 303
# Unfocused Effect (ex: Large Kernel Gaussian Blur)

Implementation in mpc-hc of a pixel shader preset for fast multipass blurring was previously discussed page1 (separable kernel, blurring a downsized image, hw linear sampling, approximate gaussian algorithms: Boxblur, Kawase Blur). It's certainly possible, but not that simple to achieve high quality, high performance blur.

When upscaling, Blur should always be performed pre-resize (less pixels to handle, stronger blur effect on a lower resolution image for a fixed Kernel size). When downscaling (ex: 4K content to 1080p) Blur should be performed post-resize.
For larger kernel sizes (k), a 2-pass separable kernel approach (horizontal pass, followed by vertical pass) performs much better than a single pass 2D-convolution:
O(2k) vs O(k^2) texture fetches required, with k the kernel size.

In Mpv
mpv can apply ffmpeg libavfilter video filters to its input (uses mainly cpu). However the boxblur filter doesn't seem to work for me. It does work in ffmpeg/ffplay (a simple SDL cross-platform media player using ffmpeg): ffplay -i "video.mp4" -vf boxblur=10:10

mpv supports extra features with regard to shaders vs default mpc-hc (hw linear sampling, multipass in a single shader, multiple textures with custom resolutions, compute shaders), which means it should be possible to implement fast high quality blur shaders.

Downsizing the frame (W, H)/2 at the input of the blur shader enables stronger blurs for the same gpu usage. However decreasing the resolution too low (y<240 ?) will impact the quality of the effect.

EDIT: Blurred sidebars, which are popular on mp4 internet videos (ex: 1:1 AR displayed fullscreen on a 16/9 monitor) can be achieved using a realtime avisynth script (cpu) playable in in mpc-hc/be or mpv.

Last edited by butterw2; 9th December 2020 at 01:56. Reason: +fill_bb.avs: realtime Avisynth blurred borders
butterw2 is offline   Reply With Quote
Old 24th October 2020, 17:59   #48  |  Link
butterw2
Registered User
 
Join Date: Jun 2020
Posts: 303
# Mpv shader basics

Tests performed with a portable version of mpv-x64 on Win10:

https://mpv.io/installation/
this default mpv version doesn't come with a GUI like mpc-hc/be: it's exe (+command-line) + On-Screen-Controller + Hotkeys.

Install directory (ensure it has write permission).
create ./portable_config for configuration files:
- mpv.conf (config file, not provided by default, but you do really need one !!!)
- input.conf (custom hotkeys will override defaults)

you can put shaders directly in the install dir or you can use a subfolder. No user shaders are provided by default.

There are 3 ways to select/control shaders in mpv:
- default configuration (mpv.conf)
- launch command-line (can add shaders or override default configuration)
- hotkeys


Example ./portable_config/mpv.conf (vo=gpu d3d11 with dxva2-copy on Win10):
Code:
#-- Shaders --------
glsl-shader="noChroma.hook"
glsl-shader="./shaders/CrossHatch.hk"
# glsl-shader="./shaders/freichen.hk"
# glsl-shader="./shaders/cs_wkgroups.hk.glsl" 
--gpu-shader-cache-dir="C:\Temp" # ! set the shader cache to a directory with write access

#-- Video ------
hwdec=dxva2-copy #hwdec=d3d11va-copy
hwdec-codecs=all
gpu-api=d3d11
gpu-context=d3d11
vo=gpu
#profile=fast
audio-device=auto

#-- Scalers -- Luma/Rgb scale (dscale), Chroma (cscale)
dscale = mitchell #cscale= bilinear
scale = catmull_rom

##-- Screenshots --------
screenshot-format=png
screenshot-jpeg-quality=96

## --Window settings--------
# Start in fullscreen mode by default. #fs=yes
# force starting with centered window #geometry=50%:50%
# geometry=720x720 #fixed window size 
# don't allow a new window to have a size larger than 90% of the screen size # autofit-larger=90%x90%
# mpv doesn't have an enforceable option to start at 100% scale: 
autofit-larger=1280

keep-open=yes # Do not close the window on exit.

Last edited by butterw2; 13th January 2024 at 19:28. Reason: +gpu-shader-cache-dir
butterw2 is offline   Reply With Quote
Old 25th October 2020, 15:42   #49  |  Link
butterw2
Registered User
 
Join Date: Jun 2020
Posts: 303
Mpv shaders are written in glsl using a specific .hook syntax, they can contain a number of independent passes each with associated HOOK points.
Intro here: https://forum.videohelp.com/threads/...l)#post2597322
The main hook points in the processing pipeline are: LUMA, CHROMA (source yuv), NATIVE(yuv), MAIN (pre-resize RGB) and OUTPUT (post-resize RGB).
A single .hook file can contain multiple passes. To disable a pass, you can specify a non-existing HOOK point (ex: None).

A Pre-scaler (custom Luma or Chroma Upscaling Shader) works as follows:
Source Resolution, ex:1080p >> user Shader (ex: HOOK LUMA) >> texture resolution (ex: 2x W, H) >> (built-in scaler) >> Screen Resolution 2160p

## Using custom shaders in mpv
default shaders are configured in mpv.conf (with multiple glsl-shader= lines or a single glsl-shaders line).
Shader configuration can additionnally be configured with command-line launch parameters.
Code:
to append a shader for playback (ex: chromaOff):
mpv --glsl-shader="./shaders/NoChroma.hook" "video.mp4"

to desactivate or override config file shaders: 
mpv --glsl-shaders="" "video.mp4"
If an enabled shader has a syntax error, you will get a blue screen display and the compiler error output in the launch terminal.

Last edited by butterw2; 17th February 2021 at 23:58. Reason: +disable a pass
butterw2 is offline   Reply With Quote
Old 1st November 2020, 18:55   #50  |  Link
butterw2
Registered User
 
Join Date: Jun 2020
Posts: 303
mpc-hc > Help > Command Line Switches lists available command line options.
They can also used by editing the properties of the Windows launch icon.

The following launches mpc-hc
sets the shader preset named "Blur",
opens video1,
followed by video2 in the playlist:

mpc-hc /shaderpreset "Blur" "video1.mp4" "video2.mp4"
butterw2 is offline   Reply With Quote
Old 3rd November 2020, 20:53   #51  |  Link
butterw2
Registered User
 
Join Date: Jun 2020
Posts: 303
shader support in MPC video renderer (MPC-vr)
- newer open-source directshow renderer (uses dx11 by default on Win8+) vs default dx9 only EVR-CP
- good performance.
- x64 and x86 versions
- good integration with mpc-hc/be, but requires additional download + system install of .ax directshow filter (as admin).
- built-in shaders up/down scalers (catmull-rom, lanczos3, jinc2m, etc) for luma/chroma can be used instead of the video processor.
- built in HDR to SDR conversion.
- surface: 8, 10bit integer or 16 bit floating point.

You will need to restart the player for the following changes to be taken into account:
- Set the renderer in mpc > options > output.
- configure in : mpc > Play > Filters > mpc video renderer
-dx11 mode (requires shaders written with dx11 syntax, currently only supports post-resize user shaders !!!) or dx9

Pixel-shader support:
- User shaders are post-resize only.
- Shaders do not apply to the black borders in fullscreen mode, which can be beneficial (vs EVR-CP).
- dx11 compute shaders not supported.
- Modified shaders are only taken into account when you close/reopen mpc-hc !!!

Last edited by butterw2; 30th October 2023 at 12:07. Reason: updated
butterw2 is offline   Reply With Quote
Old 21st November 2020, 20:22   #52  |  Link
butterw2
Registered User
 
Join Date: Jun 2020
Posts: 303
# Comic-book/Toon realtime Shaders

Transform the input video for a comic book style look. This typically involves reducing the color palette and/or enhancing edges. Black and white ink techniques such as hatching can be used.

More details and some screenshots in this thread: https://forum.doom9.org/showthread.p...55#post1928755

.hlsl (tested in mpc-hc/be) and mpv .hook will be made available at bShaders/Effects.
- bStipple.hlsl: works quite well for 720p, 480p video input (use pre-resize).

Last edited by butterw2; 22nd November 2020 at 12:15. Reason: to be updated
butterw2 is offline   Reply With Quote
Old 24th November 2020, 15:34   #53  |  Link
butterw2
Registered User
 
Join Date: Jun 2020
Posts: 303
# mpv shader hotkeys

Mpv comes with a number of predefined keyboard shortcuts. You can add new shorcuts and individually override pre-existing ones by creating an input.conf file.

./portable_config/input.conf :
Code:
# Display the list of active shaders:
CTRL+0 show-text "Shaders: ${glsl-shaders:}"

# Switch to a new shader chain:
CTRL+9 change-list glsl-shaders set "NoChroma.hook"

# Associate a hotkey to a shader, so it can be toggled on/off:
CTRL+1 change-list glsl-shaders toggle "./shaders/gSmooth.hook"

# Clear all Shaders (there are 2 ways to do it, with slightly different results):
CTRL+DEL change-list glsl-shaders set "" #glsl-shaders will be a table containing an empty string, same as --glsl-shaders=""
CTRL+p change-list glsl-shaders clr all; show-text "Shaders Cleared" #glsl-shaders will be an empty table, same as --glsl-shaders-clr
Switching or Disabling shaders through a hotkey can be done without restarting the player and also works in paused mode.
EDIT:! When shaders are cleared, the previous shader chain is lost (it can't be re-enabled, it has to be re-created). To avoid this the external script shaders-switch.js can be used: https://github.com/mpv-player/mpv/issues/8512 and bound to CTRL-P.
! To force modified shaders to recompile, you have to restart-mpv.

Last edited by butterw2; 13th January 2024 at 19:27. Reason: +linked: restart-mpv
butterw2 is offline   Reply With Quote
Old 27th November 2020, 13:39   #54  |  Link
butterw2
Registered User
 
Join Date: Jun 2020
Posts: 303
#Shaders Folder, Paths and extensions

In mpv
- shaders can use any paths or file extension (.hook is typically used).
- because shaders can be specified at the command line:
---avoid spaces in filepaths.
---keep paths short
examples using a relative path from the program directory:
bw.hook
"shaders/shade.hook"



In Mpc-hc
mpc-hc uses ./Shaders for dx9 shaders.
The Select Shaders... Interface, (O) Options... > Playback > Shaders shows .hlsl files in ./Shaders and its subdirs.
If you have a lot of shaders, it is useful to move the less frequently used ones to subdirs. An empty shader named
z------------------------------------------------------------------------------------.hlsl can be used as a separator.

The interface also allows to load and save Shader presets.

Last edited by butterw2; 20th February 2021 at 17:10.
butterw2 is offline   Reply With Quote
Old 4th December 2020, 20:29   #55  |  Link
butterw2
Registered User
 
Join Date: Jun 2020
Posts: 303
# mpv Auto-Profiles
The following is an example of an automatic profile in mpv.conf based on video file properties.

The profile is triggered when profile-cond (a lua expression based on file properties) is true.
ex: profile-cond=width>=1280

in mpv.conf:
Code:
#mpv auto-profile example
[filename_wsz]
profile-desc= 4/3>>16/9 fullscreen PnS if _wsz in filename
profile-cond= string.match(filename, "_wsz")~=nil 
video-zoom=0.42
fs=yes
profile-restore=copy
When a filename containing the string "_wsz" is opened, the file is automatically displayed in fullscreen with the required Pan&Scan to remove the hardcoded black bars.
Nice.

EDIT: it's also possible to create and use a custom .wsz extension associated with mpv. In which case it's even simpler:
Code:
[extension.wsz]
profile-desc= 4/3>>16/9 PnS for files with .wsz extension
video-zoom=0.42

Last edited by butterw2; 5th December 2020 at 00:41.
butterw2 is offline   Reply With Quote
Old 5th December 2020, 07:58   #56  |  Link
chros
Registered User
 
chros's Avatar
 
Join Date: Mar 2002
Posts: 2,323
I used an auto-profile script (I think) when I played with it, but it was pretty finicky to set up more than 10 profiles based on fps, resolution, hdr, etc. But it worked in the end.
But big question is how to auto change the refresh rate of the display, displays in profiles, etc.
__________________
Ryzen 5 2600,Asus Prime b450-Plus,16GB,MSI GTX 1060 Gaming X 6GB(v398.18),Win10 LTSC 1809,MPC-BEx64+LAV+MadVR,Yamaha RX-A870,LG OLED77G2(2160p@23/24/25/29/30/50/59/60Hz) | madvr config
chros is offline   Reply With Quote
Old 5th December 2020, 14:25   #57  |  Link
butterw2
Registered User
 
Join Date: Jun 2020
Posts: 303
Profiles are a great concept: switch between different configurations using a single configuration file.
https://mpv.io/manual/stable/#profiles

Auto-Profiles on the other hand is not something I plan to use much. You have to be careful about which profile conditions are potentially triggered for any given video.

Regarding your monitor issues: it's probably worth keeping an eye on the progress of external lua scripts and the related workaround discussions for any current limitations.
butterw2 is offline   Reply With Quote
Old 8th December 2020, 19:08   #58  |  Link
butterw2
Registered User
 
Join Date: Jun 2020
Posts: 303
# New Shader features in current Nightly build of Mpc-hc
mpc-hc dev 1.9.8.65 (Dec 5 2020) https://github.com/clsid2/mpc-hc/releases

New menu entry (and shortcuts) to enable/disable shaders:
- Right-click > Shaders > Enable Pre-Resize Shaders (CTRL-P)
- Right-click > Shaders > Enable Post-Resize Shaders (CTRL-ALT-P)
The menu entry is greyed out if no shaders are present in the corresponding chain.
Disabling shaders is effective immediately even if the player is paused.

The settings' state is stored in mpc.ini:
PostSizeShadersEnabled=1
PreSizeShadersEnabled=1

Multi-pass Shaders (2P):
If a shader is named xxx_pass1.hlsl, with xxx_pass2.hlsl, etc. also present in the shaders directory, the shader will appear in the Shader-list as xxx (nP), where n is the total number of passes.
The shaders' first and subsequent passes are now loaded and removed together in a single step in the "Select Shaders..." interface.

Blur Shaders added (use pre-resize for more effective blur)
- Smoothing filter: Gaussian Blur 3x3.hlsl
- Gaussian Blur (2P), separable 7x7 Gaussian Blur, different sigma values can be selected.
Use multiple instances to achieve a stronger blur.

Finally, hardware linear sampling doesn't work in mpc-hc/be, it uses nearest neighbor sampling instead (test, not sure why).

Last edited by butterw2; 9th December 2020 at 01:58.
butterw2 is offline   Reply With Quote
Old 26th December 2020, 11:33   #59  |  Link
butterw2
Registered User
 
Join Date: Jun 2020
Posts: 303
# Custom hotkeys, Seeking, Chapters, Playlist

Customizing hotkeys and mouse actions in mpc-hc/be: Options (O) > Player > Keys
Some of the commands are only accessible through hotkeys.
Non-default hotkey values are stored in windows registry or mpc.ini under [Commands2], the list isn't in human readable form however.
mpc-hc v1.9.8:
- Added support for using Ctrl/Alt/Shift modifiers for mouse actions
- Duplicate hotkeys are now highlighted in red (only the first action gets executed)

Default Hotkeys for seeking (Jump):
mpc-hc (O) > Player > Keys > enter: jump
- Jump (medium): Left/Right arrow
- Jump (large): Ctrl + up/down mouse Wheel
- Jump (small): none
- Jump (keyframe): Shift + Left/Right arrow. Seek to previous/next keyframe
- Jump to beginning: Home
- Stop ■: .
- Frame-step |▶: Ctrl + Left/Right arrow

O > Tweaks > set Jump distances (small, medium, large. Default values in ms: 1000, 5000, 20000)


Chapter and Playlist Navigation, mpc Menu > Navigate
by default plays files in the same folder sorted by filename, without looping.
- Next ▶▶|: Page Down. Next chapter if applicable, otherwise Next file
- Next File: CTRL + Page Down

O > Tweaks > Show Chapter Marks in seek bar
O > Player (History) > Remember Last Playlist (you can reopen last opened file by pressing play after launching mpc-hc)


vs. Mpv:
mpv has different defaults but can be made to operate similarly to mpc using a custom input.conf hotkey configuration file.
Ex: mpv default seeking is by keyframe, to implement mpc Jump large(20s): Ctrl+WHEEL_UP osd-msg seek 20 exact
remaining differences:
- next chapter and playlist-next have independent hotkeys
- mpv doesn't display a black screen on Stop

Playlists in mpv allow seamless video playback
play folder (and subfolders !) sorted by filename: mpv b:\videos
play from a plain-text playlist file: mpv --playlist=play.txt

Default playlist hotkeys (override in input.conf):
< playlist-prev # skip to previous file
> playlist-next # skip to next file
ENTER playlist-next # multiple hotkeys for the same command are possible in mpv

Last edited by butterw2; 27th December 2020 at 12:42.
butterw2 is offline   Reply With Quote
Old 29th December 2020, 10:12   #60  |  Link
butterw2
Registered User
 
Join Date: Jun 2020
Posts: 303
# Screenshots

mpc-hc/be Source screenshot (Alt+I) Save Image...
...set the output parameters (stored in .ini/registry): jpg (ex: 96% JpegQuality) or .png (lossless), the output directory (SnapshotPath)
To take Output Screenshot (resized, with shaders and subtitles):
in fullscreen: Win+PrnScr (Win10 Screenshot, saved in Pictures\Screenshots)
Screenshot of window (to clipboard): Alt+PrnScr
...to get only the video frame, first Set View>Preset...>Minimal (1)
...(3) returns to Normal View
mpc-be (Shift+F5): Save Displayed Image (auto), ! this feature is not available in mpc-hc

Given that Directshow doesn't guarantee frame accurate seeking, it is preferable to select a keyframe for repeatable screenshots:
-Shift+Left/Right: Prev/Next keyframe
-Ctrl-G: Go to time/frame

---
mpv
start time, paused > mpv --start=01:00:47.102 --pause

Output screenshot (Ctrl-s)
-s: output screenshot, but with same resolution as the source file
(mpv manual) "by default: Files named mpv-shotNNNN.jpg will be saved in the working directory, using the first available number - no files will be overwritten."

The default screenshot settings can be set in mpv.conf, ex:
screenshot-format=png
screenshot-jpeg-quality=96

Last edited by butterw2; 11th November 2023 at 10:22. Reason: mpv --start=
butterw2 is offline   Reply With Quote
Reply

Tags
hlsl, mpc-be, mpc-hc, mpv, pixel shaders

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 22:28.


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