Вопрос

I've built an AVI M-jpeg encoder which basically build an AVI Riff header with all the infos.

I'm adding a frame index at the end of the video stream as specified in the specs.

Index is built as follow:

idx1[Size], then 00dc[0x10,0x00,0x00,0x00][Offset from frame X][Size from frame X] until the end. I compared to any other AVI file, and everything is the same. So I can't understand where softwares don't find - or search for - the index in my AVI file. Also verified several time that each tag has the good byte length indicated after. By the way, there is the good padding in each offset, and the length is the size of the jpeg only.

I attached the current rendered file: movie.avi

I spent the whole day trying to figure out what is the problem with my index. AVI spec is really simple, so I'm smashing my head on the desk.

[Edit]

As soon as my video is longer than 1 second, it fails. That makes no sense for me currently as the algorithm is the same, whatever how many frames are written.

Это было полезно?

Решение

Your AVI file violates the alignment rule: every chunk must start at an even byte.

Add a zero byte after every odd-length frame, and update the index accordingly. The chunk size in the header should still be odd to tell the true size of the data, but all offsets should be even.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top