2025-10-04 17:26:26 +03:00
2025-08-22 23:57:34 +03:00
2025-08-22 23:57:34 +03:00
2025-08-22 23:58:30 +03:00
2025-08-22 23:58:30 +03:00
2025-08-22 23:57:34 +03:00
2025-10-04 17:26:26 +03:00

Video Encoder (videnc)

A Deno-based video encoding application that converts videos to the AV1 video codec with Opus audio in MKV containers.

Features

  • Encodes videos to AV1 (libsvtav1) for high efficiency
  • Converts audio to Opus for excellent quality at low bitrates
  • Automatically detects video properties (resolution, frame rate, interlacing, anamorphic content)
  • Applies appropriate filters for interlaced and anamorphic content
  • Preserves and embeds metadata
  • Integrates with OMDB API for automatic metadata fetching
  • Generates shell scripts for encoding commands
  • Supports multiple audio and subtitle streams

Prerequisites

  • Deno v1.0 or higher
  • FFmpeg with libsvtav1 support
  • FFprobe (usually bundled with FFmpeg)

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd videenc_ts
    
  2. Ensure you have Deno installed:

    deno --version
    
  3. Ensure you have FFmpeg with libsvtav1 installed:

    ffmpeg -version
    ffmpeg -h encoder=libsvtav1
    

Usage

Basic Usage

./videnc -i <input_video_file>

This will analyze the video and generate a shell script (encode.sh or encode_N.sh) containing the FFmpeg command for encoding.

With OMDB Metadata

To use OMDB metadata:

  1. Get an API key from OMDB API
  2. Add it to your settings file at ~/.config/videnc/settings.json:
    {
      "omdb_api_key": "your_api_key_here"
    }
    
  3. Run the encoder with a video file:
    ./videnc -i <input_video_file>
    
  4. When prompted, enter the IMDb ID for the video (e.g., tt0111161 for The Shawshank Redemption)

Building

You can build the application in two ways:

Using Make

make build

Using Deno Compile

deno compile --allow-all --output ./videnc ./src/main.ts

Both methods will create a standalone executable named videnc.

How It Works

  1. Video Analysis: Uses FFprobe to analyze the input video file and extract technical information
  2. Metadata Fetching: Optionally fetches metadata from OMDB API using the provided IMDb ID
  3. Profile Selection: Automatically selects encoding profiles based on video resolution:
    • DVD profile for videos with less than 1 megapixel
    • BluRay profile for higher resolution videos
  4. Command Generation: Creates an optimized FFmpeg command with appropriate settings for:
    • Video encoding (AV1 with libsvtav1)
    • Audio encoding (Opus)
    • Subtitle handling (copy)
    • Metadata embedding
    • Filters for interlaced and anamorphic content
  5. Script Creation: Generates a shell script with the encoding command

Encoding Profiles

DVD Profile

  • CRF: 29
  • Preset: 2
  • Film Grain: 5

BluRay Profile

  • CRF: 27
  • Preset: 2
  • Film Grain: 5

Example Generated Command

ffmpeg \
  -hide_banner \
  -i "input_video.mp4" \
  -map_metadata -1 \
  -map 0:v \
  -c:v libsvtav1 \
  -pix_fmt yuv420p10le \
  -crf 27 \
  -svtav1-params keyint=120:tune=0:film-grain=5:scd=1:film-grain-denoise=1:enable-overlays=1:enable-qm=1:qm-min=0:qm-max=15 \
  -preset 2 \
  -vf "bwdif=mode=0,scale=iw*sar:ih:lanczos,setsar=1,scale=-2:ih:lanczos" \
  -map 0:a:0 \
  -c:a:0 libopus \
  -metadata:s:a:0 language=eng \
  -disposition:a:0 default \
  -map 0:s:0 \
  -c:s:0 copy \
  -metadata:s:s:0 language=eng \
  -disposition:s:0 -1 \
  "output_video.av1.mkv"

License

This project is licensed under the MIT License - see the LICENSE file for details.

S
Description
Latest installment of Video encored. This time build with Deno
Readme MIT
48 KiB
Languages
TypeScript 99%
Makefile 1%