what is difference between mp4 and mpegts?
Asked Answered
C

3

27

Recently I had a task to convert the file format to mp4 and stream it. I have used ffmpeg as the transcoding tool. The MP4 file doesn't get streamed over the http protocol [have used php cgi wrapper], but then the output format is changed to mpegts the streaming occurs and works fine. A quick search on net http://wiki.videolan.org/MPEG relates and advises to use mpegts for streaming mp4 file. I need more insight on these two formats, their advantages and differences.

Thanks, Peter

Compile answered 1/8, 2012 at 15:24 Comment(0)
A
57

MPEG-TS is designed for live streaming of events over DVB, UDP multicast, but also over HTTP. It divides the stream in elementary streams, which are segmented in small chunks. System information is sent at regular intervals, so the receiver can start playing the stream any time.

MPEG-TS isn't good for streaming files, because it doesn't provide info about the duration of the movie or song, as well as the points you can seek to.

There are some new protocols that can use MPEG-TS for streaming over HTTP, that put additional metadata in files and fix the disadvantage I talked before. These are HTTP Live Streaming and DASH (Dynamic adaptive streaming over HTTP).

On the other hand MP4 has that info in part of the stream, called moov atom. The point is that the moov must be placed before the media content and downloaded from the server first.This way the video player knows the duration and can seek to any point without downloading the whole file (this is called HTTP pseudostreaming).

Sadly ffmpeg places the moov at the end of the file. You can fix that with software like Xmoov-PHP.

Here you can find more info about pseudostreaming.

Arundell answered 3/8, 2012 at 9:23 Comment(5)
Can this be done for IPTV purposes: create a continuous MP4 stream, and on each separate HTTP request, serve it with a moov in it's beginning, with the duration set to a very high number?Tanatanach
The moov atom at the end of the file is only a problem for primitive players. Modern software like mplayer can easily detect that the moov atom is at the end and fetch it using the decades-old Range: HTTP header.Thunell
Ivo, what you are asking for is similar to MPEG DASH. DASH uses fragmented MP4s which use 'traf' and 'sidx' boxes to wrap up short (2-10 second) chunks of video. It is possible to concatenate these in a single growing MP4 file as well: 'moov' 'sidx' 'traf' 'sidx' 'traf' ... Your player just has to support the relevant sections of the HTTP and ISO 14496 specs.Thunell
1-What is wrong with moov at the end of file?! ---- 2- What is MPEG-TS extension?Islamize
@Mr.Hyde - The moov atom is where all of the metadata is stored. It tells you how the duration, seek points for jumping around, etc that you need to play the audio. If it's at the back of the file that means you have to download the full file before you can play it. Moving it to the front lets you start playing before the full file is downloaded (ie streaming the audio). ffmpeg DOES allow you to store the moov atom at the front, but the default is placing it at the end. It's just some command line you have to use.Yoruba
U
15

You can reorder your MP4 file, putting the moov section at the start of it using the following FFMPEG command:

ffmpeg -i your.mp4 -vcodec copy -acodec copy -movflags +faststart reordered.mp4

Until answered 3/1, 2015 at 18:48 Comment(2)
This doesn't appear to answer the OP's question.Diego
Man, you just saved me tons of time wandering what and how to fix it. Very useful answer!Gouda
D
0

.mp4 is the extension of a file while mpeg ts is used for transport streams.....mpeg ts is a standard used for digital video broadcasting to send the mpeg video and mpeg audio. there are basically two types of ts spts and mpts spts contains the single program only whereas mpts contains the multiple programs in it. ts reader and vlc media players are used to play the mpeg ts if you want to know more about it the follow, MPEG TS OR TRANSPORT STREAM MPTS SPTS

The extension for transport stream files is .ts

Danged answered 24/2, 2017 at 16:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.