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

Add a muxer #10

Closed
sjpotter opened this issue Apr 13, 2020 · 13 comments
Closed

Add a muxer #10

sjpotter opened this issue Apr 13, 2020 · 13 comments

Comments

@sjpotter
Copy link

i.e. I might want to read in a stream, modify it and output the stream.

In fact, I did just that in a project I'm working on where I take the m2ts stream from libbluray, and add in language descriptors (from the buray clipinfo) and then serialize it out.

@asticode asticode self-assigned this Apr 13, 2020
@asticode asticode changed the title should enable serializing out to a ts stream that was one has serialized in Add a muxer Apr 13, 2020
@asticode
Copy link
Owner

you're definitely right, it would mean adding a muxer.

if you feel like contributing, I'm welcoming PRs

@ivanjaros
Copy link

you could use https://github.com/nareix/joy4/tree/master/format/ts, since it is not maintained, it would be nice to have some up-to-date library..even if it is only for ts.

@BRUHItsABunny
Copy link

I'm currently doing some preliminary research to make a TS muxer to mux small TS files into 1 big TS file. Anyone else working on this or might I be the one to issue a PR?

@asticode
Copy link
Owner

I don't think anybody is working on this, go for it! ❤️

Try to reuse as much code as possible in this lib, create the least amount of new .go files and export the simplest and smallest API would be my points of emphasis.

@mattetti
Copy link

I'm playing with sample-aes encrypted hls streams that I'd like to demux, decode and remux. If this package were to offer a muxer, it would really make it close to complete. I understand nobody's really working on it at this moment and I'm afraid my TS knowledge is too limited but contribute but if maybe if a few of us work together we can get something working decently rapidely.

@BRUHItsABunny
Copy link

Sorry I completely forgot about this. I'm probably not going to be working this until I get settled into my new job.

@barbashov barbashov mentioned this issue Mar 2, 2021
@barbashov
Copy link
Contributor

I'm playing with sample-aes encrypted hls streams that I'd like to demux, decode and remux. If this package were to offer a muxer, it would really make it close to complete.

Well you can do this now. You got to handle decoding yourself though. But it's not hard since go std lib offers good crypto API. Just be aware of PKCS7 padding, that one costed me a bunch of grey hairs :)

@mattetti
Copy link

mattetti commented Mar 6, 2021

@barbashov care to share more? I'm not too worried about the crypto (if I understand what data needs to be decoded) but I'm not sure how to rebuild the stream without a muxer.

@barbashov
Copy link
Contributor

@barbashov care to share more? I'm not too worried about the crypto (if I understand what data needs to be decoded) but I'm not sure how to rebuild the stream without a muxer.

I've written a muxer :) It's under review currently, but already useful #16

@barbashov
Copy link
Contributor

@asticode you may want to close that one as well

@asticode
Copy link
Owner

Thanks to @barbashov 's great work, this lib now has a muxer ❤️

Closing this issue

@mattetti
Copy link

I'm playing with sample-aes encrypted hls streams that I'd like to demux, decode and remux. If this package were to offer a muxer, it would really make it close to complete.

Well you can do this now. You got to handle decoding yourself though. But it's not hard since go std lib offers good crypto API. Just be aware of PKCS7 padding, that one costed me a bunch of grey hairs :)

Thanks @barbashov , I wrote the aes-128 crypto (CBC/PKCS7) code needed to decode the entire files but sample-aes is a bit more tricky since it requires also understanding the transport protocol (only only part of the data is encrypted).

My understanding is that I need to do something similar to your what you have here:
https://github.com/asticode/go-astits/blob/master/cmd/astits-es-split/main.go#L107

That would give me access to the partially encrypted data, then decrypt the data and remux the file by adding the decrypted PES to the new stream. Does that seem right or do I need to copy/add more data to my decrypted stream?

@barbashov
Copy link
Contributor

I'm playing with sample-aes encrypted hls streams that I'd like to demux, decode and remux. If this package were to offer a muxer, it would really make it close to complete.

Well you can do this now. You got to handle decoding yourself though. But it's not hard since go std lib offers good crypto API. Just be aware of PKCS7 padding, that one costed me a bunch of grey hairs :)

Thanks @barbashov , I wrote the aes-128 crypto (CBC/PKCS7) code needed to decode the entire files but sample-aes is a bit more tricky since it requires also understanding the transport protocol (only only part of the data is encrypted).

My understanding is that I need to do something similar to your what you have here:
https://github.com/asticode/go-astits/blob/master/cmd/astits-es-split/main.go#L107

That would give me access to the partially encrypted data, then decrypt the data and remux the file by adding the decrypted PES to the new stream. Does that seem right or do I need to copy/add more data to my decrypted stream?

I don't really know how to help you since I haven't implemented SAMPLE-AES at this point in my software.
Though as far as i know, SAMPLE-AES doesn't encrypt the whole packet, it encrypts just the payload. If that's right, what you need to do is to decrypt only the payload. Anyway, I would follow HLS RFC here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants