Giter VIP home page Giter VIP logo

mpv-webp-generator's Introduction

mpv-webp-generator for windows

Creates high quality animated webp using mpv hotkeys

Fruits Basket Season 2

Based on Scheliux's gif generator port to windows, which you cand find here.

Thanks to July who helped me with ffmpeg's parameters.

Requirements

  • Windows
  • mpv
  • ffmpeg

Installation

First of all, you must make sure ffmpeg is in your %PATH% and accesible via your command line. After ensuring this, clone or download as zip. Then, head to %APPDATA%/mpv/scripts and place mpv-webp.lua in there; if neither %APPDATA%/mpv nor %APPDATA%/mpv/scripts exist, you will have to create them. It's as easy as that!

How to install ffmpeg

Configuration

Note this is still in progress and might not work properly

The three options the script offers (at least for now) are:

  • dir – Sets the output directory. Default is C:\Users\%USERNAME%\Desktop\.
  • rez – Sets the resolution of the output webp. Default is 600 width.
  • fps – Sets the framerate of the output webp. Default is 15. Don't go too overboard or the filesize will balloon.

webp settings

  • qscale - set as 90 out of 100. It will determine the quality of the webp. Not recommended to go lower than 85.
  • lossless - set as 0 by default (lossy), change to 1 for lossless. When doing a lossless export, qscale will no longer determine the quality, but the encoding eficiency.
  • compression_level - set as 6 out of 6. The process might take a while, so if you don't want to wait, you should lower it, but the lower the value, the bigger the filesize.

Usage

You can use , and . to rewind or foward one frame at a time in order to select the desired starting and ending frames of the webp. You only need to define the start and ending times and to choose if exporting with or without subtitles. In order to do that, you can use the following hotkeys:

  • w - Start time
  • W - End time
  • CTRL+w - Export webp
  • CTRL+W - Export webp with subtitles - only works with srt

Stuff to do

If you wish to contribute, here are some suggestions:

  • Remake the section that handles hardsubbing to support not only srt, but also ass/ssa while keeping its styles.
  • Add support for a config file to customize not only webp's settings, but also keybindings and output directory. (at least I can't make it work on my pc)
  • Add automatic crop to crop black borders out of video without interfering with DAR. User must be able to enable and disable this feature via .conf file.

mpv-webp-generator's People

Contributors

doncanjas avatar dyphire avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

ciases greqov

mpv-webp-generator's Issues

Filename increment doesn't work, always get _000.webp

Hello!
Thanks for your script. It works as expected.
I had a minor issue with filenames, files always ends with _000.webp. So each new file overwrites previous one (for the same video of course). Can you check this issue someday?
Cheers!

suggestion for key binding method

Right now, the script explicitly holds 4 sets of key bindings.
That is a bit too much (especially when the user is using a lot of different scripts).

I suggest doing what some other scripts do, which is have 1 key binding to activate the script, and then the script is activated, temporarily "hijack" or set key bindings for the rest of the functionality, and then release those key bindings after the script has been deactivated.

for example:
Shift+w activates and deactivates the script

OSD shows:

Webp gen:
1	start	00:00:00:000
2	end	00:00:00:000
w	Generate webp
s	Generate webp w/ sub

So the keys 1, 2, w, s only interact with the script when it is activated and showing on screen.
For en example of another script that works this way, see: Webm Converter

ps. Generating with or without subtitle doesn't really need to be different functions, can just check if subtitle has been set to visible or not inside MPV

qscale

When using the script, ffmpeg says:
"Please use -q:a or -q:v, -qscale is ambiguous"

I think maybe setting the quality can be updated to use the recommended method instead.

Error creating Webp check console for more info

MPV version: mpv-x86_64-v3-20240114-git-bd35dc8

ffmpeg version installed: 6.1.1 full build

OS: Windows 11 64-bit

mpv-webp.lua is located at C:\Users\Aaron Cotton\AppData\Roaming\mpv\scripts

I use w to start the webp and shift+w to choose the end of the webp. I then press and hold ctrl+w together to create the Webp but then get the following message: "error creating webp, check console for more info."

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.