Pregunta

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

¿Fue útil?

Solución

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.

Otros consejos

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

.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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top