tsduck icon indicating copy to clipboard operation
tsduck copied to clipboard

[FEAT] TSRESYNC header removing

Open lars18th opened this issue 3 years ago • 2 comments

Is your feature request related to a problem?

I want to process a TS binary file that has some "non-TS" header (in fact an HTTP response). And the tsresync tool doesn't have any option to overcome the header or strip them. So, at time it's impossible to fix the file with this tool.

Proposed solution:

My proposal is to add two new options for the tool:

  • --byte-offset N: This starts to read after the first N bytes.
  • --initial-sync-search M: In this case the tool searchs byte-by-byte until M bytes for the first 0x47 sync byte. This is equivalent to an automatic search mode for the previous "--byte-offset" limiting the search range up to M bytes.

Alternatives:

The only alternative is to use an external tool to do this. However, it will be interesting to have this tool to do the work automatically.

Additional information:

As a bonus it will be interesting if the tool could repeat the "initial-sync-search" after losing the sync. This could be done in a very the small range of 0 to 188*3 bytes. However, perhaps this can't be done because the alignement of the packets. So if the alignement is lost, it will not be possible the resync. Anyway almost the initial search for the 0x47 sync byte at any position will be desirable.

I hope you want to implement this (instead of the request at #767).

lars18th avatar Jan 22 '22 00:01 lars18th

For that specific case, use tsp -I file in.ts --byte-offset NNN -O file out.ts

lelegard avatar Jan 22 '22 13:01 lelegard

For that specific case, use tsp -I file in.ts --byte-offset NNN -O file out.ts

Yes. But this doesn't resolve the limitations in TSDuck. In particular:

  • No support for autosearching for the size of the header to remove.
  • No support for other sources different than a file.

At time this functionality is not a high-priority for me. However, I suggest to add it to the list of future enhancements. Thank you for listening!

lars18th avatar Jan 25 '22 13:01 lars18th