Fixes#1503.
Using tesseract-ocr's stock pkg-config, it would produce an error due to
unquoted whitespace:
$ test ! -z `pkg-config --libs-only-l --silence-errors tesseract`
bash: test: syntax error: `-larchive' unexpected
* linux/configure.ac: Use a positive test, and double-quote the $() command
substitution.
Co-authored-by: Carlos Fernandez Sanz <carlos@ccextractor.org>
This header is generated by the pre-build.sh script. The compilation
fails if it is missing.
* linux/Makefile.am (ccextractor_SOURCES): Add
../src/lib_ccx/compile_info_real.h.
* fix: bump leptonica-sys to 0.4.3 and update Cargo.lock
* fix: bump rust version to 1.57.0 and build vcpkg for window hardsubx builds
* fix: add Bcrypt dependency
* fix: switch to rust stable
* chore: bump package versions
* fix: try to remove i686 to fix error
* fix: install tesseract and lint fixes
* fix: try using ffmpeg the third
* fix: include headers
* fix: add rsmpeg
* fix: switch default triplet to static md
* fix: import errors
* fix: directory path
* fix: pre build commands
* fix: update vcxproj
* fix: linux ci
* fix: ci fixes
* chore: lint fixes
* fix: error
* fix: copy include files
* fix: ci error
* fix: link swresample lib
* fix: some errors
* fix: include directory path and include all libraries
* fix: try to add library directories
* fix: fixes in libraries
* fix: formatting ci
* fix: mflat errors
* fix: libcurl
* fix: preprocessor definitions
* fix: add libcrypto
* fix: remove lib_hash to fix conflicts (we have libcrypto already)
* fix: add avcodec and avformat dependencies on windows
* fix: add remaining deps that may fix the build
* fix: add crypt depdency
* fix: rename conflicting names
* Revert "fix: remove lib_hash to fix conflicts (we have libcrypto already)"
This reverts commit f57ff716ed.
* fix: prefix with CC_
* fix: post build actions
* fix: ocr error
* Revert "fix: ocr error"
This reverts commit 92599454b6.
* fix: xcopy error
* fix: generated file name for x64
* fix: ocr error
* fix: add item group at top to see if it works
* fix: remove unwanted headers, removed \\ from VCPKG_ROOT, remove unwanted includes in vcxproj
* fix: add libpng for non hardsubx, comment the broken ocr code again
* fix: libpng path
* feat: add lib png headers in ClCompile
* fix: png.h not found
* fix: last try for ocr fix
* fix: libpng not found
* fix: cl compile headers
* fix: libpng and ocr
* fix: libpng error
* fix: redefinition error
* fix: zlib for non hardsubx
* fix: lib names
* fix: zlib.h not found
* Respect `-stdout` if multiple CC tracks are found
When passed the `-stdout` flag, CCExtractor should write the
subtitles to standard output, instead of an output file.
However, as noted in Issue #1453, CCExtractor doesn't
respect the `-stdout` flag when multiple CC tracks are present in
a Matroska input file (usually .mkv).
This commit ensures that output is written to standard output if `-
stdout` is present even if the input file is a Matroska container
with multiple CC tracks.
Signed-off-by: Abhishek Kumar <abhi.kr.2100@gmail.com>
* Mention fixing of issue #1453 in changelog
Signed-off-by: Abhishek Kumar <abhi.kr.2100@gmail.com>
* Correctly spell Matroska
Signed-off-by: Abhishek Kumar <abhi.kr.2100@gmail.com>
Signed-off-by: Abhishek Kumar <abhi.kr.2100@gmail.com>
* [FIX] WebVTT X-TIMESTAMP-MAP header placement (#1463)
* Fixed --no-timestamp-map flag
* Disable X-TIMESTAMP-MAP by default
* X-TIMESTAMP-MAP is only part of the HLS spec, and is not valid WebVTT, so it should be disabled by default.
* Write second WebVTT newline when timing info is missing
* add tesseract-sys in dependencies of rust modules
* add appropriate feature flags and required packages to cargo toml
* expose classifier
* Redefine structs that are required for hardsubx
Note: rust-bindgen isn't being used directly for this because it will also redefine structures of leptonica, tesseract, and ffmpeg and we don't want that.
We want to use definitions of structs as in the rust interfact libraries we are importing
* write code to generate bindings for mprint
* - write a function to convert rust strings to c strings
- write a memory safe wrapper to mprint that uses above function
* - add helper function to deal with tess strings in a memory safe manner
- port get_ocr_text_simple
- port get_ocr_text_wordwise
* improve conversion of C string to Rust string by using built-in functions
* replace mprint usage with warn!
* port get_ocr_text_letterwise
* remove redundant mprint function
* improve readability _tess_string_helper by using more general variable names inside
* make get_ocr_text_simple call get_ocr_text_simple_threshold to remove redundant codefix bugs
* remove manual definition of cc_subtitle and use bindgen bindings
* style changes to rust hardsubx classifier
* add get_ocr_text_letterwise_threshold and make get_ocr_text_letterwise call it appropriately
* move hardsubx context struct to mod.rs
* add get_ocr_text_wordwise_threshold and make get_ocr_text_wordwise call it
* use the ffmpeg-sys definition of Pix
* hide ported functions under macros
* use the AVPacket from bindings and not ffmpeg to make compatibility work for now.
TODO: rewrite init_hardsubx and also deal with the ffmpeg stuff when that is done
* improce _tess_string_helper by using appropriate built-in functions
* linter recommended changes
* clang style change
* fix loop bug that didn't allow for re-evaluation of it on usage of continue statement
* start porting of decoder with the _process_frame_color_basic function and related code
* hide the C version of _process_frame_color_basic behind an #ifdef
* add _process_frame_tickertext
* hide the C version of _process_frame_tickertext behind ifdef and add #[no_mangle] to the rust version
* check if word is empty as soon as word is detected
* port _process_frame_white_basic
* hide the C version _process_frame_white_basic behind compiler macros
* stylistic changes
* safety docs for hardsubx classifier
* safety docs for decoder as of now
* safe docs for utils.rs
* style changes
* format and style changes
* modify safety docs
* formatting fix
* set up bindings conversion of hardsubx utility functions (and structs) and set up the module
* add low level ffmpeg rust binding
* Methods ported:
- convert_pts_to_ns
- convert_pts_to_ms
- convert_pts_to_s
A pure rust method was added called _edit_distance_rec that implements levenstein distance calculation using recursion and dynamic programming
The port of edit_distance_rec is simply a wrapper that calls above function.
This redundancy won't be nevessary as more downstream modules are ported to Rust
* put C code of hardsubx_utility under define rust flag
* run formatter
* make compilation of hardsubx rust modules conditional on the HARDSUBX and the OCR flags. Make ffmpeg a conditional dependency based on those flags
* remove namespaced dependency in cargo because that is a nightly feature
* add conditioal compilatio of ffmpeg related bindigs in build.rs
* make clang argument of -DENABLE_HARDSUBX conditional on cargo feature of hardsubx_ocr
* enable specific relevant features for ffmpeg-sys-next
* enable hardsubx_ocr feature in windows build
* add build feature in ffmpeg-sys-next
* ffmpeg build feature is conditional on platform
* Revert "ffmpeg build feature is conditional on platform"
This reverts commit e456fee942.
This is because conditional features do not work in cargo toml
* install yasm in the linux build github action for ocr and hardsubx enabled cmake
* turn globals to locals to reduce code
* remove redundant attributes
* style changes
* make import of ffmpeg-sys-next conditional on hardsubx_ocr flag
* add --all-features flag in clippy for github workflow
* run formatter
* fix clippy command
* install yasm as part of rust format build check
* install libtesseract-dev etc. for clippy build test
* readability change
* declare the function edit_distance as unsafe
* remove commented code
* formatting changes
* combine declaration and assignment
* add build command for building hardsubx rust
context to issue: #1445
* make hardsubx rust work with autoconf build. For issue: #1445
* update autoconf for mac for issue #1445
* add hardsubx rust module and expose it
* port rgb_to_hsv to rust
* add dependency fast-math and extern it
* port rgb_to_lab to rust
also make preprocessor to not allow compilation of hardsubx_imgops
if WITHOUT_RUST is OFF
* improve if-else constructs for readability
* unroll macros that were only used once and remove their definition
* Improve readability of rgb_to_lab function (and fixes)
The function in Rust behaves slightly differently than its C counterpart
* remove fast math library, use palette library and rewrite imgops using it
* run formatter
* replace destructuring assignment statement with normal assignment statements because of build rust compiler issues
* run formatter on C code for imgops
* remove extern for modules because it is not required
* improve comment placement in rust imgops
Co-authored-by: Punit Lodha <48253287+PunitLodha@users.noreply.github.com>
* [NEW] add functionality to allow extraction of cc and burnt-in subs in the same pass
- add flag under hardsubx called -hcc that calls this method
- minor refactoring of moving some code from general_loop to a new function
- appropriate addition to the header files to expose certain methods
* add change log
* run clang formatter
Most of the users use Ubuntu 18.04 and later, so added the `libtesseract-dev` rather than `tesseract-ocr-dev` in the bash command so new people don't run into any errors as the NOTE was written after the command.