I need to create a .ts chunks from a .mp4 file without using ffmpeg API. I have already implemented this task using ffmpeg API, and it works, but my team lead wants me to get rid of it, and it is impossible to convince him against that. The code is supposed to run under load.
I have already found out how to read mp4 format, where to find frames, their offsets and sizes in a file, their pts's, for audio and video. A huge achievement for me as I haven't been working in this area for long.
All I managed is to create playlist where each chunk starts with I-frame. I feed the start and stop pts's of playlist entry to the old code(slightly modified) using ffmpeg API, and it creates proper ts chunks.
But but to create ts chunks without ffmpeg API I still cannot.
At first I tried to read the code of nginx rtmp module, the hls part of it, but couldn't understand anything there. It's too complex and I lack specific knowledge. Now I'd like to read something on ts format. Can anyone advise where to look?
Thanks.
It is unfortunate that you cannot use available, tested and efficient tools like ffmpeg. Why reinventing the wheel ?
Anyway, basically you want to:
SI/PSI tablesHave a look at the standards.The format of the TS objects are nicely summarized here. You need at least:
PMT to reference your video streamPAT to reference your PMTThis website is good starting point to get familiar with MPEG2 Transport Stream.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With