After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 740015 - mpeg4videoparse xvid packed bitstream
mpeg4videoparse xvid packed bitstream
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.4.4
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-11-12 14:12 UTC by Athanasios Oikonomou
Modified: 2018-11-03 13:28 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Athanasios Oikonomou 2014-11-12 14:12:38 UTC
DivX Networks introduced a hack with their so-called dx50 VOP mode, inserting 
dummy frames into the AVI as placeholders and packing the b-frame itself 
into the same chunk together with the I/P frame it is referencing to.

XviD does that also, but if offering a so-called 'packed bitstream' mode 
also as alternative. IN both cases parser, reading the MPEG4 
frames , would have to get rid of the dummy frames and reorder the 
b-frames such that coding order is achieved in the final output. 

-----------------

The n-vops are inserted into "empty" frames when using packed-mode.
[foo] represents an avi frame, [-] re e.g.

unpacked: [I] [P]  [B] [B] [P]  [B] [B] [P]
packed    [I] [PB] [B] [-] [PB] [B] [-] [P]

The empty frames cannot be set to length=0, because vfw decoding
interprets this as a frame drop and doesnt bother calling the codec.

So to get arround this, divx5.02 inserts a n-vop using the previous
p-vop's timecode. xvid does the same to remain compatible.

-----------------

There is no way to differentiate "packed-n-vops" from real n-vop.
however, packed bitstream can be detected from the divx userdata tag.
the tag takes the form "DivX%dB%d%c", version, build, packed.

-----------------

Packed b-frames: In packed b-frame mode there are fake nvops written
to the output by the encoder. Those are not real nvops but are rather
supposed to be totally ignored by the decoder. As such it is not really
a proper use of nvops but it's become the defacto standard how the b-frame
encoder delay got handled with the AVI container. If you don't want to
mux your output into AVI, use the "-nopacked" switch and there should be
no fake nvops added anymore.

-----------------

Currently the mpeg4videoparse doesn't discard those "fake n-vops" causing issues in playback. 

The following is what we receive to render function of our sink:

unpacked xvid:

0x000000: 00 00 01 b0 f5 00 00 01 ........
0x000008: b5 09 00 00 01 00 00 00 ........
0x000010: 01 20 08 86 87 ff ff 0a . ......
0x000018: ad 88 82 19 0a 31 00 00 .....1..
0x000020: 01 b2 58 76 69 44 30 30 ..XviD00
0x000028: 34 33 00 00 01 b6 10 00 43......
0x000030: 0c 06 30 47 b6 fe 36 db ..0G..6.
0x000038: f8 db 6f e3 6d bf 8d b6 ..o.m...
0x000040: fe 36 db f8 db 6f e3 6d .6...o.m
0x000048: bf 8d b6 fe 36 db f8 db ....6...
0x000050: 6f e3 6d bf 8d b6 fe 36 o.m....6
0x000058: db f8 db 6f e3 6d bf 8d ...o.m..
0x000060: b6 fe 36 db f8 db 6f e3 ..6...o.
0x000068: 6d bf 8d b6 fe 36 db f8 m....6..

packed xvid:

0x000000: 00 00 01 b0 f5 00 00 01 ........
0x000008: b5 09 00 00 01 00 00 00 ........
0x000010: 01 20 08 86 87 ff ff 0a . ......
0x000018: ad 88 82 19 0a 31 00 00 .....1..
0x000020: 01 b2 44 69 76 58 35 30 ..DivX50
0x000028: 33 62 31 33 39 33 70 00 3b1393p.
0x000030: 00 01 b2 58 76 69 44 30 ...XviD0
0x000038: 30 34 33 00 00 01 b6 10 043.....
0x000040: 00 0c 06 30 47 b6 fe 36 ...0G..6
0x000048: db f8 db 6f e3 6d bf 8d ...o.m..
0x000050: b6 fe 36 db f8 db 6f e3 ..6...o.
0x000058: 6d bf 8d b6 fe 36 db f8 m....6..
0x000060: db 6f e3 6d bf 8d b6 fe .o.m....
0x000068: 36 db f8 db 6f e3 6d bf 6...o.m.

unpacked xvid: 

