ccextractor icon indicating copy to clipboard operation
ccextractor copied to clipboard

[BUG] Infinite binary output when processing .ts files with no subtitles

Open AbHash-RixE opened this issue 5 months ago • 1 comments


CCExtractor version: Version: 0.94


Necessary information

  • Is this a regression (i.e. did it work before)? YES
  • What platform did you use? Linux
  • What were the used arguments? ./ccextractor output_clean.ts

💬 Additional information

When CCExtractor is run on a .ts file that contains no subtitles, it produces infinite binary-like output in the terminal instead of stopping gracefully.

Observed behavior

The terminal continuously floods with binary/hex-like data, for example:

00000000 | 44 54 47 31 41 FE 00 00 00 00 01 01 33 7C 75 EF  | DTG1Aþ      3|uï
00000016 | DD 52 6D A1 2A 49 62 F7 BC 07 B6 B4 26 A9 25 49  | ÝRm¡*Ib÷¼ ¶´&©%I
00000032 | 2C 5B 19 11 BA 6D B5 4F F1 6D 1E F7 80 F7 6B 17  | ,[  º I  ÛC[ òú
00000064 | 01 2E D6 7E FB E6 C0 12 ED 64 66 C0 FA C9 24 1C  |  .Ö~ûæÀ ídfÀúÉ$ 
00000080 | D4 6D A3 EB 66 EF 9E 40 05 3B 58 8B EF 90 01 4E  | Ôm£ëfïïï  cVîÑ
00000000 | 44 54 47 31 41 FE 00 00 00 01 01 4A EF 5D 4B A0  | DTG1ÎønuÍÎKýÿ]K 
00000048 | 5C EB FE 85 17 D3 D7 3A 79 A5 D0 10 92 59 81 15  | \ëþ·
 Ó×:y¥Ð Y 
00000064 | 26 19 87 52 0E 97 A1 00 00 01 02 4A AE A6 0C 48  | & ()   nMI BAS 
00000096 | 36 92 07 DB 30 20 E9 AA 4C 08 28 2C AA 62 D2 43  | 6 Û0 éªL (,ªbÒC
00000112 | 61 42 63 77 CE A9 81 05 26 06 36 06 15 20 22 A9  | aBcwΩ & 6   "©
00000000 | 44 54 47 31 41 FE 00 00 00 01 01 52 AE A4 0D 4C  | DTG1Aþ     R®¤ L
00000016 | 10 10 69 30 7D 24 0A 8A A6 0D 48 1A B0 00 00 00  |   i0}$ ¦ H °   
00000032 | 00 01 02 52 AE A6 0C 48 A2 3E 4D 23 50 50 2B 2E  |   £ a]JH¢>M#PP+.
00000064 | 83 41 71 01 89 1A EB 94 79 D5 30 34 A4 80 86 80  | Aq 	 ëyÕ04¤
00000080 | 84 21 CF 39 B9 A6 9A AC 2A A0 85 0F CF 13 39 94  |

Expected behavior

If the input file contains no subtitles, CCExtractor should:

  • Exit normally with a message such as “No subtitles found.”
  • Not produce binary data or infinite console output.
  • Extract subtitle if present.

Working version

Version: 0.94
Git commit: 911b2b8ded2e1d147fe32b800ae96885829c1525
Compilation date: 2025-10-05
CEA-708 decoder: Rust
File SHA256: aa40ad722cc67b9d27fc75f34795bc4f15c1f28c4b922017e68826e4e45d126e

Broken version

Version: 0.94
Git commit: ebd8252b8855e245c14fcf4169bec47922d66300
Compilation date: 2025-10-08
CEA-708 decoder: (empty)
File SHA256: 416a00c0b15ecef9fcaf3e9f1e5ef490aba39d367f0b98ab6b2247545884dd64

AbHash-RixE avatar Oct 08 '25 13:10 AbHash-RixE

@AbHash-RixE I will work on identifying and fixing this bug!

Root Cause: Based on the issue description, the infinite loop likely occurs in the TS processing functions. I will investigate the ts_readstream function in src/lib_ccx/ts_functions.c to find where the do-while loop runs indefinitely when processing TS files with no subtitles.

Plan for Fix:

I will add a packet counter with a reasonable limit (e.g., 50,000 packets) I will implement termination conditions when no subtitles are found after processing the limit I will add proper tracking to detect when no caption data is present I will ensure clean exit with appropriate messages instead of infinite binary output

Expected Changes:

I will modify the relevant TS processing functions to add proper termination logic The goal is to ensure that:

TS files with no subtitles will exit cleanly after processing a reasonable number of packets TS files with subtitles continue to work normally No binary data floods the terminal I will submit a PR once I have implemented and tested the fix. Could you let me know if you have any specific test files or additional information that would be helpful?

DhanushVarma-2 avatar Nov 10 '25 03:11 DhanushVarma-2