Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] Added --list-tracks option to display available tracks in media files #1669

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tank0nf
Copy link
Contributor

@tank0nf tank0nf 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

{
// Perform burned in subtitle extraction
hardsubx(&api_options, ctx);
return 0;
Copy link
Contributor Author

@tank0nf tank0nf Feb 28, 2025

Choose a reason for hiding this comment

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

While working on the main functionality had to mess around with ccextractor.c a bit to implement the feature, added some minor indentation fixes were included to maintain consistent code style only in this file. The functional changes are focused on adding the --list-tracks option.

@tank0nf tank0nf marked this pull request as ready for review February 28, 2025 12:51
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.

1 participant