View Full Version : How to convert an XviD bitstream (video) to MPEG-4
elumo
30th April 2004, 17:33
I am interested in XviD codec as MPEG-4 compliance.
I would like to convert a video of XviD to MPEG-4 and
decode the convert video by a MPEG-4 decoder.
I found that the syntax of XviD was very compatible to MPEG-4 when
I confirmed the source code, but the bitstream was not decoded by
the MPEG-4 decoder. Although I compared it with that of MPEG-4,
I could not understand differences of the syntax. If the XviD’s
bitstream is converted to the MPEG-4 bitstream, how do I make
a converter program or implement additional syntax?
Therefore, please let me know the following questions.
1.) What is the main difference between the format of XviD
bitstream and MPEG-4 bitstream?
Please tell me the guideline for converting XviD to MPEG-4.
2.) Is there a plan to make an XviD's original profile that
is a departure from the MPEG4 compliance?
Now "unrestricted" profile is existing, but I suppose that
this profile is only extensions of Simple, AS, and ARTS profile.
For example, is there a profile using a tool of loop filter
like DivX?.
3.) The encoder does not have some coding tools
(cf. packet video), but the decoder has these. Why?
Or will these coding tools be supported in the future? When?
4.) Are there reference bitstreams of conformance test?
And there are additional questions about XviD’s codec.
If anyone knows, could you please answer the following
questions, too?
5.) Are the coding tools of UMV and OBMV implemented or not?
If not implemented, will the tools be supported in the future?
6.) Now XviD's GMC uses three wrap points. Will GMC use fourth
wrap point in the future?
7.) How does GMC method work?
Best Regards,
elumo
Soulhunter
30th April 2004, 18:28
Originally posted by elumo
Please tell me the guideline for converting XviD to MPEG-4.Ehm, just double-click the file... :D :D :D
Or do you talk about MP4 (the container) instead of MPEG4 (the stream) ???
Bye
bond
30th April 2004, 18:31
welcome to doom9 elumo :)
Originally posted by elumo
1.) What is the main difference between the format of XviD
bitstream and MPEG-4 bitstream?
Please tell me the guideline for converting XviD to MPEG-4.xvid = mpeg-4
2.) Is there a plan to make an XviD's original profile that
is a departure from the MPEG4 compliance?
Now "unrestricted" profile is existing, but I suppose that
this profile is only extensions of Simple, AS, and ARTS profile.
For example, is there a profile using a tool of loop filter
like DivX?.as xvid is mpeg-4 what sense would a private profile make?
divx doesnt use (in)loop filtering, thats a feature of mpeg-4 avs/h.264
3.) The encoder does not have some coding tools
(cf. packet video), but the decoder has these. Why?
Or will these coding tools be supported in the future? When?what do you mean with "packed video"? data partioning? or packed bitstream? the later is only a hack to be able to place b-frames in the avi container, its not a mpeg-4 feature (in contrary, some people claim it breaks the mpeg-4 compliance of the bitstream)
as xvid is an opensource encoder it will only offer features which someone implements... till now this works great, thanks to the great guys involved in xvid development :)
5.) Are the coding tools of UMV and OBMV implemented or not?
If not implemented, will the tools be supported in the future?never heard of umv, obmv? you mean motion search? or "mv files" as divx5 offers them
6.) Now XviD's GMC uses three wrap points. Will GMC use fourth
wrap point in the future?if someone implements it, xvid will offer it ;)
7.) How does GMC method work?plz use search
RadicalEd
30th April 2004, 20:35
The fourth warp point can't be used in GMC.
UMV = unrestricted motion vector and OBMV = object based motion vector..? Object coding is part of the core profile, xvid only goes up to advanced simple currently. Of course, object based motion vector was just a guess :P
ack, pwned :|
BoNz1
30th April 2004, 20:49
OBMC and not OBMV is overlapping block motion compensation. This is what you mean. This is not used in mpeg4 simple or asp or mpeg4 arts.
EDIT: And it is not supported in XviD.
Thank you very much for all your replies!
Soulhunter wrote:
- Or do you talk about MP4 (the container) instead of MPEG4 (the stream) ???
No, I don’t think so, but..
Though I tried to decode a XviD .avi file (only video stream) by MPEG-4, I could not decode it. So I thought there was a difference about the stream. Could the difference be the container instead of the stream?
I used QuickTime player, an commercial MPEG-4 analyzer and the following decoder as the MPEG-4 compliance decoder.
sklmp4 http://skal.planet-d.net/coding/mpeg4codec.html ( I understand that this decoder does not support B-VOP.)
And I used the following .avi file.
b2ch.at.infoseek.co.jp/movie/xvid.avi
http://b2ch.at.infoseek.co.jp/dump.html (sorry, this page is in Japanese)
bond wrote:
- welcome to doom9 elumo
THANKS!
- xvid = mpeg-4
OK.
Is the reason that I cannot decode the file not a difference about the stream but a difference about anything else?
- divx doesnt use (in)loop filtering, thats a feature of mpeg-4 avs/h.264
Really? I heard DivX used loop filtering so that the DivX file was not compliance to MPEG-4.
- what do you mean with "packed video"? data partioning? or packed bitstream? the later is only a hack to be able to place b-frames in the avi container, its not a mpeg-4 feature (in contrary, some people claim it breaks the mpeg-4 compliance of the bitstream)
I’m sorry I was wrong. “packet video” meant “data partitioning”. Watching the source, the decoder seems to read “resync_marker”. This flag bit is to use the tool, isn’t it?
- as xvid is an opensource encoder it will only offer features which someone implements... till now this works great, thanks to the great guys involved in xvid development
Okay. I’m sure the great guys will involve the tools in xvid development.
- never heard of umv, obmv? you mean motion search? or "mv files" as divx5 offers them
The UMV and OBMV meant motion vector. Thank you very much RadicalEd, BoNz1 for your complement!
UMV = unrestricted motion vector.
OBMV = overlapping motion vector.
The topics are summarized as follows. Is it right?
- No difference between XviD stream and MPEG-4 stream.
- There is other reason that I could not decode it by MPEG-4 decoder.
- There is not a unique profile (excluded unrestricted profile) till someone implements.
- GMC fourth point may be implemented in the future.
- OBMC is not supported.
- I have to search GMC works. (^_^)
Could you please tell me other question?
1.) Why cannot the XviD video file be decoded by MPEG-4 decoder?
2.) Are there reference bitstreams of conformance test?
3.) Is the coding tools of UMV implemented or not?
Thanks and Regards,
elumo
sysKin
1st May 2004, 03:35
Originally posted by elumo
I used QuickTime player, an commercial MPEG-4 analyzer and the following decoder as the MPEG-4 compliance decoder.
sklmp4 http://skal.planet-d.net/coding/mpeg4codec.html ( I understand that this decoder does not support B-VOP.)
And I used the following .avi file.
b2ch.at.infoseek.co.jp/movie/xvid.avi
http://b2ch.at.infoseek.co.jp/dump.html (sorry, this page is in Japanese)Skal's decoder decodes xvid perfectly - but only accepts pure .mp4v video stream, without any container (afaik). It doesn't accept an .avi file.
As for quicktime, it also works, but needs .mp4 (mpeg-4 systems) file. Again, not an .avi. Watch out with quicktime, some mpeg-4 syntax (like n-vops) make it crash.
- divx doesnt use (in)loop filtering, thats a feature of mpeg-4 avs/h.264
Really? I heard DivX used loop filtering so that the DivX file was not compliance to MPEG-4.bond is right, divx5 is mpeg-4 compiliant, XviD decodes divx files without any problems (except for data partitioning).
“packet video” meant “data partitioning”. Watching the source, the decoder seems to read “resync_marker”. This flag bit is to use the tool, isn’t it?Not quite, some streams have resync markers without using data partitioning. XviD decodes that, even if doesn't create such streams.
Okay. I’m sure the great guys will involve the tools in xvid development.OBMC is not part of any profile, right? So it will not be implemented. Data partitioning is only a simple patch, waiting to be added to the code.
Radek
Thank you very much sysKin.
Originally posted by sysKin
Skal's decoder decodes xvid perfectly - but only accepts pure .mp4v video stream, without any container (afaik). It doesn't accept an .avi file.
As for quicktime, it also works, but needs .mp4 (mpeg-4 systems) file. Again, not an .avi. Watch out with quicktime, some mpeg-4 syntax (like n-vops) make it crash.
Good infomation for me! THANKS!
If I use Skal's decoder, I have to use only a pure .mp4 video stream.
If I cannot decode a XviD file, the file is not pure.
To convert video stream is only to rename a file from ".avi" to ".mp4", right?
so I cannot understand "without any container (afaik)",
could you please tell me this mean in a little more detail?
bond is right, divx5 is mpeg-4 compiliant, XviD decodes divx files without any problems (except for data partitioning).
Oh, sorry bond, sysKin.
Not quite, some streams have resync markers without using data partitioning. XviD decodes that, even if doesn't create such streams.
OBMC is not part of any profile, right? So it will not be implemented. Data partitioning is only a simple patch, waiting to be added to the code.
Thanks for your explanation.
And do you know the answers about other questions?
Best Regards,
elumo
Blue_MiSfit
1st May 2004, 06:01
Good infomation for me! THANKS!
If I use Skal's decoder, I have to use only a pure .mp4 video stream.
If I cannot decode a XviD file, the file is not pure.
To convert video stream is only to rename a file from ".avi" to ".mp4", right?
so I cannot understand "without any container (afaik)",
could you please tell me this mean in a little more detail?
Okay, you seem to be a little bit confused about containers and streams. XviD produces an MPEG-4 compliant stream, which has to be stored somewhere. Since we all use windows, the standard container format is avi.
From what I understand, skal's mpeg4 decoder requires the video to NOT be encapsulated in a container - that is it needs to be a raw mpeg4 video stream. I have no idea how to get it into that format, but you can NOT simply rename the avi to mp4. If you want to make an MP4, you have to look into the forums and read up on MP4 creation - you're going to have to use a program like graphedit to transmux ( I think thats the correct term ) your avi into an MP4. This will make it playable by quicktime (assuming there are no n-vops as noted by syskin).
I would honestly reccommend using XviD's built in decoder or a general purpose decoder like ffdshow. These produce excelent results. and can playback from a container like avi
Good luck getting up and running.
Regards
~misfit
CruNcher
1st May 2004, 06:09
@elumo
To convert video stream is only to rename a file from ".avi" to ".mp4", right?
hehe that's not enough you have to get rid of the AVI container dunno how this could be done hmm but i don't think removing the header would be enough ? so better for you is to use xvid_encraw to create a mp4v bitstream out of a YUV file command would look like this
xvid_encraw -type 0 -w 640 -h 330 -nframes 250 -i riverbed.yuv -o xvid.m4v -quality 6 -asm
the file you get can then be decoded with any Mpeg-4 Bitstream Decoder like xvid_decraw, skals or the reference decoder, if that's not the case most probably syskin b0rked something again ;) *hides*
but now i realized i missed your point i dunno myself how to get that bitstream into a mp4 file hmm maybe mpeg4ip can do that
sysKin
1st May 2004, 07:45
Originally posted by elumo
If I use Skal's decoder, I have to use only a pure .mp4 video stream.Just an explaination - Skal's decoder needs m4v video stream. It's a completely pure video stream, without any container - just one frame appended after another and another. It's just like m1v stream, which is the same thing but with mpeg-1 video.
Quicktime needs mp4 data, which is a container defined in mpeg-4 part 1 (mpeg-4 systems). This is a very advanced container, which typically holds mpeg-4 video data in it (plus AAC audio, chapters, and more). It would be an equivalent of .mpeg files.
Radek
so I cannot understand "without any container (afaik)",
could you please tell me this mean in a little more detail?to be able to place audio and video streams together into 1 file you need a container format (like avi, mpg, mp4, wmv aso...)
so to say you take the raw stream and mix them together to 1 file: mp4v/m4v + mp3 = .avi (or .mp4)
Originally posted by elumo
Is the reason that I cannot decode the file not a difference about the stream but a difference about anything else?when i comes to mpeg-4 video streams in .avi there can be the following reasons which cause incompatibilites between existing mpeg-4 tools:
- avi uses fourccs, which describe what content is stored in it. all mpeg-4 codecs, which place mpeg-4 in avi use different 4ccs, therefore normally they cant interoperate (most decoders (divx5, xvid, 3ivx, ffdshow) offer workarounds for this tough
- to be able to place b-frames in avi xvid and divx5 use a hack called packed bitstream, which isnt covered by the mpeg-4 standard
therefore some decoders might not handle it
Really? I heard DivX used loop filtering so that the DivX file was not compliance to MPEG-4.divx5 is mpeg-4 compliant
The topics are summarized as follows. Is it right?
- No difference between XviD stream and MPEG-4 stream.apart from packed bitstream
- There is not a unique profile (excluded unrestricted profile) till someone implements.there are profiles defined in the mpeg-4 standard, which you can set in xvid already!
1.) Why cannot the XviD video file be decoded by MPEG-4 decoder?to sum it up: because of avi :D
Originally posted by sysKin
Data partitioning is only a simple patch, waiting to be added to the code.is the code already exisiting? do you plan to add other error resilience tools like resync markers or rvlc too?
would be nice for XCD :)
Originally posted by CruNcher
hehe that's not enough you have to get rid of the AVI container dunno how this could be done hmm but i don't think removing the header would be enough ? the latest cvs of the mp4box tool from gpac can extract raw mp4v/m4v streams from .mp4
of course you would also have to transmux from the .avi to .mp4 first, which is also possible with mp4box
but now i realized i missed your point i dunno myself how to get that bitstream into a mp4 file hmm maybe mpeg4ip can do thatyes you can get a raw mp4v/m4v stream into .mp4 with the mp4creator tool from mpeg4ip
How to convert an XviD bitstream (video) to [MP4]
You use the 3ivx Filter Suite to transmux your AVI to MP4. The 3ivx Muxer will strip the NVOPs (so as not to cause QT problems), as well as unpack the bframes, and produce a nice compliant, interoperable MP4 file.
AVI -> MP4
http://www.3ivx.com/support/windows/encoding/ge_avi2mp4.html
SeeMoreDigital
1st May 2004, 12:11
Originally posted by Stux
You use the 3ivx Filter Suite to transmux your AVI to MP4. The 3ivx Muxer will strip the NVOPs (so as not to cause QT problems), as well as unpack the bframes, and produce a nice compliant, interoperable MP4 file.
AVI -> MP4
http://www.3ivx.com/support/windows/encoding/ge_avi2mp4.html Yep, the GraphEdit method works very well, and creates very stable Mpeg4 video streams in the MP4 container. Much better than MP4UI.
It's a shame there's no GraphEdit method to extract and create an mp4v (or m4v) elementary stream from out of an MP4 or AVI container... This would be really cool!
jimmy basushi
1st May 2004, 14:20
is there any posibility of getting a program that muxes to mp4 (reliabily of course) like mkvtools ? i dont mind doing it the graphedit method, its just a bit of fiddling.
SeeMoreDigital
1st May 2004, 14:57
Originally posted by jimmy basushi
is there any posibility of getting a program that muxes to mp4 (reliabily of course) like mkvtools ? i dont mind doing it the graphedit method, its just a bit of fiddling. Yes, you can use MP4UI.
It's a very useful application but it has its qwerks. For-instance, the current (1.0 beta2) version likes to have the AAC (in MP4) stream, inserted into the application before the MPEG4 (in AVI) stream!
And the resulting files will not be compliant with the QuickTime player. Which is a shame... but it's still early days with this app.
Cheers
RadicalEd
2nd May 2004, 05:33
Originally posted by SeeMoreDigital
It's a shame there's no GraphEdit method to extract and create an mp4v (or m4v) elementary stream from out of an MP4 or AVI container... This would be really cool!
Wouldn't just writing the output of the mp4 splitter to a file do that..? :|
SeeMoreDigital
2nd May 2004, 10:01
Originally posted by RadicalEd
Wouldn't just writing the output of the mp4 splitter to a file do that..? :| Could you (or someone else) give this a try please? I'm using my crappy old PC at the moment. And for some reason GraphEdit no longer works reliably!
Cheers
RadicalEd
2nd May 2004, 16:07
I'd love to. Unfortunately, I'm at a business center in some hotel. I can do it tonight though :D
SeeMoreDigital
2nd May 2004, 16:15
Originally posted by RadicalEd
I'd love to. Unfortunately, I'm at a business center in some hotel. I can do it tonight though :D Just passin' some time then?... Yep, if you would not mind!
It would certainly be interesting and useful to find a way how to do this.
Cheers
RadicalEd
3rd May 2004, 16:25
Hmm... the pins don't seem to connect. So much for that idea :p
you can extract the mpeg-4 video stream to .mp4v from .mp4 files with gpac's mp4box
still i wonder whats the sense of doing so?
SeeMoreDigital
3rd May 2004, 18:39
Originally posted by bond
...still i wonder whats the sense of doing so? Personally I would like to think that it would make Mpeg4 editing easier.... should anybody get round to creating some editing software....
Who knows it might even be useful to use elementary streams when muxing into other containers.
Well it's nice to dream!
Originally posted by RadicalEd
Hmm... the pins don't seem to connect. So much for that idea :p
You probably need to use the dump filter (dump.ax) that comes with graphedit (a sample directshow filter from DirectX SDK)
RadicalEd
5th May 2004, 20:54
Brilliant! http://www.animemusicvideos.org/phpBB/images/smiles/icon_eek.gif
http://misatokatsuragi.home.comcast.net/gasp.gif
It works. Tested out with skal's decoder.
SeeMoreDigital
6th May 2004, 09:48
Boo who... I want to do this too :(
But I don't understand how you did it. Can you please confirm what you did, for dummies lika me?
Cheers
stephanV
6th May 2004, 10:04
i think they just changed the 'file writer'-filter with the 'dump'-filter
so that would mean that all youd have to do is:
-render your media file in GraphEdit,
-remove all filters except the source filter and the splitter,
-add the dump-filter (its in the directshow-filters section) and give your file a name (preferably with extension),
-connect the dump-filter to te appropriate pin of the splitter.
-press play and wait till its finished writing
never tried this, but thats how it should work according to what ive read here :rolleyes:
good luck :)
RadicalEd
6th May 2004, 15:52
Originally posted by stephanV
i think they just changed the 'file writer'-filter with the 'dump'-filter
so that would mean that all youd have to do is:
-render your media file in GraphEdit,
-remove all filters except the source filter and the splitter,
-add the dump-filter (its in the directshow-filters section) and give your file a name (preferably with extension),
-connect the dump-filter to te appropriate pin of the splitter.
-press play and wait till its finished writing
never tried this, but thats how it should work according to what ive read here :rolleyes:
good luck :)
Exactly :D
elumo
11th May 2004, 16:12
(I apologize for this late report.)
Thank you very much for many ideas.
I could decode the XviD bitstream using QT player and sklmp4. I used mp4creator to convert to .mp4 file.
And using Graphedit, I could get the bitstream from .avi file. (I didn’t notice the dump filter, too.)
But, in a condition using combination of B-VOP and packed bitstream, there was the problem that the video file could not be decoded well. This problem is concerned with dummy frames called N-VOP, isn't it?
I tried to decode the .m4v file with b-frame and packed bitstream by xvid_decraw.exe, the output frames increased more than the input frames. The number of diffrence between input and output frames were equal to the number of bvops in the file. The increased frames is N-VOP, isn't it?
Although I saw the thread about x-card playback on this forum, this problem is too difficult to understand for me...
I will be investigating why the file cannot be decoded well. I would appreciate it if you could give me for your help.
Best regards,
elumo
mp4creator cant handle files with packed bitstream right, use 3ivx or mp4box instead for .mp4 muxing
SeeMoreDigital
11th May 2004, 20:28
Originally posted by bond
mp4creator cant handle files with packed bitstream right, use 3ivx or mp4box instead for .mp4 muxing Hi elumo,
Personally speaking, I can recommend using GraphEdit with 3ivX to do what you require.
Cheers
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.