Skip to main content

This tool allows bulk conversion of videos using ffmpeg

Project description

Convert Videos

Current version Downloads

Build status codecov

This tool allows bulk conversion of videos using ffmpeg, including with hardware acceleration.

By default it will append the codec name to the file, e.g. Best Movie Ever.avi -> Best Movie Ever - x265.mkv. This can be optionally overridden using the --in-place flag.

Videos are only converted if they do not already match the desired codec, allowing you to process a folder of mixed format files and only convert the ones you desire. This can optionally be overridden.

Usage

Usage: convert-videos [OPTIONS] DIRECTORIES...

Options:
  -i, --in-place                  Replace the original files instead of
                                  appending the new codec name
  -f, --force                     Force conversion even if the format of the
                                  file already matches the desired format
  --video-codec TEXT              A target video codec. Supported codecs:
                                  HEVC, AVC  [default: HEVC]
  -q, --quality INTEGER           The quantizer quality level to use.
                                  [default: 24]
  -p, --preset TEXT               FFmpeg preset to use.  [default: medium]
  -w, --width INTEGER             Specify a new width to enable resizing of
                                  the video
  --extra-input-args TEXT         Specify any extra arguments you would like
                                  to pass to FFMpeg input here
  --extra-output-args TEXT        Specify any extra arguments you would like
                                  to pass to FFMpeg output here
  --audio-codec TEXT              A target audio codec  [default: AAC]
  --audio-channels INTEGER        The number of channels to mux sound in to
                                  [default: 2]
  --audio-bitrate INTEGER         The bitrate to use for the audio codec
                                  [default: 160]
  --temp-dir TEXT                 Specify a temporary directory to use during
                                  conversions instead of the system default
  -v, --verbose                   Enable verbose log output
  --container TEXT                Specify a video container to convert the
                                  videos in to  [default: mkv]
  --dry-run                       Do not make actual changes
  --encoder [auto-detect|software|nvidia|intel]
                                  Optionally use a hardware encoder to speed
                                  things up.  [default: auto-detect]
  --audio-language TEXT           Only include audio streams in this language
  --subtitle-language TEXT        Only include subtitle streams in this
                                  language

  -h, --help                      Show this message and exit.

Autocomplete

To enable auto-completion:

zsh Add the below to ~/.zshrc eval "$(_CONVERT_VIDEOS_COMPLETE=zsh_source convert-videos)"

bash Add the below to ~/.bashrc eval "$(_CONVERT_VIDEOS_COMPLETE=bash_source convert-videos)"

fish Add the following to ~/.config/fish/completions/convert-videos.fish eval (env _CONVERT_VIDEOS_COMPLETE=fish_source convert-videos)

File output

Container

The default output container is mkv format. This can be changed with the --container flag to anything that is supported by FFMPEG and the chosen video and audio codecs

Video output

Default settings is HEVC/x265 at quality of 23

Codecs

Currently only HEVC (x265) and AVC (h264) are supported for video codecs.

Resizing

Videos can be resized automatically by providing a width. Height is automatically calculated to ensure that the aspect ratio is maintained.

Hardware Acceleration

Hardware acceleration is supported on nVidia and Intel devices.

Caveats for nVidia:

  • Conversions use constqp mode for the quality setting instead of CRF, as nvenc does not support CRF.
  • b-frames are not currently supported; nvenc itself supports them on 20xx+ series graphics cards.

Caveats for Intel:

  • Conversions use global_quality mode as CRF isn't supported on Intel hardware. ICQ and LA-ICQ are apparently better, but only supported on Windows.
  • Look-ahead is only supported on x264 (not HEVC).
  • There is a bug (current as of 2023-05) where all videos converted with Intel's QSV with FFMPEG have a single I-frame at the start and no more; so currently this is being worked around by enforcing a maximum time between I-frames which creates usable videos.
  • 10-bit HEVC videos often cause issues with the Intel decoder.

Audio output

Default settings is 160kbps 2 channel AAC.

All audio streams will be included by default unless a language filter is specified with --audio-language.

Subtitles

All subtitles will be copied from the source if they exist unless a language filter is specified with --subtitle-language.

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

convert_videos-2.10.0.tar.gz (30.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

convert_videos-2.10.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file convert_videos-2.10.0.tar.gz.

File metadata

  • Download URL: convert_videos-2.10.0.tar.gz
  • Upload date:
  • Size: 30.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for convert_videos-2.10.0.tar.gz
Algorithm Hash digest
SHA256 f1d80c3ce4be6107b273a780bf7c7b6b039f19e7fcfd252bc814716af1667792
MD5 18121c92ceee3eebcc2ee2388d1bfafa
BLAKE2b-256 f6bd6e4e9d4e27cb926c4211e2db059d6b9912ef67d5994ba8a254c3bfe3d7ea

See more details on using hashes here.

File details

Details for the file convert_videos-2.10.0-py3-none-any.whl.

File metadata

File hashes

Hashes for convert_videos-2.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 461fca76e933e519a117e1107d5d3327fcfeae95f6c1c821bf53bcc901f84584
MD5 2b655590dc6c4380e15b63aa83051e39
BLAKE2b-256 fc45c2d5ac0ac7d3994830f4897b4b76bf085bd3709cae660d42431cfcff117e

See more details on using hashes here.

Supported by

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