ffmpeg warning: "Timestamps are unset in a packet" when converting H264 to mp4

Since the stream is created by ffmpeg, there is no reason for it not to contain required Timestamps.

Except that raw H.264 bitstreams do not have timestamps.

This change was introduced a while ago, and according to what I see, it simply doesn't consider the use case of muxing elementary streams that cannot have timestamps.

This works:

MP4Box -add test.264 -fps 10 test-out.mp4

My thinking was that specifying input framerate (-r ... -i ...) would be sufficient to make that error disappear, since it is supposed to generate timestamps, but apparently it does not help in this case. It might be a bug, but I may be missing something more obscure.

An alternative was suggested by Eugen Rieck in a comment below:

ffmpeg -i test.264 -c copy test.avi
ffmpeg -i test.avi -c copy test.mp4