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

remuxer example #29

Open
lu-zero opened this issue Dec 16, 2022 · 7 comments
Open

remuxer example #29

lu-zero opened this issue Dec 16, 2022 · 7 comments

Comments

@lu-zero
Copy link
Contributor

lu-zero commented Dec 16, 2022

Is it possible to have an example that takes every element of the ts muxer and then writes it down to a file element by element?
I'm trying to figure out how to get the data alongside with its parsing and I fail to figure out how to do it by reading the examples.

@dholroyd
Copy link
Owner

Yes, the examples are bit lacking.

What level of detail would you like to see specifically?

@dholroyd
Copy link
Owner

dholroyd commented Dec 18, 2022

Since you mention remux, there am old example of remuxing mpegts to mp4 over at dholroyd/lowly/src/mpegts/h264.rs. The code is not very good - only supports a fixed audio/video setup, but does this demonstrate some of the library functionality that you would like to see added to an example?

@lu-zero
Copy link
Contributor Author

lu-zero commented Dec 18, 2022

Maybe a great example would be taking in a ts and convert it to a cbr one or the leanest vbr one by adding/removing the stuffing?

@dholroyd
Copy link
Owner

I see - you should know that this codebase doesn't currently have any support for multipliexing / writing mpegts - there's more than just examples missing there! I've been tempted to add multiplexing in the past, but it's both harder than demux and something I've not needed as often as demux.

It would be easy enough to write an example that drops packets with pid=0x1fff, but it sounds like you are looking for more than this?

@lu-zero
Copy link
Contributor Author

lu-zero commented Dec 18, 2022

As example that's exactly what you want :)

In a case you read everything, if you find stuffing do not write the packet, otherwise write down what you just read, in the other you read everything and write it down and every time you see a PCR you check if you wrote enough data, otherwise you add more stuffing.

A muxer that pairs well with this crate would be great in general, but not required for the examples I had in mind.

@dholroyd
Copy link
Owner

There's a first pass example of stripping stuffing packets in #30.

Because this uses the existing demuxer infra rather than simply iterating packets, in addition to dropping stuffing it also has the effect of,

  • dropping packets with transport_error_indicator set - the demultiplexer simply discards these
  • dropping packets with transport_scrambling_control - there's no descrambling support in the code (I've not looked into how scrambling works), so it conservatively drops these packets rater than passing the application bad data. This doesn't really make sense for a tool that's just stripping stuffing, so at some point it would be good to fix this.

@lu-zero
Copy link
Contributor Author

lu-zero commented Jan 9, 2023

Thank you, I was away and I just read the code :)

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

No branches or pull requests

2 participants