Skip to main content

An automatic video converter using HandBrake CLI.

Project description

Downloads

DEV.to Tutorial

Handbrake Automatic Video File Batch Converter

An automatic video converter using HandBrake CLI to batch convert all files found in recursive mode. In other words, all videos found on a given folder, and subsequent folders, will be converted on original location while original file will be transferred to another folder for easy removal.

HandBrake

This is a video converter and the HandBrake GUI can be found here, which also has a HandBrake CLI.

For more information, follow this link.

Table of Contents

Description

Given a specific folder, all video files found with user-given extensions will be converted to a target extension also provided by the user.

The converted video file will stay in the original folder while the original file will be transferred to another folder. This has the benefit of easy removal of the original files, as well as if a file does not encode successfully the original file still exists and can be converted again.

The program also accepts a user custom command which must have placeholders to be replaced by the original file path and converted file path.

In a first use of the program, all given arguments will be saved in a external file so the user does not have to always write the same repeated command.

In the end, an output file will be created containing:

  • all the files' information, files' original size and converted size;
  • if the file was successfully encoded;
  • the size difference between all files;
  • a list of files and their absolute paths which were not converted successfully;
  • a list of files and their absolute paths which were skipped during encoding.

Initially, this project has the aim of reducing files size to ocupy the least amount of space in the disk and comparing between original size and converted size, but since a user can input a custom command, this can also be used just to convert a lot of files in a folder for other purposes.

Features

Status Feature
convert a lot of files in their corresponding folders
convert files with multiple different extensions at the same time
transfer of original files in an external folder for easy removal
configurations will be saved in an external file
use of an automatic basic command aimed to reduce file size
a custom HandBrake command with placeholders can also be inserted
output file containing converted files information and their success
option to shutdown computer when program is done
when duplicate files exists these are skipped.

Skipped Files

  • Program will skip files if it encounters duplicate files (with the same name and target extension), not doing anything with them. This information will be added to the output file summary.

Any new features are very welcome!

Prerequisites

Python 3 must also be installed.

To use this project, the HandBrake command line version must be installed. This installation can be found in this link under 'Downloads->Other->Command Line Version'

Installation

pip --no-cache-dir install havc

or,

pip3 --no-cache-dir install havc

Usage

Command Required Description
-r absolute path folder to the HandBrake.exe (command line version)
-c absolute path folder containing the files to convert
-e multiple file extensions to find and convert
-t file extension the converted file will have
-d folder's name or an absolute path to the folder which will contain original files
-cc custom handbrake command with placeholders
--safety-question
/
--no-safety-question
enable or disable the safety question
--shutdown
/
--no-shutdown
enable or disable shutting down computer when program is done

Notes

  • First command must have all required arguments except if these arguments already are configured in external file.
  • Non-required arguments will also be saved in the external file if specified.
  • The folder containing original filed has the default name of 'TO-DELETE' and the default path, if none is given, is the same directory as the path folder containing the files to convert.
  • The dot '.' before each extension is completely optional.
  • Because the program modifies the original files by moving them to another folder, one must be certain the correct folder is being modified so there is a question to make sure the user wants to continue. However, this feature can be disabled to let the program run freely, but be warned. The default of this value is 'true'.
  • Shutting down the computer is disabled, by default.

Any additional help can be provided if the following command is run:

havc --help

or,

havc -h

Example of the initial command:

havc -r "C:\path\to\Desktop" -c "C:\path\to\Desktop\folder to convert" -e mp4 mkv -t m4v

After this, the external file will be configured and then the following command becomes valid (always using the previous configurations):

havc

If any argument has to be modified just run the command with the necessary argument, for instance, if the extensions have to be modified, we simply run:

havc -e mov .avi mp4

Support

The following links contain documentation about how to make a HandBrake command:

License

MIT

Status

This project started as a simple one file script, but then I saw the opportunity to make a program more complex that could also not only help the community, but also help my development. With that said, this project was also developed for educational purposes, so any bugs, suggestions, new features, improvements, etc, don't hesitate to ask, open an issue or a pull request.

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

havc-1.2.1.tar.gz (15.9 kB view details)

Uploaded Source

Built Distributions

havc-1.2.1-py3.11.egg (43.4 kB view details)

Uploaded Source

havc-1.2.1-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file havc-1.2.1.tar.gz.

File metadata

  • Download URL: havc-1.2.1.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for havc-1.2.1.tar.gz
Algorithm Hash digest
SHA256 0edf85425f5e7221ae097a6dc07e831441d87b5a1f7eedbe1adc01445b27dace
MD5 9e4ed63959655e0b7d7958f07e8d6367
BLAKE2b-256 52d557fa9214b777f5c2bbc441949fea23470c7a37d5a25e71bac058cf50c024

See more details on using hashes here.

Provenance

File details

Details for the file havc-1.2.1-py3.11.egg.

File metadata

  • Download URL: havc-1.2.1-py3.11.egg
  • Upload date:
  • Size: 43.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for havc-1.2.1-py3.11.egg
Algorithm Hash digest
SHA256 d5e3ba546178fc63c6920c9774ff9380fcb4765dbad47aa8fc5582a12ec7d93a
MD5 0deadfc22b47d18c87550fcee00cad33
BLAKE2b-256 ceb76c4bad337a1b7b56886317377e16079a1fd1a5a6f84c48795ddcb64f2ed3

See more details on using hashes here.

Provenance

File details

Details for the file havc-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: havc-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for havc-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c6ff7f40914451cf96e4a280ae30b12e1fe21672dffa10cd292dc18fb6578742
MD5 1655b65a94908ae0837c5b937c8874cb
BLAKE2b-256 47e3a475e4f8e3e07064bae8c6a140008ee195bc86efedb738d4fd63925f433f

See more details on using hashes here.

Provenance

Supported by

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