PDA

View Full Version : H.264 to MP4


Appu
17th July 2008, 14:58
I have been trying to convert H.264 ES to MP4 format. I was not successful yet. Can please some help me. Here is what I wanted to do and what have tried.

I want to extract an H.264 ES from an transport stream and convert it to an mp4 file with out re-encoding.

I have tried both mp4Box (including Yamb) and ffmpeg.

This what I have tried with mp4Box.


MP4Box.exe -add myStream.ts#pid=73 myStream.mp4

Got an application error saying that memory could not be read.
Version used 0.4.4

I extracted the elementary stream out of ts using BBDMUX and used it with ffmpeg as below. (I don't know whether ffmpeg can read transport stream)

ffmpeg.exe -i myStream.h264 -vcodec copy myStream.mp4

It created the .mp4 stream but is not playable with PC based players (VLC, Elecard etc ). No video is seen.

Please help...

Ranguvar
17th July 2008, 16:04
You can demux the elementary stream with either tsMuxeR or TsRemux, and then mux into an MP4 with MP4Box. When muxing to MP4, you will have to specify the framerate of the video, since it isn't noted in the elementary stream.

bond
17th July 2008, 21:51
ts is not es, its ts :p

Appu
18th July 2008, 07:07
you can demux the elementary stream with either tsMuxeR or TsRemux, and then mux into an MP4 with MP4Box. When muxing to MP4, you will have to specify the framerate of the video, since it isn't noted in the elementary stream..

I have tried this with ffpmpeg. I can try this mp4Box also. But 'mp4Box -h import' says that it can support ts stream also as input. That is not correct?

ts is not es, its ts.
I didn't understand your point. Can you please explain?.

Appu
18th July 2008, 07:26
Update:

I could create the mp4 stream from h.264 es with mp4Box which is playable with PC based players.

But observed that if the initial parts of the es file is not proper mp4Box says "Cannot find startCode". But this file is playable with PC based players like elecard. Any solutions for this?. Because I have many streams where the initial part of the streams is corrupted.

Appu
18th July 2008, 11:23
Update:

Looking at the mp4Box source code, I find that the mp4Box expects the stream to start with a start code. When I edited the es stream so that it starts with a start code, mp4Box is able to create an .mp4 file out of the es stream.

Not sure whether this is a good idea to do this way. Searching for the first start code seems to a better way of doing this.

I still have question about the ts support by mp4Box.