Metadata-Version: 2.3
Name: videopk
Version: 1.2.8
Project-URL: homepage, https://github.com/sebastiengemme/videopk
Author-email: Sébastien Gemme <sgemme7@gmail.com>
Maintainer-email: Sébastien Gemme <sgemme7@gmail.com>
License: Copyright 2024 Sébastien Gemme
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of
        this software and associated documentation files (the “Software”), to deal in
        the Software without restriction, including without limitation the rights to
        use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
        the Software, and to permit persons to whom the Software is furnished to do so,
        subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
        OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
        NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
        HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
        WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
        FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
        OTHER DEALINGS IN THE SOFTWARE.
License-File: LICENSE
Keywords: transcoding,video
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Environment :: GPU :: NVIDIA CUDA
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Multimedia :: Video
Classifier: Topic :: Multimedia :: Video :: Conversion
Requires-Python: >=3.8
Requires-Dist: python-ffmpeg
Provides-Extra: dev
Requires-Dist: bumpversion; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Description-Content-Type: text/markdown

# Video Pocket Knife (videopk)

A collection of helper functions for processing videos. Currently, only transcoding is supported.

The initial use case was reducing the size of the videos acquired using a cell phone which normally have an overkill bitrate. This was driven by the need to save space on my Google Photos account.

Currently only one tool is available ```video-transcode```, please type ```video-transcode --help``` for details. The resulting transcoded file will contain all the metadata of the initial file including the rotation. The resulting file is in ```mp4``` file format where the video stream is encoded using [High Efficiency Video Coding (HEVC), also known as H.265](https://fr.wikipedia.org/wiki/H.265).

## Installation

```bash
pip install videopk
```

The code relies on [FFmpeg](https://www.ffmpeg.org/) to perform the conversion. Make sure ```ffmpeg``` is installed and in your path. This code has not been tested on windows, only under Linux.

* For gpu support, make sure to install [FFmpeg NVIDIA GPU Hardware Acceleation](https://docs.nvidia.com/video-technologies/video-codec-sdk/11.1/ffmpeg-with-nvidia-gpu/index.html). 
* Also make sure the ```ffmpeg``` installation has ```libx265``` support if you want to perform software encoding.

## How to use

To transcode a video file, use ```video-transcode```:
```
usage: video transcoding [-h] [-v] [-n] [--version] [-b BITRATE] input_file output_dir

positional arguments:
  input_file            Input file
  output_dir            Outout directory

options:
  -h, --help            show this help message and exit
  -v, --verbose         Verbose output
  -n, --no_gpu          Do not use gpu
  --version             show program's version number and exit
  -b BITRATE, --bitrate BITRATE
                        Bitrate, in bps, if not specified, nominal bitrate is calculated (preferred option)
```

To transcode a file using nominal bitrate. Note that the nominal bitrate is conservately high, suitable for scenes that are noisy such as scenes that contain trees, clouds and bushes. This bitrate has been determined using [this calculator](https://www.dr-lex.be/info-stuff/videocalc.html).

```bash
video-transcode input.mp4 output_dir
```

The resulting file will be located under ```output_dir/input.mp4```. 