XviD Packet Dump
0x000000: 00 00 01 b0 f5 00 00 01 ........
0x000008: b5 09 00 00 01 00 00 00 ........
--
XviD Packet Dump
0x000000: 00 00 01 b6 52 22 78 10 ....R"x.
0x000008: b1 93 b1 95 90 be 97 04 ........
--
XviD Packet Dump
0x000000: 00 00 01 b6 91 28 38 29 .....(8)
0x000008: 3f f4 fc a9 b9 a6 3d 06 ?.....=.
--
XviD Packet Dump
0x000000: 00 00 01 b6 91 a5 58 31 ......X1
0x000008: 34 ff fe 8e be 48 e1 ef 4....H..
--
XviD Packet Dump
0x000000: 00 00 01 b6 53 99 dc 14 ....S...
0x000008: be fb eb 62 e5 f0 70 60 ...b..p`
--
XviD Packet Dump
0x000000: 00 00 01 b6 92 9f 98 29 .......)
0x000008: 3f a7 fc 89 b4 b3 83 83 ?.......
--
XviD Packet Dump
0x000000: 00 00 01 b6 93 1c b8 31 .......1
0x000008: 3f ff 4f ff ff 4b ff 09 ?.O..K..
--
XviD Packet Dump
0x000000: 00 00 01 b6 55 11 38 10 ....U.8.
0x000008: b7 8b 56 c1 62 af d8 70 ..V.b..p
--
XviD Packet Dump
0x000000: 00 00 01 b6 94 16 f8 39 .......9
0x000008: 3a 3f fe 08 8e 74 18 9c :?...t..
--
XviD Packet Dump
0x000000: 00 00 01 b6 94 94 18 31 .......1
0x000008: 3d 3f ff 4e 9f d1 bf fa =?.N....
--
XviD Packet Dump
0x000000: 00 00 01 b6 56 88 9c 10 ....V...
0x000008: b7 85 88 78 2f 01 29 3c ...x/.)<


packed xvid: 

XviD Packet Dump
0x000000: 00 00 01 b0 f5 00 00 01 ........
0x000008: b5 09 00 00 01 00 00 00 ........
--
XviD Packet Dump
0x000000: 00 00 01 b6 52 22 78 10 ....R"x.
0x000008: b1 93 b1 95 90 be 97 04 ........
--
XviD Packet Dump
0x000000: 00 00 01 b6 91 28 38 29 .....(8)
0x000008: 3f f4 fc a9 b9 a6 3d 06 ?.....=.
--
XviD Packet Dump
0x000000: 00 00 01 b6 91 a5 58 31 ......X1
0x000008: 34 ff fe 8e be 48 e1 ef 4....H..
--
XviD Packet Dump
0x000000: 00 00 01 b6 52 22 73    ....R"s

--
XviD Packet Dump
0x000000: 00 00 01 b6 53 99 dc 14 ....S...
0x000008: be fb eb 62 e5 f0 70 60 ...b..p`
--
XviD Packet Dump
0x000000: 00 00 01 b6 92 9f 98 29 .......)
0x000008: 3f a7 fc 89 b4 b3 83 83 ?.......
--
XviD Packet Dump
0x000000: 00 00 01 b6 93 1c b8 31 .......1
0x000008: 3f ff 4f ff ff 4b ff 09 ?.O..K..
--
XviD Packet Dump
0x000000: 00 00 01 b6 53 99 d3    ....S

--
XviD Packet Dump
0x000000: 00 00 01 b6 55 11 38 10 ....U.8.
0x000008: b7 8b 56 c1 62 af d8 70 ..V.b..p
--
XviD Packet Dump
0x000000: 00 00 01 b6 94 16 f8 39 .......9
0x000008: 3a 3f fe 08 8e 74 18 9c :?...t..
--
XviD Packet Dump
0x000000: 00 00 01 b6 94 94 18 31 .......1
0x000008: 3d 3f ff 4e 9f d1 bf fa =?.N....
--
XviD Packet Dump
0x000000: 00 00 01 b6 55 11 33    ....U.3

--
XviD Packet Dump
0x000000: 00 00 01 b6 56 88 9c 10 ....V...
0x000008: b7 85 88 78 2f 01 29 3c ...x/.)<
--


Packed XviD has extra packets received on sink and those are causing problems in rendering.

0x000000: 00 00 01 b6 52 22 73    ....R"s
--
0x000000: 00 00 01 b6 53 99 d3    ....S
--
0x000000: 00 00 01 b6 55 11 33    ....U.3


So if those packets removed and also packed bitstream (DivX503b1393p) removed, then there will be no difference between packed and unpacked xvid.


More info:
https://bugzilla.gnome.org/show_bug.cgi?id=739196
http://itsjustonesandzeros.blogspot.ca/2007/01/what-is-packed-bitstream.html
http://list.xvid.org/pipermail/xvid-devel/2002-September/000870.html
http://lists.matroska.org/pipermail/matroska-devel/2003-June/000603.html
http://list.xvid.org/pipermail/xvid-devel/2004-March/004091.html
http://list.xvid.org/pipermail/xvid-devel/2014-April/006418.html
Comment 1 GStreamer system administrator 2018-11-03 13:28:13 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/187.