Skip to content

Conversation

@RemZapCypher
Copy link
Contributor

@RemZapCypher RemZapCypher commented Feb 28, 2025

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.
  • I have mentioned this change in the changelog.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

This PR adds a new command-line option --list-tracks that allows users to list all available tracks in an input file and exit without processing the file for subtitle extraction.

When working with complex media files that contain multiple tracks, it's often difficult to know which track contains the subtitles you want to extract. This feature provides a simple way to explore the file structure before running a full extraction, making it easier to:

  • Identify which streams contain subtitle data
  • Determine the appropriate track numbers for extraction
  • Save time by avoiding trial and error with multiple extraction attempts

Implementation

  • Added a list_tracks_only flag to the options structure
  • Implemented functionality to handle the flag in processing pipeline
  • Added proper command-line argument handling in Rust wrapper
  • Placed the option in the "Options that affect what will be processed" section

Example Usage

ccextractor video.mp4 --list-tracks

This will display information about available tracks in the file rather than extracting subtitles.

Testing

The feature has been tested with various media file formats including MP4, MKV, and TS files containing multiple subtitle tracks. It correctly lists available tracks and exits without performing extraction.
Distribution Used: Fedora Linux

TS Files:

image

MKV Files:

image

MP4 Files:

image

@RemZapCypher RemZapCypher marked this pull request as ready for review February 28, 2025 12:51
@steel-bucket
Copy link
Contributor

Hi, can you rebase and try to fix the failing Windows CI. The logs aren't available anymore.
Thanks a lot.

Copy link
Contributor

@cfsmp3 cfsmp3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for implementing the --list-tracks feature! The concept is useful and the format-specific implementations (MKV, MP4, TS) show good understanding of the codebase.

However, the PR currently fails to compile and needs several fixes:

Critical Issues:

  1. Wrong variable name: You're using api_options but that doesn't exist in CCExtractor. The global options structure is ccx_options. This causes compilation failures:

    ../src/ccextractor.c:168:21: error: 'api_options' undeclared (first use in this function)
    

    Please replace all occurrences of api_options with ccx_options in src/ccextractor.c.

  2. Dead code: In ccextractor.c lines 212-220, there's code after return EXIT_OK; (line 209) that will never execute. Please remove it.

  3. Unrelated change: The commented-out mprint in ccx_encoders_common.c:861 affects normal operation, not just --list-tracks. Please restore it:

    // mprint("Sending captions to stdout.\n");  // <- restore this line
  4. Rebase needed: This PR is ~10 months old and has merge conflicts with master.

Suggested approach:

  1. Rebase on current master
  2. Fix the api_optionsccx_options issue (multiple locations in ccextractor.c)
  3. Remove the dead code after the return statement
  4. Restore the mprint in ccx_encoders_common.c
  5. Push the fixes and verify CI passes

The feature itself is well-conceived - once these issues are fixed, it should be ready for a proper functional review.

cfsmp3 added a commit to cfsmp3/ccextractor that referenced this pull request Dec 20, 2025
Add a new --list-tracks (-L) option that lists all tracks found in
media files without processing them. This is useful for exploring
media files before caption extraction.

Supports:
- Matroska (MKV/WebM) files
- MP4/MOV files
- MPEG Transport Stream files

The feature is implemented entirely in Rust with native parsers for
each format, avoiding dependency on external libraries.

Closes CCExtractor#1669

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@cfsmp3 cfsmp3 closed this in #1854 Dec 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants