Why does my mp4 (h.264) need mp4box all the time?

0

Whenever I convert a video into mp4 with h.264 codec, it doesn't play immediately on Windows or iPad. It plays fine when I convert the video with mp4box. I use the following command to convert.

mp4box -hint video.mp4

I like to know what I'm adding to the video with mp4box..

How does it work?

user45326

Posted 2011-05-21T05:39:33.240

Reputation: 1 623

Answers

3

Note that mp4box does not encode any video, it is only used to re-package existing content. So my guess is that you already have an encoded video and then use mp4box to add the hint option. While that workflow doesn't really make sense to me at first, let me explain what hint means:

The -hint option is probably called in order to introduce a so called Hint Track to the video file.

What is a hint track? Well, your video file itself is a series of bits, nothing more, and in some applications, this is very inefficient. Take the example of a server that streams the video. It has to encapsule the video into packets that are sent over the network. But how does the server know which parts of the video to put in which packet? If the server doesn't know the structure of the bitstream, it will not be able to correctly packetize it.

Here is where the hint track comes into play. It is generated to allow a streaming server to correctly packetize the video into RTP packets. Basically such a hint track says "Put part XY of the video in packet AB".


That all being said a true h.264 does not need to have a hint track for streaming, as h.264 has a Network Abstraction Layer that provides a streaming server with all the necessary information to packetize the video. Hinting is only necessary for MPEG-4 Visual videos (for example encoded with DivX or XviD).

Check if your encoder already outputs a valid mp4 file — which one do you use actually?

slhck

Posted 2011-05-21T05:39:33.240

Reputation: 182 472

// Thank you for your very detailed information. I use handbrake. – user45326 – 2011-05-21T09:15:15.227

@user12077 That's interesting. So even if you're using the appropriate settings for iPad, the file generated by Handbrake don't open? – slhck – 2011-05-21T09:19:08.373

@user12077: If you are streaming this video then this hinting information is important, but I don't think it should be if its just being accessed as a local file. How exactly are you accessing the file for playback? If you are streaming it, does it play back fine if you play it back on the local machine? – Spectre – 2011-05-22T12:51:20.447

@Spectre // sorry for the delay in response; i'm actually streaming this file over the net. – user45326 – 2011-08-12T00:52:04.943

1

What program are you using to create/encode the h264 video in the place? It could be that the encoder is outputting a raw h264 file, this raw stream usually needs to be put into a container format, such as mkv or mp4, along with the audio stream, before its able to be played back.

Check your h264 encoder to see if it automatically puts the encoded video in an mp4 container for you, or if it has a specific profile/settings for your device. if it does, but still doesnt play back, it might just be a bug, in which case youll have to stick to using mp4box manually.

Spectre

Posted 2011-05-21T05:39:33.240

Reputation: 1 045

// I'm using HandBrake. – user45326 – 2011-05-21T09:15:24.993

Hmm, I just realised I may have misread your question, you say it doesn't "play immediately", does that mean that it doesn't play at all, or just takes longer than normal to start playing? – Spectre – 2011-05-22T12:47:13.080

// it takes longer than normal to start playing. – user45326 – 2011-08-12T00:52:35.190