Skip to content

Add JSON output format for file report (-out=report=json)#2070

Closed
Apprentice2907 wants to merge 2 commits intoCCExtractor:masterfrom
Apprentice2907:report-json-output
Closed

Add JSON output format for file report (-out=report=json)#2070
Apprentice2907 wants to merge 2 commits intoCCExtractor:masterfrom
Apprentice2907:report-json-output

Conversation

@Apprentice2907
Copy link

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.

Summary

This pull request adds machine-readable JSON output for file reports using:
-out=report=json

Behavior

  • Existing -out=report text output remains unchanged.
  • JSON output is enabled only when explicitly requested.
  • No existing CLI flags or output formats are affected.

JSON Report Content

  • The JSON output mirrors the current text report and includes:
  • Input source and stream mode
  • Program count, program numbers, and PID details (TS)
  • DVB and Teletext subtitle information
  • EIA-608 and CEA-708 caption data
  • Video properties (resolution, aspect ratio, frame rate)
  • MPEG-4 timed text track presence and count

Implementation Notes

  • Introduced a report_format option (text / json).
  • Added print_file_report_json() alongside existing logic.
  • Early dispatch in print_file_report() based on selected format.
  • Rust CLI parser special-cases -out=report=json while preserving existing -out=report behavior.

@cfsmp3
Copy link
Contributor

cfsmp3 commented Jan 31, 2026

Closing this PR due to multiple issues:

1. Build Failures - Doesn't Compile

The Rust code references fields and types that don't exist in the codebase:

error[E0609]: no field `raw_out` on type `&args::Args`
error[E0609]: no field `report_format` on type `&mut lib_ccxr::common::Options`
error[E0433]: failed to resolve: use of undeclared type `ReportFormat`

The PR modifies parser.rs to use args.raw_out, self.report_format, and ReportFormat::Json, but none of these exist. You need to:

  • Add the raw_out field to the Args struct in args.rs
  • Add the report_format field to Options in lib_ccxr
  • Define the ReportFormat enum

2. Mixed Concerns

The PR combines unrelated changes:

  • Commit 1: "Document existing --timestamp-map option for WebVTT output" (README docs)
  • Commit 2: "Add JSON output support for -out=report"

These should be separate PRs.

3. Broken Markdown

The README changes have an unclosed code block:

```bash
ccextractor input.ts --timestamp-map -o output.vtt

Missing the closing ``` fence.

4. Duplicates Existing Work

PR #2020 from x15sr71 already implements JSON output for -out=report and was deep reviewed on Jan 18. That review found 3 bugs:

  • Program count wrong for multi-program streams
  • has_any_captions excludes DVB/Teletext
  • Video dimensions 0x0 for some files

Before submitting a new implementation, please review existing PRs for the same feature.


If you'd like to contribute JSON report output, please:

  1. Ensure the code compiles before submitting
  2. Review PR [FEATURE]: Add machine-readable JSON output for -out=report #2020 and its feedback
  3. Keep PRs focused on a single feature
  4. Test with various input files

@cfsmp3 cfsmp3 closed this Jan 31, 2026
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.

2 participants