Skip to main content

Wrapper around ffmpeg and mpv that generates and compares x264 test encodes

Project description

txs (test x264 settings) is a command line tool that can generate different combinations of x264 settings and make short test encodings with ffmpeg. It also comes with a Lua script for mpv that allows you to visually compare the test encodes and find the best one based on quality, estimated file size and estimated encoding time. It looks like this:

Demo

This is the output of txs tutorial:

This is a tutorial that should get you started. Run txs -h and txs SUBCOMMAND -h for more information.

$ txs -s source.mkv -r 25:00 10 -x crf=19:me=umh samples \
  -xs subme=9/10:deblock=-2,-1/-3,-3:no-fast-pskip

The above command creates test encodes or samples with all possible combinations of the given values for "subme", "deblock" and "no-fast-pskip" in the directory "samples.orig@25:00-1.subme:deblock:no-fast-pskip". The samples are all encoded with "crf=19:me=umh", they are all 10 seconds long and start at 25 minutes in source.mkv:

source.sample@25:00-10.crf=19:me=umh:subme=10:deblock=-2,-1.mkv
source.sample@25:00-10.crf=19:me=umh:subme=10:deblock=-2,-1:no-fast-pskip.mkv
source.sample@25:00-10.crf=19:me=umh:subme=10:deblock=-3,-3.mkv
source.sample@25:00-10.crf=19:me=umh:subme=10:deblock=-3,-3:no-fast-pskip.mkv
source.sample@25:00-10.crf=19:me=umh:subme=9:deblock=-2,-1.mkv
source.sample@25:00-10.crf=19:me=umh:subme=9:deblock=-2,-1:no-fast-pskip.mkv
source.sample@25:00-10.crf=19:me=umh:subme=9:deblock=-3,-3.mkv
source.sample@25:00-10.crf=19:me=umh:subme=9:deblock=-3,-3:no-fast-pskip.mkv

By providing multiple sets of sample settings to -xs you can limit the number of combinations:

$ txs -s source.mkv -r 25:00 10 -x crf=19:me=umh samples \
  -xs subme=10/11:no-deblock deblock=-2,-1/-3,-3

This creates the following samples:

source.sample@25:00-10.crf=19:me=umh:deblock=-2,-1.mkv
source.sample@25:00-10.crf=19:me=umh:deblock=-3,-3.mkv
source.sample@25:00-10.crf=19:me=umh:subme=10.mkv
source.sample@25:00-10.crf=19:me=umh:subme=10:no-deblock.mkv
source.sample@25:00-10.crf=19:me=umh:subme=11.mkv
source.sample@25:00-10.crf=19:me=umh:subme=11:no-deblock.mkv

To compare encodes, use the "compare" subcommand:

$ txs -s source.mkv compare samples.orig@25:00-1.subme:deblock:no-fast-pskip

This opens mpv in fullscreen mode with a playlist of two samples. Switch between samples with "j" and "k" or toggle the original source with "o". Pick the better sample with "b", the worse with "w" or mark them as equal with "e". New samples are loaded automatically every time you make a decision. After you've rated all samples once, any samples that were marked as equal are loaded again. This process will leave you with the best sample and its settings in the end.

You can adjust the playlist size with the -p (--playlist-size) option if you want to compare more than two samples.

"Shift+w" does the same thing as "w", but it also removes the sample and its log file from the file system.

Show and hide the playlist overlay with "`".

Some final notes you might find useful:

  • Choose your sample range carefully. It should be representative of the full video. 10 seconds or less is fine to check something quickly, but use 60 seconds or more for fine tuning.

  • Increasing gamma with "6" to around 10 to 15 makes differences more obvious. (Decrease with "5".) Don't go too high or you'll watch pixels dance that nobody else will ever see.

  • Try switching between samples while playing. txs should preserve playback time, but there is a small delay when mpv seeks.

  • You can seek forward and backward by single frames with "." and ",".

Installation

Install pipx with your distro's package manager or with pip:

$ python3 -m pip install --user pipx

Then install txs with pipx:

$ pipx install txs

Upgrade:

$ pipx upgrade txs

Install development version over current release:

$ pipx upgrade --spec git+https://github.com/plotski/txs.git txs

Install development version without an existing txs installation:

$ pipx install --spec git+https://github.com/plotski/txs.git txs

Uninstall:

$ pipx uninstall pipx

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

txs-0.1.3.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

txs-0.1.3-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file txs-0.1.3.tar.gz.

File metadata

  • Download URL: txs-0.1.3.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.8.0 tqdm/4.43.0 CPython/3.8.3

File hashes

Hashes for txs-0.1.3.tar.gz
Algorithm Hash digest
SHA256 7450e1e0e56a15659866872290110250dcd85e10b448b3e5242da5ba383252aa
MD5 0ee0db16748ab6d74c3b45046a198b35
BLAKE2b-256 c95251b4c776a80150502220ac8bf2b091ff9e1f40ac2312a70a683f5d557076

See more details on using hashes here.

File details

Details for the file txs-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: txs-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.8.0 tqdm/4.43.0 CPython/3.8.3

File hashes

Hashes for txs-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 37edc184cbcaa26ed3310c395142196553ef0b0c73b0451c18042b1f90b6b964
MD5 c6a048e4ff5cbb772d5303519f88c887
BLAKE2b-256 172cf3e3a14e63bfce1bada5c891954e057b100135cdd9138586bf1701f84a64

See more details on using hashes here.

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