Open bbgdzxng1 opened 6 years ago
This is a great effort. Thank you for doing this.
I'm not entirely sure that the brew formula will work for all users at this stage, so I would welcome any feedback from the community, especially those with experience of the awesome homebrew.
Big public thanks to @szatmary for libcaption. I'm not sure there is any other FOSS software out there which handles encoding of CEA/EIA 608/708.
Below is a proposed libcaption.rb for release version 0.7, which appears to compile libcaption successfully, with necessary dependencies. Any feedback or improvements are welcome.
Save the following snippet to /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/libcaption.rb
class Libcaption < Formula
desc "Library for the creation and parsing of closed caption data"
homepage "https://github.com/szatmary/libcaption"
url "https://github.com/szatmary/libcaption/archive/0.7.tar.gz"
# version "0.7"
sha256 "125c9c55e1d5f0dc37ef151fa9583dd2fcfaefe7699d348c7292e634859e527e"
revision 0
# --HEAD version
head "https://github.com/szatmary/libcaption.git"
depends_on "cmake" => :build
depends_on "ffmpeg" => :build
depends_on "re2c" => :build
def install
system "cmake", ".", *std_cmake_args
system "make", "install"
end
test do
# Create an FLV video file
INPUT_VIDEO = testpath/"input_video.flv"
system "ffmpeg", "-report", "-hide_banner",
"-f", "lavfi", "-i", "smptebars=duration=2:size=640x360:rate=30",
"-c:v", "libx264", "-crf", "23", "-preset", "ultrafast",
"-f", "flv", INPUT_VIDEO
# system "ffprobe", "-i", INPUT_VIDEO
INPUT_CAPTION_FILE = testpath/"input_caption.srt"
INPUT_CAPTION_FILE.write <<~EOS
1
00:00:00,000 --> 00:00:02,000
Caption Text
EOS
OUTPUT_FILE = testpath/"output.flv"
system bin/"flv+srt", INPUT_VIDEO, INPUT_CAPTION_FILE, OUTPUT_FILE
assert_predicate OUTPUT_FILE, :exist?
end
end
$ brew install libcaption
$ brew info libcaption
libcaption: stable 0.7
Library for the creation and parsing of closed caption data
https://github.com/szatmary/libcaption
Not installed
# Run brew's formula audit tools, checking the integrity of the formula
$ brew audit --strict libcaption
$ brew install --dry-run libcaption
$ brew install libcaption
# Run the test process (create an flv using FFmpeg, create an srt, use Libcaption flv+srt, check output exists)
$ brew test libcaption
# Reinstall / Uninstall
$ brew reinstall libcaption
$ brew uninstall libcaption
# Install latest version from HEAD
$ brew install libcaption --HEAD
$ brew uninstall libcaption
# Return back to stable version 0.7
$ brew install libcaption
I have submitted a PR to Homebrew Core https://github.com/Homebrew/homebrew-core/pull/34453
Unfortunately, @BrewTestBot is waiting for libcaption to gain further traction.
GitHub repository not notable enough (<30 forks, <30 watchers and <75 stars)
Latest version is...
class Libcaption < Formula
desc "Library for the creation and parsing of closed caption data"
homepage "https://github.com/szatmary/libcaption"
url "https://github.com/szatmary/libcaption/archive/0.7.tar.gz"
sha256 "125c9c55e1d5f0dc37ef151fa9583dd2fcfaefe7699d348c7292e634859e527e"
depends_on "cmake" => :build
depends_on "ffmpeg" => [:build, :test]
depends_on "re2c" => :build
def install
system "cmake", ".", *std_cmake_args
system "make", "install"
end
test do
# Create an FLV video file
INPUT_VIDEO = testpath/"input_video.flv"
system "ffmpeg", "-report", "-hide_banner",
"-f", "lavfi", "-i", "smptebars=duration=2:size=640x360:rate=30",
"-c:v", "libx264", "-crf", "23", "-preset", "ultrafast",
"-f", "flv", INPUT_VIDEO
INPUT_CAPTION_FILE = testpath/"input_caption.srt"
INPUT_CAPTION_FILE.write <<~EOS
1
00:00:00,000 --> 00:00:02,000
Caption Text
EOS
OUTPUT_FILE = testpath/"output.flv"
system bin/"flv+srt", INPUT_VIDEO, INPUT_CAPTION_FILE, OUTPUT_FILE
assert_predicate OUTPUT_FILE, :exist?
end
end
GitHub repository not notable enough (<30 forks, <30 watchers and <75 stars)
Still waiting for libcaption to get further traction before it can be included in Homebrew Core. At end of 2019, there are:
@szatmary If I were to put together a final formula, would you consider adding a homebrew-libcaption
repo to host the Homebrew tap file? Users could then install libcaption with:
$ brew tap szatmary/libcaption
$ brew install libcaption
I would like to create a brew formula for libcaption to make install easier for users.
Does anyone have a working brew formula which we could contribute to the homebrew project?
Below uses brew to create a basic template.
EDITED: Removed old version of libcaption.rb.