xj-it / xuggle

Automatically exported from code.google.com/p/xuggle
0 stars 0 forks source link

IStreamCoder.addExtraData behaves strange when setting H.264 paramsets for MP4 containers #296

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Configure an mp4 container with an open an H.264 stream
2. open the stream
3. setExtraData with {0,0,0,1,67,...,0,0,0,1,68,...} and the corresponding 
length.
4. Add frames, close the container

What is the expected output? What do you see instead?

Analysing the file in a hexditor I would expect to find an avcC atom containing 
the followin data:
..., length of sps, sps, 01, length of pps, pps
but I find
..., length of sps, sps, 01, length of pps + x, pps, some data

The problem is that the length of the extra data buffer is only updated by 
setExtraData if the length of the new extra data is longer then the old one. If 
not the remaining part of the buffer is kept filled with trash. FFMPEG seems to 
compute the length of the pps from the length of the extra data which is then 
too large (in my example the own parameter sets are larger then the original 
ones).

What operating system and JVM version are you using.

Windows, but I don't think that makes a difference

Attach relevant log/output files.

Not needed, just fix it in StreamCoder.cpp. Should take 5 minutes.

Original issue reported on code.google.com by arnd.e...@googlemail.com on 9 May 2012 at 8:04