Skip to content

Convert media files when they are moved to a directory.

License

Notifications You must be signed in to change notification settings

alfredo-milani/VideoConverter

Repository files navigation

Table of contents

  1. Introduction
  2. Requirements
  3. Installation
    1. Optional
    2. Mandatory
  4. Usage
  5. Note

1. Introduction

Tool to convert media files when they are moved to a directory

2. Requirements

The following tools are required:

  1. ffmpeg
  2. python-video-converter

3. Installation

3.1 Optional

# Install virtualenv package for Python:
pip install virtualenv

# Create virtual environment named VideoConveter:
virtualenv VideoConveter
# or
virtualenv -p python3 VideoConveter

# Activate virtual environment:
source VideoConveter/bin/activate

# Deactivate virtual environment:
deactivate

3.2 Mandatory

# Install required pip-tools for requirements installation:
alias py='python -m pip'
py install pip-tools

# Move to root project directory:
cd /project_root/

# Read requirements to install:
pip-compile --output-file requirements.txt requirements.in

# Install required packages:
pip-sync

4. Usage

Launch tool:

# Start main:
python src/Application.py

# or you can specify a configuration file:
python src/Application.py /path/custom_config.ini

Configurations file example:

# Legend
#   [opt] := optional parameter
#   [dft] := default value
#   [mnd] := mandatory parameter


[GENERAL]
# [opt] - Log directory. If no directory will be specified no log file will be created
# [dft] -
log.dir = /var/log

# [opt] - Directory for temporary files
# [dft] - /tmp
# tmp = /Volumes/Ramdisk/tmp

# [opt] - Processes for conversion handling
processes = 5

[MEDIA]
# [mnd] - Input directory
in.folder = /Volumes/Ramdisk/test/in

# [opt] - Directory where will be moved files after conversion
# NOTE: leave empty this parameter to delete files after conversion
# NOTE: if this parameter will not be specified then not action will be taken
in.converted_folder =
# in.converted_folder = /Volumes/Ramdisk/test/converted

# [opt] - Frequency (seconds) for checking new files
# [dft] - 1
in.timeout = 0.5

# [mnd] - Directory for storing converted files
out.folder = /Volumes/Ramdisk/test

# [mnd] - Conversion format. Follow JSON format
out.format = {
                'format' : 'avi',
                'audio' : {
                    'codec' : 'mp3',
                    'samplerate' : 11025,
                    'channels' : 2
                },
                'video' : {
                    'codec' : 'h264',
                    'width' : 720,
                    # 'height' : 400,
                    # 'fps' : 15
                }
             }

# [opt] - Path of requested binary
# [dft] - Binaries for ffmpeg and ffprobe will be searched in PATH environment variable
ffmpeg = /usr/local/opt/ffmpeg/ffmpeg
ffprobe = /usr/local/opt/ffmpeg/ffprobe

5. Note

  • In MacOS ecosystem execute the following commands in a bash shell:
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

About

Convert media files when they are moved to a directory.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published