[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-7958":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":16,"compositeScore":18,"rankGlobal":9,"rankLanguage":9,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":9,"pushedAt":9,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":15,"starSnapshotCount":15,"syncStatus":16,"lastSyncTime":27,"discoverSource":28},7958,"video_transcoding","lisamelton\u002Fvideo_transcoding","lisamelton","Tools to transcode, inspect and convert videos.",null,"Ruby",2510,164,91,8,0,2,5,60.15,"MIT License",false,"master",true,[],"2026-06-12 04:00:36","# Video Transcoding\n\nTools to transcode, inspect and convert videos.\n\n## About\n\n> [!NOTE]\n> *This decade-old project was redesigned and rewritten for the modern era of video transcoding, and then re-released in early 2025 with different behavior and incompatible APIs. Some old conveniences were removed but new features and flexibility were added. Please manage your expectations accordingly if you came here looking for the older tools.*\n\nHi, I'm [Lisa Melton](http:\u002F\u002Flisamelton.net\u002F). I created these tools to transcode my collection of Blu-ray Discs and DVDs into a smaller, more portable format while remaining high enough quality to be mistaken for the originals.\n\nMost of the tools in this package are essentially intelligent wrappers around Open Source software like [HandBrake](https:\u002F\u002Fhandbrake.fr\u002F) and [FFmpeg](http:\u002F\u002Fffmpeg.org\u002F). And they're all designed to be executed from the command line shell:\n\n* `transcode-video.rb`\nTranscode essential media tracks into a smaller, more portable format while remaining high enough quality to be mistaken for the original.\n\n* `detect-crop.rb`\nDetect the unused outside area of video tracks and print TOP:BOTTOM:LEFT:RIGHT crop values to standard output.\n\n* `convert-video.rb`\nConvert a media file from Matroska `.mkv` format to MP4 format or other media to Matroksa format without transcoding.\n\n## Installation\n\n> [!WARNING]\n> *Older versions of this project were packaged via [RubyGems](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FRubyGems) and installed via the `gem` command. If you had it installed that way, it's a good idea to uninstall that version via this command: `gem uninstall video_transcoding`*\n\nThese tools work on Windows, Linux and macOS. They're standalone Ruby scripts which must be installed and updated manually. You can retrieve them via the command line by cloning the entire repository like this:\n\n    git clone https:\u002F\u002Fgithub.com\u002Flisamelton\u002Fvideo_transcoding.git\n\nOr download it directly from the GitHub website here:\n\nhttps:\u002F\u002Fgithub.com\u002Flisamelton\u002Fvideo_transcoding\n\nOn Linux and macOS, make sure each script is executable by setting their permissions like this:\n\n    chmod +x transcode-video.rb\n    chmod +x detect-crop.rb\n    chmod +x convert-video.rb\n\nAnd then move or copy them to a directory listed in your `$env:PATH` environment variable on Windows or `$PATH` environment variable on Linux and macOS.\n\nBecause they're written in Ruby, each script requires that language's runtime and interpreter. See \"[Installing Ruby](https:\u002F\u002Fwww.ruby-lang.org\u002Fen\u002Fdocumentation\u002Finstallation\u002F)\" if you don't have it on your platform.\n\nAdditional software is required for all the scripts to function properly, specifically these command line programs:\n\n* `HandBrakeCLI`\n* `ffprobe`\n* `ffmpeg`\n\nSee \"[HandBrake Downloads (Command Line)](https:\u002F\u002Fhandbrake.fr\u002Fdownloads2.php)\" and \"[Download FFmpeg](https:\u002F\u002Fffmpeg.org\u002Fdownload.html) to find versions for your platform.\n\nOn macOS, all of these programs can be easily installed via [Homebrew](http:\u002F\u002Fbrew.sh\u002F), an optional package manager:\n\n    brew install handbrake\n    brew install ffmpeg\n\nThe `ffprobe` program is included within the `ffmpeg` package.\n\nOn Windows, it's best to follow one of the two methods described here, manually installing binaries or installing into the [Windows Subsystem for Linux](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FWindows_Subsystem_for_Linux):\n\nhttps:\u002F\u002Fgithub.com\u002FJMoVS\u002Finstalling_video_transcoding_on_windows\n\n## Usage\n\nFor each tool in this package, use `--help` to list the options available for that tool along with brief instructions on their usage. For example:\n\n    transcode-video.rb --help\n\nAnd since all of the tools take one or more media files as arguments, using them can be as simple as this on Windows:\n\n    transcode-video.rb C:\\Rips\\Movie.mkv\n\nOr this on Linux and macOS:\n\n    transcode-video.rb \u002FRips\u002FMovie.mkv\n\n## Default `transcode-video.rb` behavior\n\nThe `transcode-video.rb` tool creates a Matroska `.mkv` format file in the current working directory with video in 8-bit H.264 format and audio in multichannel AAC format.\n\n4K inputs are automatically scaled to 1080p and HDR is automatically converted to SDR color space.\n\nVideo is automatically cropped.\n\nThe first audio track in the input, if available, is automatically selected.\n\nAny forced subtitle is automatically burned into the video track or included as a separate text-only track depending on its original format.\n\nThe venerable `x264` software-based encoder is used with two-pass ratecontrol to produce a constant bitrate. Using two passes _is_ a bit slower than other methods but the output quality is worth the wait, as is the output size. This Is The Way™.\n\n**Video:**\n\nResolution | H.264 bitrate\n--- | ---\n1080p (Blu-ray) | 5000 Kbps\n720p | 2500 Kbps\n480p (DVD) | 1250 Kbps\n\n**Audio:**\n\nChannels | AAC bitrate\n--- | ---\nSurround | 384 Kbps\nStereo | 128 Kbps\nMono | 80 Kbps\n\nAll this behavior can easily be changed by selecting different video and audio modes via the `--mode` and `--audio-mode` options, using other options like `--add-audio` or by passing arguments directly to the `HandBrakeCLI` API via the `--extra` option. It's very, very flexible.\n\n## Other video modes\n\nWhile the default behavior of `transcode-video.rb` is focused on creating high-quality 1080p and smaller-resolution SDR videos, other modes are available.\n\n### `--mode hevc`\n\nDesigned for 4K HDR content, this mode uses the `x265_10bit` software-based encoder with a constant quality (instead of a constant bitrate) ratecontrol system. But it's reeeeeally slow. I mean, really slow. However, it does produce high-quality output. You just have to decide whether it's worth it.\n\nOne big selling point is that the `x265_10bit` encoder can produce output compatible with both the [HDR10](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FHDR10) and [HDR10+](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FHDR10%2B) standards as well as [Dolby Vision](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FDolby_Vision).\n\n### `--mode nvenc-hevc`\n\nAlso designed for 4K HDR content, this mode uses the `nvenc_h265_10bit` Nvidia hardware-based encoder, also with a constant quality ratecontrol system, because you can't always afford to wait on `x265_10bit`. The output will be slightly larger and somewhat lesser in quality but you'll get it a LOT faster. A lot.\n\nBut be aware that the `nvenc_h265_10bit` encoder can only produce HDR10-compatible output.\n\n### `--mode av1`\n\nThis Is The Future. Unfortunately, the [AV1 video format](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FAV1) is currently the Star Trek Future. Other than desktop PCs, most devices can't play it yet. This mode uses the `svt_av1_10bit` software-based encoder with a constant quality ratecontrol system. Although the encoder is already quite good, it's still a work in progress. But it's faster than `x265_10bit` and usually produces smaller output. So it's certainly worth a try. Especially on 4K HDR content.\n\nThe `svt_av1_10bit` encoder can produce output compatible with the HDR10 and HDR10+ standards and pass through Dolby Vision metadata.\n\nWhen using this mode, audio output is in Opus format at slightly lower bitrates. Why Opus? Because it's higher quality than AAC and if you can play AV1 format video then you can certainly play Opus format audio.\n\n### `--mode nvenc-av1`\n\nThis mode uses the `nvenc_av1_10bit` Nvidia hardware-based encoder, also with a constant quality ratecontrol system. The output is actually about the same size as that from the software-based `svt_av1_10bit` encoder in `av1` mode, but this is MUCH faster.\n\nBe aware that, like other Nvidia encoders, `nvenc_h265_10bit` can only produce HDR10-compatible output. And like the `av1` mode, audio output is in Opus format at slightly lower bitrates.\n\n> [!NOTE]\n> *An additional `--mode` argument leveraging the `vt_h265_10bit` video encoder, likely to be named `vt-hevc`, is under consideration pending ratecontrol tuning which will be delayed until I actually have an Apple Silicon Mac.*\n\n## Calling `HandBrakeCLI` from `transcode-video.rb`\n\nThe `transcode-video.rb` tool has less than 20 options. But the `HandBrakeCLI` API has over 100. It's YUUUUUGE! And you can pass arguments directly to that API via the `--extra` option.\n\nBut use the `-x` shortcut because who wants to do all that work typing `--extra`.\n\nEven though the `convert-video.rb` tool is included in this project, you can output to MP4 format from `transcode-video.rb` itself like this:\n\n    transcode-video.rb -x format=av_mp4 C:\\Rips\\Movie.mkv\n\nWhat if you want to tweak a crop instead of relying on `HandBrakeCLI`'s new and improved algorithm? It's as simple as:\n\n    transcode-video.rb -x crop=140:140:0:0 C:\\Rips\\Movie.mkv\n\nIf you want to get faster results and are willing to live dangerously when using `x264`, you can disable two-pass transcoding like this:\n\n    transcode-video.rb -x no-multi-pass C:\\Rips\\Movie.mkv\n\nWhat about filters? Easy peasy. You can apply any of `HandBrakeCLI`'s built-in filters this way:\n\n    transcode-video.rb -x detelecine C:\\Rips\\Movie.mkv\n\nWant to waste space? Then keep your original audio track in your output by changing the audio encoder:\n\n    transcode-video.rb -x aencoder=copy C:\\Rips\\Movie.mkv\n\nAnd if you just want an excerpt of your input, you can specify a chapter range for your output:\n\n    transcode-video.rb -x chapters=3-5 C:\\Rips\\Movie.mkv\n\n## Feedback\n\nPlease report bugs or ask questions by [creating a new issue](https:\u002F\u002Fgithub.com\u002Flisamelton\u002Fvideo_transcoding\u002Fissues) on GitHub. I always try to respond quickly but sometimes it may take as long as 24 hours.\n\n## Acknowledgements\n\nThis project would not be possible without my collaborators on the [Video Transcoding Slack](https:\u002F\u002Fvideotranscoding.slack.com\u002F) who spend countless hours reviewing, testing, documenting and supporting this software.\n\n## License\n\nVideo Transcoding is copyright [Lisa Melton](http:\u002F\u002Flisamelton.net\u002F) and available under an [MIT license](https:\u002F\u002Fgithub.com\u002Flisamelton\u002Fvideo_transcoding\u002Fblob\u002Fmaster\u002FLICENSE).\n","该项目提供了一套用于视频转码、检查和格式转换的工具。核心功能包括使用`transcode-video.rb`进行高质量视频转码，`detect-crop.rb`检测并输出视频裁剪值，以及`convert-video.rb`实现不同格式之间的无损转换，这些工具主要基于开源软件如HandBrake和FFmpeg构建。项目经过重新设计与编写，以适应现代视频处理需求，并移除了部分旧功能同时增加了新特性和灵活性。适用于需要将Blu-ray或DVD等高分辨率视频转换为更小体积但保持近似原始质量的场景下使用。支持Windows、Linux及macOS平台，要求用户手动安装Ruby环境及相关依赖程序。","2026-06-11 03:15:23","top_language"]