Skip to content

Create scripts to convert videos to h265 using ffmpeg

Notifications You must be signed in to change notification settings

RakambdaOrg/MediaConverter

Repository files navigation

MediaConverter

Convert in batches some formats into another.

CLI arguments

Flag Mandatory / Optional Description

-c

O

Path to the configuration file. Default is ./config.json.

-t

O

How may conversions are performed in parallel

-ft

O

FFMPEG threads (-threads option)

--ffprobe

O

Path to ffprobe

--ffmpeg

O

Path to ffmpeg

Configuration file

Configuration is now declared in a json file with the following format:

{
  "conversions": [
    {
      "input": "/path/to/input",
      "output": "/path/to/output",
      "database": "/path/to/database.db",
      "temp": "/path/to/temp",
      "deleteInput": false,
      "excluded": [
        "subfolder/to/exclude",
        "another/too"
      ],
      "processors": [
        "VIDEO_HEVC_MKV",
        "AUDIO"
      ],
      "extensions": [
        "mp4",
        "mts",
        "mp3"
      ],
      "filters": [
        {"name": "LengthMoreThan", "value": 50}
      ]
    }
  ]
}
Key Mandatory / Optional Description

conversions

O

List of conversions to perform

conversions.input

M

Path to the input folder.

Warning
This folder is scanned recursively

conversions.output

M

Path to the output folder.

Structure will be kept the same as the input folder.

conversions.database

O

Path to a database file that will keep scan results between executions. This is useful if input folder is large and converted files never move.

conversions.temp

O

Path to a directory where temporary files (conversions in progress) will be placed

conversions.deleteInput

O

Delete input file on success or not (default true)

conversions.excluded

O

List of relative paths to be excluded from the conversion.

conversion.processors

O

List of processors to apply. If left empty, all of them will be applied.

  • VIDEO_HEVC_MKV

  • VIDEO_AV1

  • AUDIO

  • TIFF

conversion.extensions

O

List of file extensions to process. If left empty the default one is used.

conversion.filters

O

List of filters to apply after scanning files. Can be one of :

  • LengthMoreThan (value : seconds)

  • LengthLessThan (value : seconds)

Processors

  • VIDEO_TO_HEVC_MKV: H264, VP9, WV3, MPEG2VIDEOHEVC + AAC in a MKV container

  • VIDEO_TO_HEVC_MP4: H264, VP9, WV3, MPEG2VIDEOHEVC + AAC in a MP4 container

  • VIDEO_TO_AV1: H264, HEVC, VP9, WV3, MPEG2VIDEOAV1 + OPUS

  • MP3_TO_AAC: MP3AAC

  • AUDIO_TO_OPUS: MP3, AACOPUS

  • TIFF_TO_JPG: TIFFJPEG

  • PHOTO_TO_AVIF: JPEGAVIF

  • PHOTO_TO_JXL: JPEGJXL