Skip to main content

Multimedia library maintainer

Project description

converter

(documentation outdated)

Script to maintain a multimedia library. It will make sure that the codec and bitrate that each file has is the expected and it will do the transcodding if needed.

It can eficiently handle libraries with more than 100.000 multimedia files automatically. I was no able to find a free/paid software that allows me to do that, so I made my own :)

Requisites:

  • ffmpeg
  • redis server
  • python3
  • pip3 modules: bs4, redis, colorama, argparse

Configuration:

  • Change de following files as needed:

conf.py:

# redis server host
REDIS_HOST = '10.0.0.3'

# Multimedia library path
LIBRARY = '/XXXX/YYYYY/ZZZZZZ'

# Temporal folder to save finished transcodding and ongoing ones
TEMPORAL = '/XXXX/YYYYY/ZZZZZZ'

parse.py:

probe = 'ffprobe -v quiet -print_format json -show_streams'
aria = 'aria2c --disable-ipv6=true --follow-torrent=mem --seed-time=0 --enable-color=false --check-certificate=false --console-log-level=error --summary-interval=0'
ffmpeg = 'ffmpeg -hide_banner -y'
ffmpeg_vo = '-vsync 2 -r 30 -vf scale=1280x1280:force_original_aspect_ratio=decrease -b:v 500k -movflags +faststart'

# Commands used
cmds = {
    # To get coddecs details about a file
    'w-probe': '%s {0}' % probe,
    # To transcode a video file using nvidia hardware aceleration
    'w-hvideo': '%s -hwaccel nvdec -i {0} -c:a copy -c:v h264_nvenc %s -f mp4 {1}' % ( ffmpeg, ffmpeg_vo ),
    # To transcode a video file using the cpu
    'w-svideo': '%s -i {0} -c:a copy -c:v h264 %s -f mp4 {1}' % ( ffmpeg, ffmpeg_vo ),
    # To transcode the audio of a video file
    'w-vaudio': '%s -i {0} -c:a aac -b:a 100k -c:v copy -f mp4 {1}' % ( ffmpeg ),
    # To transcode an audio file
    'w-audio': '%s -i {0} -c:a mp3 -b:a 128k -f mp3 {1}' % ( ffmpeg ),
    # To download a file
    'w-download': '%s -d / -o {1} {0}' % aria,
    # To download a torrent
    'w-torrent': '%s -d {1} {0}' % aria
}

# This function makes sure that the file's coddecs are correct.
# If you have a different needs, you should change this one it too.
def job_codec(f, codecs):
    (...)

Usage:

# To print a detailed usage text:
./main -h

# To scan files in the library and create jobs to analize them if needed:
./main -s

# To analize and transcode the files if needed:
./main -k w-download,w-torrent,w-svideo,w-vaudio,w-audio

# To transcode the files using the GPU you may notice
# that there is a maximum supported number of transcodding jobs that they can run in parallel.
# You can match that amount use the parameter '-jN' as needed.
# By default, all the videos are transcodded using the GPU.
./main -j2 -k w-hvideo

# To force retry some jobs, you can clean the redis lists 'done', 'doing' and 'failed'
# using the command:
./main -p

Logs:

Executed commands output is appended to: $TEMP/converter.out

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mconv-1.0.1.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

mconv-1.0.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file mconv-1.0.1.tar.gz.

File metadata

  • Download URL: mconv-1.0.1.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.2 CPython/3.8.7

File hashes

Hashes for mconv-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b07c79dbb33eec7b90f7df391500c9084af022913c922f37f356fc5486b40d82
MD5 1b223c3aa2ebfe07e020d8ab6efbce28
BLAKE2b-256 a2a40feb9de89f9f6a9f645688a8a701ee60dc27064b144524afa84f6dbf965e

See more details on using hashes here.

File details

Details for the file mconv-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: mconv-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.2 CPython/3.8.7

File hashes

Hashes for mconv-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c5d61f417e26bc17acb5d0993dfecc4da714a4818002663f496b10f871f1df78
MD5 244d2495a0c3e9d7b77dc1aa649f023f
BLAKE2b-256 28a30c4907314cf3f5aa1589d9fa3ba407e68d8810accbbecaa9d30fc028c7cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page