Skip to main content

A python tool based on ffmpeg that makes converting between different formats/codecs a whole lot easier for the inexperienced

Project description

MPEG-Convert

A highly customizable1 terminal-based Python wrapper for FFmpeg that provides a humanized approach to conversions between different multimedia formats.

FFmpeg is a powerful multimedia tool, but its many options2 can be especially overwhelming for new users. This wrapper aims to simplify the process of working with the FFmpeg engine to convert between different video/audio formats for the folks who doesn't want to memorize twenty options to use FFmpeg. This program is not, however, a complete replacement for FFmpeg in any way. For that purpose, you should look look into other software such as Handbrake or DaVinci Resolve.

This project is now hosted on PyPi, however legacy releases can still be found on the right.

Features

  • Simplified commands: MPEG-Convert provides a straightforward interface for commonly used FFmpeg functionalities, making it easy for both beginners and experienced users to perform tasks such as codec conversion, audio extraction, video compression, and much more.

  • Configurability: While MPEG-Convert is designed for simplicity, it also provides room for customization1. You can tweak advanced settings by specifying additional FFmpeg options in the script or during script execution, ensuring flexibility for more sophisticated multimedia processing needs.

demo

Installation

Make sure you have FFmpeg installed.

Automatic

  • Use pip to install and manage mpeg-convert and its dependencies
pip install --upgrade mpeg-convert
  • Launch the script
mpeg-convert --help

Customizing

You can further customize the script by changing the questions variable VIDEO_OPTIONS and AUDIO_OPTIONS in mpeg-convert to your liking. This can be achieved using the --customize option, which will open the correct file for you in your default text editor.

The two variables represents the list of questions asked during video options and audio options sections of the script respectively. The properties of each question is represented as a dictionary in python, and will be shown to the user in order. The dictionaries' format is shown below:

[
...
    {
        "type": <str>,
        "title": <str>,
        "option": <str>,
        "default": <int>,
        "choices": <list[tuple]>
    }
...
]

type: The type of the question

  • Valid values:
    • choice: Multiple choice
    • input: Input field

Note:

If a question type is set to choice, MPEG-Convert will automatically append custom value and remove option as the last two options.

title: The text shown to the console when displaying the question during the execution of the program

option: The corresponding option in FFmpeg. This option will be inserted to the list of arguments passed to FFmpeg

default: The default option that is used when the input field is empty. Has no effect if question type is input.

choices: A list of choices that will be shown to the console during the execution of the program. The choices will be in tuples where the first index will be what is displayed, and the second index is what is actually entered as a value for the particular FFmpeg option. Has no effect if question type is input.

An example of a custom question is below:

[
...
    {
        "type": "choice",
        "title": "Select an encoding preset",
        "option": "-preset",
        "default": 3,
        "choices": [
            ("Faster/lower quality", "veryfast"),
            ("Normal/medium quality", "medium"),
            ("Slower/best quality", "veryslow")
        ]
    }
...
]

This format applies to existing questions as well.

Troubleshooting

  • Do you have python installed?
  • Do you have ffmpeg installed?
  • Common pitfalls:
    • Does the output file have an extension?
    • Does the extension match the codec?
      • HEVC with .mp4
      • ALAC with .m4a
    • Is the encoder installed on your system?

Resources

Contributions are welcome! If you encounter any problems or find any bugs, please feel free to open an issue. In the meantime, happy converting!

--

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

mpeg-convert-0.0.3.tar.gz (17.8 kB view hashes)

Uploaded Source

Built Distribution

mpeg_convert-0.0.3-py3-none-any.whl (17.9 kB view hashes)

Uploaded Python 3

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