Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have h264 videos, and currently we're using Apple's HTTP Video Streaming tools and mediafilesegmenter to segment these files. What I need to do is to switch to alternative segmenter based on this very popular open-sourced segmenter

The problem is that this segmenter does not just take any video, but takes only MPEG-TS videos. So I have to convert my h264 videos to TS first.

I can do that with ffmpeg. I'm using this:

ffmpeg -i encoded.mp4 -vcodec h264 -i encoded.mp4 -sameq -acodec aac -strict experimental -f mpegts output.ts  

But this creates fairly larger output. And the reason is that Apple's segmenter keeps the same codec - AVC and the same audio codec - AAC, whereas ffmpeg changes video format to MPEG Video.

The question is: can I somehow keep the same AVC video codec and still convert video to a transport stream?

So my goal is to keep the same video quality and same video codecs as Apple's medifilesegmenter does.

UPD: Okay... it seems that ffmpeg CAN split videos into segments:

ffmpeg -i encoded.mp4 -c copy -map 0 -vbsf h264_mp4toannexb -f segment -segment_time 10 -segment_list test.m3u8 -segment_format mpegts segment%d.ts

That's still has one problem: it doesn't create http live streaming index file. (-segment_list creates a file with list of segments, but it doesn't look like HLS index). So, you still have to create index file

share|improve this question
up vote 5 down vote accepted


ffmpeg -i in.mp4 -acodec copy -vcodec copy out.ts

Ffmpeg also has a segmenter. See

share|improve this answer
yeah I know that now, but is it compliant with HLS? I'm asking because it doesn't create correct .m3u8 index files. So you still have to build those somehow. Later today I'm gonna try to manually create m3u8 and play these segmented videos – Agzam Jun 20 '12 at 14:11
@agzam: Here is the spec for HLS – user319862 Jun 23 '12 at 14:24
@agzam:… shows you what a simple m3u8 can look like – user319862 Jun 23 '12 at 14:26

Try setting -segment_list_type to m3u8. From the look of it the list is fine for static file conversion but not live streams, as segment duration is not added to the list until close_list is called.

The list type should be set from the list name file extension in current releases, but it isn't.

share|improve this answer

Try setting -segment_list_flags live

share|improve this answer
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. – Máté Juhász Nov 6 '15 at 9:49
Can you elaborate on this? Thanks. – fixer1234 Nov 6 '15 at 15:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .