1

I am generating H264 stream from still images like this:

avconv -y -r 25 -i dummy_%d.tif dummy.h264

When trying to multiplex to matroska with

avconv -i dummy.h264 -c:v copy dummy.mkv

I get the following error:

[matroska @ 0x8c1860] Can't write packet with unknown timestamp
av_interleaved_write_frame(): Invalid argument

So, avconv did not generate timestamps for the frames, and as matroska needs them to do its indexing, the multiplexing fails, right?

Stock video players go similarly mad when they try to produce the stream:

mplayer dummy.h264

No pts value from demuxer to use for frame!
Video pts after filters MISSING
V: ???     0/  0 ??% ??% ??,?% 0 0 

mpv dummy.h264

No video PTS! Making something up.
V: 00:00:00 / 00:00:00 (77%)

Now, if I do:

avconv -i dummy.h264 dummy.mkv

That actually works, but the raw H264 stream inside the matroska container is still missing the PTS information..! One can confirm this with "avconv -i dummy.mkv test.h264", etc.

For the specific project I am doing I need raw H264 stream with correct PTS information. How on earth can I achieve this!?

I am also dealing with videos, recorded from IP cams that frequently have missing/erroneous PTS information, so I should be able to correct their PTS's before placing them to the matroska container - otherwise the multiplexing fails, i.e. the problem is identical to the one described here for the video generation from still images.

So far I have tried for video generation:

avconv -y -fflags +genpts -r 25 -i dummy_%d.tif dummy.h264

avconv -y -fflags genpts -r 25 -i dummy_%d.tif -fflags genpts dummy.h264

And for multiplexing:

avconv -y -r 25 -i dummy.h264 -r 25 -fflags genpts -filter:v "setpts=PTS-STARTPTS" dummy2.h264

avconv -fflags +genpts -i dummy.h264 -c:v copy dummy.mkv

avconv -y -r 25 -fflags +genpts -i dummy.h264 -c:v copy dummy.mkv

.. and many more permutations.

Nothing works! .. it starts to seem like a bug to me. I am running avconv 9.16-6:9.16 on Ubuntu 14.04.

Starting to get desperate.

Has anyone had any success in generating the PTS's with avconv?

El Sampsa
  • 1,291
  • 3
  • 14
  • 29

1 Answers1

0

try

mkvmerge -o output.mkv in.mkv
Tunaki
  • 116,530
  • 39
  • 281
  • 370
ben
  • 1