mpeg4-part2 is video-compression format standard, it's implemented by divx4,5,6, xvid, 3ivx, etc.. codecs.
-> we should be able to handle divx4,5,6, xvid as mpeg4-part2 in our dvbmediasink.
It's not the case, we are differentiating between this implementations, and informing decoder what it gets on input with streamtypes like STREAMTYPE_DIVX5, STREAMTYPE_DIVX4, STREAMTYPE_XVID.
In gstreamer 0.10 this worked quite well, since we could differentiate between this implementations, because xvid caps were still pass around.
In gstreamer 1.0 this became problem, since there are no xvid caps anymore(https://bugzilla.gnome.org/show_bug.cgi?id=739196), so we had to patch gstreamer in order to provide them.
To avoid all this problems, we can use STREAMTYPE_MPEG4-Part2 for every mpeg4-part2 implementation.
Decoder expectations for STREAMTYPE_MPEG4-Part2:
- PTS timestamps set for every frame (except xtrends, they only need PTS on keyframes)
- unpacked bitstream
PTS:
problem is that gstreamer demuxers/parsers set PTS only on keyframes(I) for mpeg4-part2
We can compute PTS from DTS like this:
https://software.intel.com/sites/default/files/pts-dts_shift_explain.gif
Unpacked bitstream:
Description of problem - https://bugzilla.gnome.org/show_bug.cgi?id=740015
Correct unpacking routine can be found here:
Solution:
- added unpacking of packed bitstream
- added PTS from DTS computation
pros:
- no need to patch gstreamer anymore
- possible to remove divx,xvid specific code from dvbmediasink
- fixed problems with videos with invalid metadata (wrong fourcc, marked as packed when not packed...)
cons:
- slightly higher load when unpacking and computing
- ...
git - https://github.com/mx3L/gst-plugin-dvbmediasink-1/tree/test_mpeg4p2_4
Testing:
In order to get this applied to dvbmediasink we need to do extensive testing
Some test files:
http://forums.openpli.org/topic/29501-gstreamer-10/page-19#entry461035
All tested and works correctly on et4x00, vusolose, dm800se
In case you find some mpeg4-part2 which doesn't work, please post here link to sample
so we can test it.
PS:
Thanks to @athoik for tests on dm800se and suggestions