Log in

View Full Version : HowTo unpack packed bitstreams (DivX5, XviD, VSS) with AVI2RAW


bond
19th February 2005, 23:23
the avi2raw tool from mpeg4ip now offers the possibility to unpack packed bitstreams when extracting MPEG-4 ASP and AVC streams from avi to raw

When extracting the video stream from .avi to raw avi2raw will automatically unpack the packed bitstreams by default, but leaving still the so called "placeholder frames" (and also delays frames) in the stream. These can be removed with the new "-e=x" (x being bytes) option (stands for "eliminate short frames") available since version 1.2.6, removing all frames up to the defined framesizes (in bytes)

As described here (http://forum.doom9.org/showthread.php?s=&threadid=80430) DivX5 and XviD place N-Vops as placeholders in the stream. According to my findings these have the following sizes:
- XviD N-Vops are 6 bytes big
- DivX5 N-Vops are 8 bytes big

Also VSS' AVC encoder uses packed bitstream for placing B-Vops in AVI but doesnt use N-Vops as placeholders (as they afaik are not allowed in AVC) but empty frames with Byte Stream Format markers (NAL)
- VSS placeholders are 4 bytes big

additionally also the so called 1 byte delay frames caused when encoding without virtualdub(mod) and b-frames can be removed that way

sample commandline:
avi2raw -e=8 -v divx5.avi output.m4vas a result you get a correct and 100% spec compliant raw mpeg-4 asp or avc stream which you than can mux into your favourite container again with a tool that handles raw streams as input (eg into .mp4 with mp4creator...)

JoeBG
20th February 2005, 10:34
Does this also work with first converting to mp4 with mp4box and then extrakting to raw with mp4creator?

bond
20th February 2005, 11:28
Originally posted by JoeBG
Does this also work with first converting to mp4 with mp4box and then extrakting to raw with mp4creator? this is about demuxing from .avi to raw! you wouldnt even have to touch a .mp4 related tool here if you dont want to

mp4box doesnt need avi2raw so why should this have anything to do with mp4box?
also whats the sense of muxing from .avi to .mp4 with mp4box and than demuxing to raw again?

JoeBG
20th February 2005, 18:07
@ bond

Puuuuhhhh: This seems to be easier. I testet it with small clips and it works for me :)

Okay: when we change it, you donīt warn for for using mp4muxer? :)

bond
20th February 2005, 20:14
Originally posted by JoeBG
Okay: when we change it, you donīt warn for for using mp4muxer?of course the possible downsides still are (as i listed already):
- the -e=8 option might also remove correct frames, when they are smaller than 8 bytes
- this solution is pretty untested, especially on long streams
- mpeg4ips tools are always good for (bad) surprises

JoeBG
21st February 2005, 18:54
The new mp4muxer implemented both methods and you can choose your favourite one in the configuration window:
- Method1 (faster) with -e=8 with the new avi2raw
- Method2 (slower) with an extra step in mp4box(convert)

unplugged
4th March 2005, 12:45
Could you put the command line for mp4box method?

Where to download up to date avi2raw, that at rarewares seems not be the same you point (-e=8 doesn't work).

bond
4th March 2005, 12:53
Originally posted by unplugged
Could you put the command line for mp4box method?

Where to download up to date avi2raw, that at rarewares seems not be the same you point (-e=8 doesn't work). this doesnt belong in this thread

:search: