Skip to content
BigSmoke908Public

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

ts2mp4 (its vibecoded slop tbh)

A small terminal application that converts .ts video files to .mp4.

It opens a keyboard-driven file browser in your Downloads folder, you pick a .ts file with the arrow keys, press Enter, and watch a progress bar while ffmpeg does the work. The .mp4 is written next to the original file, with the same name.

 ts2mp4 — convert .ts video files to .mp4

 Folder: C:\Users\you\Downloads

 [..]  parent folder
 [DIR]  Videos
 [TS ]  recording_0052.ts  (537.5 MB)
 [TS ]  recording_0047.ts  (455.8 MB)
 ────────────────────────────────────────────────────────────────────────
 UP/DOWN move   ENTER open folder / convert file   BACKSPACE parent folder
 T filter: ON (only .ts files and folders)   Q quit

Requirements

  • uv (it installs the right Python for you)
  • Nothing else. ffmpeg ships with the dependencies, so you do not need to install it yourself. If you happen to have ffmpeg on your PATH, that one is used instead.

Runs on Windows and on Linux. uv.lock covers both, so the matching ffmpeg binary is installed on either platform.

Setup

uv sync

This creates the virtual environment and installs everything pinned in uv.lock. The Python version is taken from .python-version.

Run

uv run ts2mp4

Terminals

Works out of the box in Windows Terminal, PowerShell, cmd, and any Linux terminal.

Git Bash needs one extra hop. Its MinTTY window runs Windows programs behind a pipe instead of a console, and no terminal application — in any language — can draw to that. So when ts2mp4 notices it has no console, it relaunches itself through winpty (which ships with Git for Windows). uv run ts2mp4 therefore works in Git Bash as well; you can also invoke it yourself:

winpty uv run ts2mp4

Git Bash started from a Windows Terminal tab gets a real console anyway, so nothing special happens there.

Controls

All controls are always shown at the bottom of the screen.

Key Action
↑ / ↓ Move through the current folder
Enter Open the selected folder, or convert the selected .ts file
Backspace Go up to the parent folder
T Toggle between "only .ts files and folders" (default) and "all files"
Esc Cancel a running conversion, or return to the browser when one finished
Q Quit

Folders are listed first in alphabetical order, files below them sorted by modification date with the newest on top.

How the conversion works

recording.ts becomes recording.mp4 in the same folder. An existing file with that name is overwritten.

The result is always H.264 video with AAC audio. That matters on Windows: H.265/HEVC — what many .ts recordings contain — only plays there after buying a codec extension from the Microsoft Store, while H.264 plays for free everywhere.

The file is inspected first, then the cheapest route that still ends in H.264 is taken:

  • The source is already H.264 → the streams are copied into an MP4 container untouched (-c copy). No quality loss and it finishes in seconds. If the MP4 container rejects the AAC audio headers that MPEG-TS commonly uses, the same copy is retried with -bsf:a aac_adtstoasc.
  • Anything else (HEVC, MPEG-2, …) → the video is re-encoded to H.264. The GPU encoder (h264_nvenc) is tried first and the CPU encoder (libx264) takes over wherever no NVIDIA GPU is available, so this works on any machine — just faster on some. Re-encoding is the slow path: expect minutes for a large recording, which is what the progress bar is for.

If every route fails, the last lines of ffmpeg's output are shown so you can see what went wrong. The application stays usable either way: after a success, an error, or a cancellation you land back in the file browser and can convert the next file.

Project layout

pyproject.toml        dependencies and the `ts2mp4` entry point
.python-version       Python version used by uv
src/ts2mp4/app.py     Textual UI: file browser, progress view, key handling
src/ts2mp4/converter.py   ffmpeg discovery, conversion strategies, progress parsing

The UI is built with Textual, which brings its own progress bar, layout and key binding system, so no extra progress library is needed.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages