Skip to content

Commit

Permalink
Merge branch 'CCExtractor:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekmedia authored Aug 9, 2024
2 parents 4db3260 + 90204d4 commit 80d5b92
Show file tree
Hide file tree
Showing 56 changed files with 3,857 additions and 796 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
run: sudo apt update && sudo apt-get install libgpac-dev
- uses: actions/checkout@v4
- name: cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
src/rust/.cargo/registry
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
src/rust/.cargo/registry
Expand Down
69 changes: 45 additions & 24 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Build CCExtractor on Windows
env:
RUSTFLAGS: -Ctarget-feature=+crt-static
VCPKG_DEFAULT_TRIPLET: x64-windows-static
VCPKG_DEFAULT_BINARY_CACHE: C:\vcpkg\.cache
VCPKG_COMMIT: fba75d09065fcc76a25dcf386b1d00d33f5175af

on:
workflow_dispatch:
Expand All @@ -22,36 +24,45 @@ on:

jobs:
build_release:
runs-on: windows-2019
runs-on: windows-2022
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Setup MSBuild.exe
uses: microsoft/[email protected]
- name: Install llvm and clang
run: choco install llvm gpac
with:
msbuild-architecture: x64
- name: Install gpac
run: choco install gpac --version 2.4.0
- name: Setup vcpkg
run: mkdir C:\vcpkg\.cache
- name: Cache vcpkg
id: cache
uses: actions/cache@v3
with:
path: |
C:\vcpkg\.cache
key: vcpkg-${{ runner.os }}-${{ env.VCPKG_COMMIT }}
- name: Build vcpkg
run: |
git clone https://github.com/microsoft/vcpkg
./vcpkg/bootstrap-vcpkg.bat
- name: Install dependencies
run: ${{ github.workspace }}/vcpkg/vcpkg.exe install --x-install-root ${{ github.workspace }}/vcpkg/installed/
working-directory: windows
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install Win 10 SDK
uses: ilammy/msvc-dev-cmd@v1
- name: Setup Vcpkg
id: vcpkg
uses: friendlyanon/setup-vcpkg@v1
with:
committish: "2023.08.09"
cache-version: "3"
ignore-reserve-cache-error: true
- name: Install dependencies
run: cd vcpkg && vcpkg integrate install && vcpkg install leptonica tesseract ffmpeg --triplet x64-windows-static
- name: build Release-Full
env:
LIBCLANG_PATH: "C:\\Program Files\\LLVM\\lib"
LLVM_CONFIG_PATH: "C:\\Program Files\\LLVM\\bin\\llvm-config"
CARGO_TARGET_DIR: "..\\..\\windows"
BINDGEN_EXTRA_CLANG_ARGS: -fmsc-version=0
VCPKG_ROOT: ${{ github.workspace }}\vcpkg
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
run: msbuild ccextractor.sln /p:Configuration=Release-Full /p:Platform=x64
working-directory: ./windows
- name: Display version information
Expand All @@ -64,23 +75,32 @@ jobs:
./windows/x64/Release-Full/ccextractorwinfull.exe
./windows/x64/Release-Full/*.dll
build_debug:
runs-on: windows-2019
runs-on: windows-2022
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Setup MSBuild.exe
uses: microsoft/[email protected]
- name: Install llvm and clang
run: choco install llvm gpac
- name: Setup Vcpkg
id: vcpkg
uses: friendlyanon/setup-vcpkg@v1
with:
committish: "2023.08.09"
cache-version: "3"
ignore-reserve-cache-error: true
msbuild-architecture: x64
- name: Install gpac
run: choco install gpac --version 2.4.0
- name: Setup vcpkg
run: mkdir C:\vcpkg\.cache
- name: Cache vcpkg
id: cache
uses: actions/cache@v3
with:
path: |
C:\vcpkg\.cache
key: vcpkg-${{ runner.os }}-${{ env.VCPKG_COMMIT }}
- name: Build vcpkg
run: |
git clone https://github.com/microsoft/vcpkg
./vcpkg/bootstrap-vcpkg.bat
- name: Install dependencies
run: cd vcpkg && vcpkg integrate install && vcpkg install leptonica tesseract ffmpeg --triplet x64-windows-static
run: ${{ github.workspace }}/vcpkg/vcpkg.exe install --x-install-root ${{ github.workspace }}/vcpkg/installed/
working-directory: windows
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
Expand All @@ -93,10 +113,11 @@ jobs:
LLVM_CONFIG_PATH: "C:\\Program Files\\LLVM\\bin\\llvm-config"
CARGO_TARGET_DIR: "..\\..\\windows"
BINDGEN_EXTRA_CLANG_ARGS: -fmsc-version=0
VCPKG_ROOT: ${{ github.workspace }}\vcpkg
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
run: msbuild ccextractor.sln /p:Configuration=Debug-Full /p:Platform=x64
working-directory: ./windows
- name: Display version information
continue-on-error: true
run: ./ccextractorwinfull.exe --version
working-directory: ./windows/x64/Debug-Full
- uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
src/rust/.cargo/registry
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
shell: bash
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.3.1
uses: microsoft/setup-msbuild@v2.0.0
- name: Install llvm and clang
uses: egor-tensin/setup-clang@v1
with:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ src/rust/CMakeCache.txt
src/rust/Makefile
src/rust/cmake_install.cmake
src/rust/target/
src/rust/lib_ccxr/target/
windows/ccx_rust.lib
windows/*/debug/*
windows/*/CACHEDIR.TAG
windows/.rustc_info.json
windows/.rustc_info.json
61 changes: 61 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# CCExtractor Docker image

This dockerfile prepares a minimalist Docker image with CCExtractor. It compiles CCExtractor from sources following instructions from the [Compilation Guide](https://github.com/CCExtractor/ccextractor/blob/master/docs/COMPILATION.MD).

You can install the latest build of this image by running `docker pull CCExtractor/ccextractor`

## Build

You can build the Docker image directly from the Dockerfile provided in [docker](https://github.com/CCExtractor/ccextractor/tree/master/docker) directory of CCExtractor source

```bash
$ git clone https://github.com/CCExtractor/ccextractor.git && cd ccextractor
$ cd docker/
$ docker build -t ccextractor .
```

## Usage

The CCExtractor Docker image can be used in several ways, depending on your needs.

```bash
# General usage
$ docker run ccextractor:latest <features>
```

1. Process a local file & use `-o` flag

To process a local video file, mount a directory containing the input file inside the container:

```bash
# Use `-o` to specifying output file
$ docker run --rm -v $(pwd):$(pwd) -w $(pwd) ccextractor:latest input.mp4 -o output.srt

# Alternatively use `--stdout` feature
$ docker run --rm -v $(pwd):$(pwd) -w $(pwd) ccextractor:latest input.mp4 --stdout > output.srt
```

Run this command from where your input video file is present, and change `input.mp4` & `output.srt` with the actual name of files.

2. Enter an interactive environment

If you need to run CCExtractor with additional options or perform other tasks within the container, you can enter an interactive environment:
bash

```bash
$ docker run --rm -it --entrypoint='sh' ccextractor:latest
```

This will start a Bash shell inside the container, allowing you to run CCExtractor commands manually or perform other operations.

### Example

I run help command in image built from `dockerfile`

```bash
$ docker build -t ccextractor .
$ docker run --rm ccextractor:latest --help
```

This will show the `--help` message of CCExtractor tool
From there you can see all the features and flags which can be used.
48 changes: 48 additions & 0 deletions docker/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
FROM alpine:latest as base

FROM base as builder

RUN apk add --no-cache --update git curl gcc cmake glew glfw \
tesseract-ocr-dev leptonica-dev clang-dev llvm-dev make pkgconfig \
zlib-dev libpng-dev libjpeg-turbo-dev openssl-dev freetype-dev libxml2-dev

RUN cd && git clone https://github.com/gpac/gpac
WORKDIR root/gpac/
RUN ./configure && make && make install-lib && cd && rm -rf /root/gpac

WORKDIR /root
RUN git clone https://github.com/CCExtractor/ccextractor.git
RUN apk add bash cargo
RUN export LIB_CLANG_PATH=$(find / -name 'libclang*.so*' 2>/dev/null | grep -v 'No such file' | head -n 1 | xargs dirname)
RUN cd /root/ccextractor/linux && ./pre-build.sh && ./build

RUN cp /root/ccextractor/linux/ccextractor /ccextractor && rm -rf ~/ccextractor

FROM base as final

COPY --from=builder /lib/ld-musl-x86_64.so.1 /lib/
COPY --from=builder /usr/lib/libtesseract.so.5 /usr/lib/
COPY --from=builder /usr/lib/libleptonica.so.6 /usr/lib/
COPY --from=builder /usr/local/lib/libgpac.so.12 /usr/local/lib/
COPY --from=builder /usr/lib/libstdc++.so.6 /usr/lib/
COPY --from=builder /usr/lib/libgcc_s.so.1 /usr/lib/
COPY --from=builder /usr/lib/libgomp.so.1 /usr/lib/
COPY --from=builder /usr/lib/libpng16.so.16 /usr/lib/
COPY --from=builder /usr/lib/libjpeg.so.8 /usr/lib/
COPY --from=builder /usr/lib/libgif.so.7 /usr/lib/
COPY --from=builder /usr/lib/libtiff.so.6 /usr/lib/
COPY --from=builder /usr/lib/libwebp.so.7 /usr/lib/
COPY --from=builder /usr/lib/libwebpmux.so.3 /usr/lib/
COPY --from=builder /lib/libz.so.1 /lib/
COPY --from=builder /lib/libssl.so.3 /lib/
COPY --from=builder /lib/libcrypto.so.3 /lib/
COPY --from=builder /usr/lib/liblzma.so.5 /usr/lib/
COPY --from=builder /usr/lib/libzstd.so.1 /usr/lib/
COPY --from=builder /usr/lib/libsharpyuv.so.0 /usr/lib/

COPY --from=builder /ccextractor /

ENTRYPOINT [ "/ccextractor" ]

CMD [ "/ccextractor" ]

9 changes: 9 additions & 0 deletions docs/CHANGES.TXT
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
0.95 (to be released)
-----------------
- New: Create a Docker image to simplify the CCExtractor usage without any environmental hustle (#1611)
- New: Add time units module in lib_ccxr (#1623)
- New: Add bits and levenshtein module in lib_ccxr (#1627)
- New: Add constants module in lib_ccxr (#1624)
- New: Add log module in lib_ccxr (#1622)
- New: Create `lib_ccxr` and `libccxr_exports` (#1621)
- Fix: Unexpected behavior of get_write_interval (#1609)
- Update: Bump rsmpeg to latest version for ffmpeg bindings (#1600)
- New: Add SCC support for CEA-708 decoder (#1595)
- Fix: respect `-stdout` even if multiple CC tracks are present in a Matroska input file (#1453)
- Fix: crash in Rust decoder on ATSC1.0 TS Files (#1407)
- Removed the --with-gui flag for linux/configure and mac/configure (use the Flutter GUI instead)
Expand Down
11 changes: 7 additions & 4 deletions docs/COMPILATION.MD
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Clone the latest repository from Github
git clone https://github.com/CCExtractor/ccextractor.git
```

## Docker
You can now use docker image to build latest source of CCExtractor without any environmental hustle. Follow these [instructions](https://github.com/CCExtractor/ccextractor/tree/master/docker/README.md) for building docker image & usage of it.

## Linux

1. Make sure all the dependencies are met.
Expand All @@ -20,15 +23,15 @@ Debian:
sudo apt-get install -y libgpac-dev libglew-dev libglfw3-dev cmake gcc libcurl4-gnutls-dev tesseract-ocr libtesseract-dev libleptonica-dev clang libclang-dev
```

RHEL:
RHEL/Fedora:

```bash
yum install -y glew-devel glfw-devel cmake gcc libcurl-devel tesseract-devel leptonica-devel clang
yum install -y glew-devel glfw-devel cmake gcc libcurl-devel tesseract-devel leptonica-devel clang gpac-devel
```

Arch:
```bash
sudo paru -S glew glfw curl tesseract leptonica cmake gcc clang
sudo paru -S glew glfw curl tesseract leptonica cmake gcc clang gpac
```

Rust 1.54 or above is also required. [Install Rust](https://www.rust-lang.org/tools/install). Check specific compilation methods below, on how to compile without rust.
Expand Down Expand Up @@ -57,7 +60,7 @@ cd ccextractor/linux
./build -without-rust

# compile with debug info
./build -debug # same as ./build_debug
./build -debug # same as ./builddebug

# compile with hardsubx
[Optional] You need to set these environment variables correctly according to your machine,
Expand Down
Loading

0 comments on commit 80d5b92

Please sign in to comment.