Skip to content

[BUG] --hardsubx --tickertext bypasses subtitle output and leaves debug side effects #2229

@Xavrir

Description

@Xavrir

CCExtractor version: 0.96.5

Necessary information

  • Is this a regression (i.e. did it work before)? Unknown
  • What platform did you use? Linux
  • What were the used arguments? --hardsubx --tickertext input.mp4

Summary

The --hardsubx --tickertext path appears to be incomplete.

--tickertext is documented as searching for burned-in ticker text at the bottom of the screen, but the current implementation does not send OCR results through the normal subtitle output path.

Instead, it:

  1. prints ticker OCR text with printf()
  2. writes debug JPEG files into the current working directory
  3. never frees the returned Rust string
  4. calls strlen() without a NULL check

As a result, the ticker-text path appears to bypass subtitle encoding entirely even though it is exposed as a user-facing option.

Code

src/lib_ccx/hardsubx.c

if (ctx->tickertext)
    hardsubx_process_frames_tickertext(ctx, enc_ctx);

src/lib_ccx/hardsubx_decoder.c

ticker_text = _process_frame_tickertext(ctx, ctx->rgb_frame,
                                        ctx->codec_ctx->width,
                                        ctx->codec_ctx->height,
                                        frame_number);
printf("frame_number: %d\n", frame_number);

if (strlen(ticker_text) > 0)
    printf("%s\n", ticker_text);

There is no add_cc_sub_text() / encode_sub() call in hardsubx_process_frames_tickertext(), so enc_ctx is never used.

src/rust/src/hardsubx/decoder.rs

let write_path: String = format!("./lum_im{}.jpg", index);
pixWrite(write_path_c, lum_im, IFF_JFIF_JPEG as i32);

let write_path: String = format!("./im{}.jpg", index);
pixWrite(write_path_c, lum_im, IFF_JFIF_JPEG as i32);

subtitle_text

The Rust helper writes JPEGs unconditionally and returns a string to C, but the C caller does not call free_rust_c_string(ticker_text).

Expected behavior

--hardsubx --tickertext should route OCR results through the normal subtitle output flow and should not leave debug-only side effects in normal runs.

Suggested Fix

  • send ticker OCR results through add_cc_sub_text() / encode_sub()
  • remove or guard the pixWrite() calls behind a debug option
  • add free_rust_c_string(ticker_text) in the ticker-text path
  • add a NULL check before strlen(ticker_text)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions