Giter Site home page Giter Site logo

vankerkom / trace.moe-media Goto Github PK

View Code? Open in Web Editor NEW

This project forked from soruly/trace.moe-media

0.0 0.0 0.0 559 KB

Media server for serving video preview for trace.moe

Home Page: https://trace.moe

License: MIT License

JavaScript 95.46% HTML 1.97% Dockerfile 2.57%

trace.moe-media's Introduction

trace.moe-media

License Discord

Media server for serving video preview for trace.moe

This server uses a "video scene cutter" which automatically detect timestamp boundaries of a shot, and then trim the shot out without leaking / exposing other frames that belongs to previous / next scenes.

This media server is now integrated into trace.moe-api. This is no longer needed for serving media preview.

Background of this project

When search result from trace.moe returns an anime, episode and a timecode, it can generate a video preview for the scene at that time code.

Query image:

Search result: Shelter, episode 1, timecode: 00:00:51.83

Video Preview at time 00:00:51.83

Fixed offset without trace.moe-media Auto detect with trace.moe-media
00:50.93 (-0.9) to 00:53.93 (+2.1) 00:49.22 to 00:51.30 (dynamic)

By using first / last frames from the fixed offset preview, user may be able to use that to search again and reveal previous/next scene of the original video. By repeating this process, users may eventually read the whole video until the rate limit/search quota used up.

With the video preview generated by auto detect method, searching any frame form the preview would only results the same video preview. This prevents leaking the previous/next scene.

How does it work

To be completed

Getting Started

docker run -it --rm -v /path/to/video/=/mnt/ -p 3000:3000 ghcr.io/soruly/trace.moe-media:latest

List files

http://127.0.0.1:3000/list/

Video URL

http://127.0.0.1:3000/file/foo/bar.mp4

For this URL endpoint, use HTTP Method PUT, DELETE to upload and delete files.

To secure this endpoint, define the TRACE_API_SECRET environment variable, and put x-trace-secret in HTTP header when sending requests.

Video Preview URL

http://127.0.0.1:3000/video/foo/bar.mp4?t=87

You can use the &size= param to specify preview size (l: 640, m: 320, s: 160)

http://127.0.0.1:3000/video/foo/bar.mp4?t=87&size=l

You can use the &mute param to generate a muted video (like GIF)

http://127.0.0.1:3000/video/foo/bar.mp4?t=87&size=l&mute

Image Preview URL

http://127.0.0.1:3000/image/foo/bar.mp4?t=87

You can use the &size= param to specify preview size (l: 640, m: 320, s: 160)

http://127.0.0.1:3000/image/foo/bar.mp4?t=87&size=l

Environment variables

VIDEO_PATH=         # e.g. /mnt/data/anilist/
SERVER_PORT=        # e.g. 3001
SERVER_ADDR=        # e.g. 127.0.0.1 or 0.0.0.0
TRACE_MEDIA_SALT=   # define any random string, or leave blank to disable secure token
TRACE_API_SECRET=   # same as TRACE_API_SECRET in trace.moe api's .env, or leave blank to disable auth

Local Development

Git clone this repository, npm install, copy .env.example to .env, Edit .env as you need, then start server

node server.js

You also can use pm2 to run this in background in cluster mode.

Use below commands to start / restart / stop server.

npm run start
npm run stop
npm run reload
npm run restart
npm run delete

To change the number of nodejs instances, edit ecosystem.config.json

trace.moe-media's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar renovate-bot avatar soruly avatar vankerkom avatar

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.