How to Transmux MPEG-TS to HLS?

Any other question that don't fit into the other support categorizes.
Post Reply
parkerc
Posts: 2
Joined: Tue Jul 23, 2019 4:57 pm

How to Transmux MPEG-TS to HLS?

Post by parkerc »

Hi,

I’d like to convert/transmux my mpeg.ts streams (via HDHomerun) so they can work via iOS / Safari - I understand a HLS stream which Apple supports/promotes would be the best course of action.

Please could someone advise how best to do this and what the setting would be?

An example of the current mpeg.ts stream is this.

http://192.168.102.217:5004/auto/v1?

Aman
Posts: 3
Joined: Sun Aug 11, 2019 11:08 pm

Re: How to Transmux MPEG-TS to HLS?

Post by Aman »

Firstly,
192.168.102.217 is reserved for internal networks and cannot be routed externally,
so I cannot use your media, however, I can show a few ways to do it.

Code: Select all

ffmpeg -i file.ts -flags +cgop -g 60 -hls_list_size 0 one.m3u8

if you want to preserve your codecs

Code: Select all

ffmpeg -i file.ts -c copy -hls_list_size 0 two.m3u8
If you want to preserve your codecs and your original ts file, you can use the single file hls flag

Code: Select all

ffmpeg -i file.ts -c copy -hls_list_size 0 -hls_flags single_file three.m3u8
There are lots of other options and settings documented here https://ffmpeg.org/ffmpeg-formats.html#hls-2

parkerc
Posts: 2
Joined: Tue Jul 23, 2019 4:57 pm

Re: How to Transmux MPEG-TS to HLS?

Post by parkerc »

Many thanks

As I’m very new to this, please forgive the perhaps obvious question, is a mpeg.ts ‘stream’ also a ‘file’ ?

Maybe I’m missing something , but why would you want to preserve your codec and your original ‘file’ ?

wreuven
Posts: 1
Joined: Tue Feb 11, 2020 6:56 pm

Re: How to Transmux MPEG-TS to HLS?

Post by wreuven »

Old question but here is an answer.

1) A TS stream is a stream in that you can enter at any point, read bytes sequentially, and begin decoding a/v. For broadcast TV, this is a requirement which is why broadcast TV is in TS format. You could record the bytes being broadcast into a file for e.g. 5 minutes and you would then have a file that is in TS format. On the other hand, when you play from a non-stream file format stored on a disk, the player typically needs to seek into specific parts of the file in order to decode it.

2) You want to preserve your codec because re-encoding will result in lower quality A/V and take more processing time.

3) HLS-TS is typically made up of pieces of TS played one after the other and a manifest (a list of the pieces). You understand then that to convert from TS to HLS-TS is just a matter of splitting up the TS into smaller chunks and writing this manifest. Strictly speaking though, there is no limit to the size of a piece so you could just call your original TS one piece in a very short manifest. The advantage is that you don't need to have 2 copies of your video.

Post Reply