Coder Social home page Coder Social logo

vs-preview's Introduction

Standalone previewer for VapourSynth scripts

Fork of Endilll's vapoursynth-preview (not maintained anymore)

This program is meant to be paired with a code editor with integrated terminal like Visual Studio Code.

Prerequisites

  1. Python (3.10+ required)
    • Make sure to install Python to your PATH.
  2. VapourSynth (R65+ required)

Installation

Install latest stable via pypi:

pip install vspreview

Install latest git:

pip install -U git+https://github.com/Jaded-Encoding-Thaumaturgy/vs-preview.git

Usage

It can be used by running vspreview script.vpy or your preferred way in your IDE.

Keyboard Shortcuts

Saved Frame Filename Variables

IDE Integration

Plugins

You can install external plugins by using the following command:

vspreview install [plugin-name]

A list of plugins can be found in this repo. plugin-name is the name of the plugin directory in the repo.

To develop new plugins or manually install them, create a .ppy file inside the global plugins directory. You can find the path to that in the storage file. You can add additional search paths by adding them to a .pth file inside the global plugins directory, just like you can with python path and site-packages.

vs-preview's People

Contributors

akarinvs avatar arch1t3cht avatar djatom avatar dnjulek avatar endilll avatar jsaowji avatar justintarthur avatar kapppa avatar kenany avatar lightarrowsexe avatar mukunku avatar nsqy avatar orangechannel avatar po5 avatar rivenskaye avatar saltychiang avatar setsugennoao avatar sgt0 avatar shssoichiro avatar thechaoscoder avatar wallace11 avatar wiwaz avatar wwww-wwww avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

vs-preview's Issues

Improve window size/position

vs-preview always opens in the same position, which has to be moved, resized or open in fullscreen mode.
This can lead to having part of the window hidden. Adding a option to launch in fullscreen window mode to settings would be nice.

The first example is default vspreview.
On the second, I relaunched vspreview after toggling some of the extra options. The window is too tall for my display so I am forced to resize manually or switch to fullscreen.

Save zoom location + level in global config.

It would be nice if there was a way to save the zoom location and level of the previewer in a way that can be easily reused between projects and sessions. i.e. 1128, 400 at 800%.

Latest version fails to start

Steps:

I updated to the latest version using pip install -U git+https://github.com/Irrational-Encoding-Wizardry/vs-preview.git --user

Issue:

Upon trying to load vspreview with any vpy script, or even running vspreview --help or vspreview --version, I receive a crash with the following backtrace:

Traceback (most recent call last):
  File "C:\Users\jholm\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\jholm\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\jholm\AppData\Local\Programs\Python\Python310\Scripts\vspreview.exe\__main__.py", line 4, in <module>
  File "C:\Users\jholm\AppData\Roaming\Python\Python310\site-packages\vspreview\__init__.py", line 1, in <module>
    from .init import main  # noqa: F401
  File "C:\Users\jholm\AppData\Roaming\Python\Python310\site-packages\vspreview\init.py", line 18, in <module>
    from .main import MainSettings, MainWindow
  File "C:\Users\jholm\AppData\Roaming\Python\Python310\site-packages\vspreview\main\__init__.py", line 3, in <module>
    from .window import *  # noqa: F401, F403
  File "C:\Users\jholm\AppData\Roaming\Python\Python310\site-packages\vspreview\main\window.py", line 26, in <module>
    from ..toolbars import Toolbars
  File "C:\Users\jholm\AppData\Roaming\Python\Python310\site-packages\vspreview\toolbars\__init__.py", line 12, in <module>
    from .main import MainToolbar
  File "C:\Users\jholm\AppData\Roaming\Python\Python310\site-packages\vspreview\toolbars\main\__init__.py", line 1, in <module>
    from .toolbar import *  # noqa: F401, F403
  File "C:\Users\jholm\AppData\Roaming\Python\Python310\site-packages\vspreview\toolbars\main\toolbar.py", line 13, in <module>
    from .dialog import FramePropsDialog
  File "C:\Users\jholm\AppData\Roaming\Python\Python310\site-packages\vspreview\toolbars\main\dialog.py", line 57, in <module>
    } | dict([
  File "C:\Users\jholm\AppData\Roaming\Python\Python310\site-packages\vspreview\toolbars\main\dialog.py", line 58, in <listcomp>
    _create_enum_props_lut(enum, name)
  File "C:\Users\jholm\AppData\Roaming\Python\Python310\site-packages\vspreview\toolbars\main\dialog.py", line 25, in _create_enum_props_lut
    pretty_name: {
  File "C:\Users\jholm\AppData\Roaming\Python\Python310\site-packages\vspreview\toolbars\main\dialog.py", line 26, in <dictcomp>
    idx: enum.from_param(idx).pretty_string if enum.is_valid(idx) else 'Invalid'
  File "C:\Users\jholm\AppData\Local\Programs\Python\Python310\lib\enum.py", line 437, in __getattr__
    raise AttributeError(name) from None
AttributeError: is_valid

I am on Windows 11 with Vapoursynth r61 and Python 3.10.

Save window geometry in global instead of local storage

This is potentially related to #21, but I wasn't sure how much it overlapped so decided to create a new issue.

I think the common workflow is that most people want to have their vspreview window in the same location for each video file they're working on, rather than having it reset to the default location for each new file. Having to move the window each time is a minor annoyance rather than a significant issue, but it would be more convenient, in my opinion, to have the geometry saved globally rather than per file.

Crash when pressing (un)mute button when there's no audio track

This should probably throw a warning, but not flat-out crash vspreview.

Traceback (most recent call last):
  File "C:\Users\light\AppData\Local\Programs\Python\Python310\lib\site-packages\vspreview\toolbars\playback\toolbar.py", line 530, in on_mute_clicked
    self.setMute(not self.audio_muted)
  File "C:\Users\light\AppData\Local\Programs\Python\Python310\lib\site-packages\vspreview\toolbars\playback\toolbar.py", line 537, in setMute   
    self.play_audio()
  File "C:\Users\light\AppData\Local\Programs\Python\Python310\lib\site-packages\vspreview\toolbars\playback\toolbar.py", line 259, in play_audio
    self.current_audio_frame = self.current_audio_output.to_frame(
AttributeError: 'NoneType' object has no attribute 'to_frame'

Menu for hotkey binding

Having a menu to see and adjust hotkey binds would be useful. This gives users an instant way to see what maps to what, as well as allows them to change it to something they're more comfortable with.

Vspreview crashes when script errors are resolved

When loading up a vspreview script (possibly for the first time?), if you run into any error and reload vspreview after fixing it, it will print out the following error:

Traceback (most recent call last):
  File "C:\Users\light\AppData\Local\Programs\Python\Python310\lib\site-packages\vspreview\main\dialog.py", line 43, in on_reload_clicked
    self.main.reload_script()
  File "C:\Users\light\AppData\Local\Programs\Python\Python310\lib\site-packages\vspreview\main\window.py", line 471, in reload_script
    self.load_script(self.script_path, reloading=True)
  File "C:\Users\light\AppData\Local\Programs\Python\Python310\lib\site-packages\vspreview\main\window.py", line 271, in load_script
    self.change_video_viewmode(self.current_viewmode)
  File "C:\Users\light\AppData\Local\Programs\Python\Python310\lib\site-packages\vspreview\core\abstracts.py", line 330, in change_video_viewmode
    self.outputs.switchToNormalView()
AttributeError: 'list' object has no attribute 'switchToNormalView'

The error can be anything, so long as it makes vspreview error.

Reproduction steps:

  1. Save the following script to a new file:
from lvsfunc import source

src = source("PATH/TO/A/VIDEO")

raise ValueError

src.set_output()

Replace PATH/TO/A/VIDEO with a path to a video.

  1. Start vspreview
  2. Get an error because you raised a ValueError
  3. Remove the raise ValueError line and refresh vspreview
  4. vspreview will crash and return the above error.

Automatically resize frameprop text and/or window menu

If your clip has a buttload of props, the frameprop menu will display them like this.

image

You won't often get this many props, but automatic scaling/windows resizing to accommodate all of them (maybe with a max height of the user's screen height or something to avoid it getting waaaayy too long?) would be appreciated.

Scening importing v1 keyframes doesn't work

When importing files for scening, you get the following menu, signifying there is support for v1 keyframes:

image

The keyframes were generated using the vstools.Keyframes.to_file method, which adds a v1 header to the file. File in question: NegimaS2DVD_01_scening.txt

When loading in, nothing appears to happen. However, the file works flawlessly when choosing IfoEdit Celltimes.

Split plane mode

I think it'd be useful to have the ability to switch to a mode that has a clip split into its individual planes. This allows users to more easily follow how their filtering is affecting for example the chroma planes. Right now the best way to do so is to just split and stack them yourself, a la lvsfunc.stack_planes. I think having this kind of behaviour built-in under perhaps the same dropdown menu as dft would be a nice addition.

Add colourblind mode

Having options for colorblind people might be a nice addition. There's a number of colourblind encoders, so helping them in any way would be pretty cool. This might also indirectly improve encodes by allowing them to view their filtered output a bit closer to how non-colourblind people would.

Color Management setting QT API update

2023-02-17 23:48:58.709: root: ERROR: There was an error while loading the script!
| Traceback (most recent call last):
|   File "C:\Users\light\AppData\Local\Programs\Python\Python311\Lib\site-packages\vspreview\main\window.py", line 277, in load_script
|     self.load_storage()
|   File "C:\Users\light\AppData\Local\Programs\Python\Python311\Lib\site-packages\vspreview\utils\utils.py", line 67, in _wrapped
|     ret = func(*args, **kwargs)
|           ^^^^^^^^^^^^^^^^^^^^^
|   File "C:\Users\light\AppData\Local\Programs\Python\Python311\Lib\site-packages\vspreview\main\window.py", line 374, in load_storage
|     self.current_screen = self.app.desktop().screenNumber(self)
|                           ^^^^^^^^^^^^^^^^
| AttributeError: 'QApplication' object has no attribute 'desktop'

Traceback (most recent call last):
  File "C:\Users\light\AppData\Local\Programs\Python\Python311\Lib\site-packages\vspreview\main\window.py", line 710, in moveEvent
    screen_number = self.app.desktop().screenNumber(self)
                    ^^^^^^^^^^^^^^^^
AttributeError: 'QApplication' object has no attribute 'desktop'```

set_output with timecodes is broken

I generated a timecode file with vspipe on the very same clip I'm trying to output.
vspreview.set_output(clip, timecodes="timecodes_1.txt")

I get the following error (timecodes_1.txt):
FramesLengthError: (set_timecodes) timecodes file length mismatch with clip's length! (timecodes=158, clip=159)

Weirdly, manually adding one line to the timecodes file reports one less frame. (timecodes_2.txt)
FramesLengthError: (set_timecodes) timecodes file length mismatch with clip's length! (timecodes=157, clip=159)

Adding one more line jumps to 160 frames. (timecodes_3.txt)
FramesLengthError: (set_timecodes) timecodes file length mismatch with clip's length! (timecodes=160, clip=159)

Remember old comps

It might be nice to store the name and url of older comps in the local storage to find it back easily. You can force an update once the upload is finished, and this way users can easily find them back. Especially useful if you're unfortunate like me and the previewer often crashes directly after it's done. :(

I'd set a limit to it, though. Probably 5 comps saved by default until it starts overwriting them to avoid it from getting too busy (with a setting allowing that to be changed?)

Warn the user before deleting list

Padre nostro che sei nei cieli,
sia santificato il tuo nome,
venga il tuo regno,
sia fatta la tua volontà
come in cielo così in terra.

Dacci oggi il nostro pane quotidiano,
e rimetti a noi i nostri debiti
come noi li rimettiamo ai nostri debitori,
e non ci indurre in tentazione,
ma liberaci dal male.

Amen.

High DPI rendering

I've set DPI scaling to 200% at windows setting(Global).
image
I notice that the frame rendering at 200% too (the ui shows 100% scaling, but it spends 4x actual pixels). is it possible to keep it 100% size (pixel to pixel) even when I set the DPI to 200%

Frame Props dialog shows BT.709 Primaries as Unspecified

Gotta admit this is a weird one, because I checked the code and the primaries are indeed in the correct order in the list vspreview has.

The issue I'm seeing is that, when opening the Frame Props dialog for a script where _Primaries is set to 1, the Frame Props dialog shows "Unspecified" instead of the expected "BT.709". Matrix and Transfer properties display correctly, and all other Primaries except BT.709 also display correctly.

Zoom from storage not applied when initial run errors

Saved zoom is broken when

  • Saved zoom != 100%
  • Initial script load gives an error
  • Reload doesn't error
    You end up with your saved zoom value selected but not applied, e.g. 200% displayed in dropdown but the video is actually 100% zoom

Pipette new colour formats

It'd be neat if the pipette also displayed HTML colour codes and HSL values (like aegisub). A couple filters use the first (like TColorMask), and the latter may be useful for other applications and is common enough in a fansubber's life.

Vspreview crashes when saving image

Traceback (most recent call last):
  File "C:\Users\light\AppData\Local\Programs\Python\Python310\lib\site-packages\vspreview\toolbars\misc\toolbar.py", line 183, in on_save_frame_as_clicked
    heuristics = video_heuristics(self.main.current_output.source.clip, props, string_only=True)
TypeError: video_heuristics() got an unexpected keyword argument 'string_only'

This error seems to stem from vstools.

def video_heuristics(clip: vs.VideoNode, props: vs.FrameProps | None = None, prop_in: bool = True) -> dict[str, int]:
    ...

10-bit display detection

There's an error message for the bit depth detection:
QPixmap: QGuiApplication must be created before calling defaultDepth().
When the GUI instance is not ready, the function returns zero.

Video is always scaled when Windows DPI scaling is enabled

Per the title, I've noticed that in recent versions (using latest version from PyPi as of 12/28, about 10 minutes ago), vspreview's video output* is now automatically scaled when Windows DPI scaling is enabled, and I can't find a way to disable it (I have fiddled with the DPI option in settings, too, to no effect). This means that unless I disable DPI scaling in Windows, I can't view my filterchain without vspreview's scaling. A workaround would be greatly appreciated.

** Edit: I'm dumb, setting a custom zoom level allows bypassing this. Just assumed it'd be upscaled and then downscaled.

comp: dark bias setting

I think it'd be useful for there to be a setting to introduce a "dark bias", where it will lean more towards frames that are on average darker. This can be accomplished using PlaneStats, but I'm sure there's maybe better ways to do it.

Vspreview crashes when you stop it from comping

When you stop vspreview from making a comparison, it crashes immediately with the following error:

QThread: Destroyed while thread is still running

Reproduction steps:

  1. Open up vspreview with two output nodes
  2. Start making a comparison
  3. Press "Stop Upload"
  4. Crash

Scene Tool Crashing

Hello when i tried to use it it crashes with two crashes.

CRASH: Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\site-packages\vspreview\toolbars\scening\dialog.py", line 150, in on_label_changed
    index = self.tableview.selectionModel().selectedRows()[0]
IndexError: list index out of range

NEW CRASH:

Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\site-packages\vspreview\main\timeline.py", line 272, in mouseMoveEvent
    QToolTip.showText(event.globalPosition(), notch.label)
TypeError: showText(QPoint, str, widget: QWidget = None, rect: QRect = {}, msecShowTime: int = -1): argument 1 has unexpected type 'QPointF' 

Button to find scene changes

A neat feature may be to, when you click a button, run wwxd/scxvid on the current output node and iterate over the entire clip. Alternatively, a helper function the user can import that allows you to pass a clip and an enum determining the mode (wwxd, scxvid, both, etc. Check the old lvsfunc or vsencode code for one such example, I forgot which one has it).

Additionally, hotkeys to jump from scene to scene might be neato as well if they do not exist yet. If they do, the user can just use those binds.

Comp prompt user when comparison is done

Making comparisons, especially on filtered output, can take a while. If the user is using vspreview directly, it might be nice if the program on the taskbar flashes orange when the comparison is done. I'm not sure how feasible this is, but it should at least be possible on Windows. Maybe worth making a generic function in case you wanna start prompting users for other tasks, too?

Add more previewer dithering modes

Sometimes it may be desired to preview with ordered dithering, or even no dithering at all. An option to configure this with ease would be very convenient.

install when using portable version of vapoursynth

When I try to install vs-prevpiew using pip, it searches for an installed version of vapoursynth which doesn't show up in my case as I have a portable installation. An error is returned:

OSError: Couldn't detect vapoursynth installation path

Is it possible to manually specify the installation path or get around this some other way?

comp: n frames between frames settings

With the current random implementation, you can sometimes get a lot of frames that are right next to each other. I think having a "n frames between comparison frames" option would help alleviate that issue somewhat. Otherwise, you could always add some kind of similarity check with the previous frame in the list, and maybe automatically ignore frames that are x% a solid colour. This will stop it from randomly picking fully white/black frames.

Ideally these would all be settings too, so people can use them if they want to, or otherwise just go full random.

Print comp progress to stdout

Copied from #29.

Additional nicety would be to also print the progress of comps being made to stdout, including the final url. Useful in case you close vspreview but forgot to copy the link, or if it crashes straight after uploading (as has happened to me before).

Crash when switching between output nodes with Frame Props dialog.

QLayout::removeWidget: Cannot remove a null widget.
Traceback (most recent call last):
  File "vspreview/main/window.py", line 557, in switch_output
    self.switch_frame(self.current_output.last_showed_frame)
  File "vspreview/main/window.py", line 530, in switch_frame
    toolbar.on_current_frame_changed(frame)
  File "vspreview/toolbars/main/toolbar.py", line 146, in on_current_frame_changed
    self.frame_props_dialog.update_frame_props(self.main.current_output.props)
  File "vspreview/toolbars/main/dialog.py", line 117, in update_frame_props
    self.framePropsVLayout.clear()
  File "vspreview/core/abstracts.py", line 106, in clear
    widget.setParent(None)  # type: ignore
AttributeError: 'NoneType' object has no attribute 'setParent'

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.