Log in

View Full Version : Mencoder + XviD => not playable in Windows (SOLVED)


trep
18th January 2005, 15:18
Hello to all, and thanks for your work: I love XviD, I use it for encoding under Gnu/Linux, with mencoder, and I have no problems with it. The problems arise when I lend the encoded files to friends who unfortunately use Windows: all their players, except for VLC that uses its own codecs which it keeps in a separate directory, crash on my files.

I've done some research, and it seems a widespread and longstanding problem; yet the only solution I found (in a message in MPlayer's mailing lists) is "stop using XviD, use lavc instead" :angry: But I don't want to use lavc!

I'll try to give you all the details I can. I've upgraded to all the latest versions both of mencoder and XviD but the problem is still there. I'm using Mencoder 1.0pre6 with XviD 1.1.0-beta1 freshly compiled from source on a gnu-linux fedora 2 box.

My encoded files are played nicely on linux both with XviD 1.1.0-beta1, XviD 1.0.2 and ffmpeg's odivx codecs. They play fine on some standalone players. They mostly won't play under windows on any player except VLC :mad:. The player crashes or play only the sound, with no pictures.

I can provide a sample from an encoded home video, it's less than 400K, here:

http://mio.discoremoto.virgilio.it/trep/

select "bryan.avi" and click on "scarica" which means "download" in italian. This sample was encoded with the following xvid options:

-ovc xvid -xvidencopts bitrate=50:max_bframes=2:vhq=2:qpel: psnr:autoaspect: pass=1

I post it here and not on the linux forum because it's clearly a windows bug. Any hint I can pass to my friends using windows will be
apreciated: should they uninstall ffdshow maybe? Can ffdshow cause these problems? I don't have a windows machine, so I can't experiment with it.

Thanks again for your work, bye
Trep

mikeX
18th January 2005, 15:42
Can you be more specific regarding your friend's setup? What version of ffdshow is he using? Did he try installing an XviD build? If no, point him to http://www.koepi.org where he can find the latest build of XviD 1.1.0 beta1...
VLC is using libavcodec for MPEG-4 decoding, which is the basis of FFDshow as well...

trep
18th January 2005, 15:54
Originally posted by mikeX
Can you be more specific regarding your friend's setup? What version of ffdshow is he using?

Thanks for the reply mikeX - alas it's not just one friend, but almost every windows user on a board we use to exchange home experiments - and most of these users are annoyingly closed to the idea that something may be wrong on their machines, and very few are willing to cooperate with me on finding out what's causing the bug. What I do know is that it seems widespread.

One of them who's helping me said that the only difference he could see on GSpot between my file and another working XviD file is that mine had "XVID" as the four-cc, and the other had "xvid" :confused:

Also GSpot says:

DirectShow partially succeeded to play file. The actual text of the
error or warning is:

0x00040242: VFW_S_PARTIAL_RENDER - Some of the streams in this movie are
in an unsupported format.

The following combination of filters were used:

{C:\Programmi\eMule27c\Incoming\Tykka-sample.avi} (Audio Source)
{AVI Splitter} (Audio Splitter)
{MPEG Layer-3 Decoder} (Audio Decoder)
{MatrixMixer} (Audio Post-processor)
{Morgan Stream Switcher} (Audio Post-processor)
{Default DirectSound Device} (Audio Renderer)


Anyhow, if anyone has Windows and knows about these things please download the sample provided... thanks!

trep
18th January 2005, 16:04
My friend seems to have a point.
Here the header of my (NOT WORKING) XviD file

Type: vids FCC: XVID (44495658)
Flags: 0
Priority: 0 Language: 0
InitialFrames: 0
Rate: 2997/100 = 29.970
Start: 0 Len: 446
Suggested BufferSize: 1903
Quality 0
Sample size: 0

And here's the header of another (WORKING) XviD file:

Type: vids FCC: xvid (64697678)
Flags: 0
Priority: 0 Language: 0
InitialFrames: 0
Rate: 2997/125 = 23.976
Start: 0 Len: 126072
Suggested BufferSize: 63115
Quality 10000
Sample size: 0

As you see the four-cc's are different :confused:

I hope someone can understand what's going on... I'll take out my hex editor in the meantime :D

celtic_druid
18th January 2005, 16:30
bryan.avi plays fine here under win2k SP4. Both via XviD 1.1.0b1 (MPC and VDubMod) and ffdshow.

trep
18th January 2005, 16:34
Ok, I've manually hex-edited the file to the other four-cc, so now we have two sample:

bryan.avi Fourcc: XVID (44495658)

bryan2.avi Fourcc: xvid (64697678)

as long as linux is concerned the two files are the same. The numbers are just the hex codes for the two strings, backward as it's used.

trep
18th January 2005, 18:01
Well, the four-cc hypotesis proved wrong, it doesn't change anything, I had some replies and those who can't play one neihter can play the other :( Can Windows be so dumb?

mikeX
18th January 2005, 19:06
WinXP SP1a:
bryan.avi plays fine in Media Player Clasic with XviD 1.1.0 decoder.
FFDshow 28.9.2004 doesn't decode the 1st KeyFrame (missing?) using libavcodec. Using XviD 1 it's fine (since it uses xvidcore.dll anyway).
VLC plays fine.
Windows Media Player & mplayer2 (old windows media player) can't locate
an appropriate decompressor, although they can locate the XviD decoder
for other XviD files... that's kinda weird...
I didn't experience any crashes at all.
You can point the people at the board to http://sourceforge.net/projects/guliverkli to download Media Player Classic. It's light and simple (single file binary) and really small (1.3MB) but it hasn't been updated for quite a while (at least by
it's original developer... I think there is some ongoing effort by some other guys, you might wanna have a look at the appropriate thread in the Software Players Forum).

trep
18th January 2005, 19:26
Originally posted by mikeX
WinXP SP1a:
bryan.avi plays fine in Media Player Clasic with XviD 1.1.0 decoder.
[...]

Thanks both to you and Celtic Druid :)
I'll report back about these tips.

As now the main suspect seems to be some broken build of ffdshow if I understand it well? In XviD FAQ there's a hint about it:

Although FFDShow has more options, it is not based on the XviD project and may contain incompatibilities from time to time

When using ffdshow, try playing the file with different codec setting. Try playing it with XviD only, with ffdshow with XviD decoding, and with ffdshow doing the decoding. Ffdshow can't handle clips with packed bitstream and more than 1 consecutive b-frame properly.

trep
18th January 2005, 20:11
Ok, a friend tried using Media Player Classic and he writes to me:

MPC says this:

Stream 0
AVI Splitter

Media Type 0:
--------------------------
AM_MEDIA_TYPE:
majortype: MEDIATYPE_Video {73646976-0000-0010-8000-00AA00389B71}
subtype: Unknown GUID Name {44495658-0000-0010-8000-00AA00389B71}
formattype: TIME_FORMAT_NONE {00000000-0000-0000-0000-000000000000}
bFixedSizeSamples: 0
bTemporalCompression: 1
lSampleSize: 1
cbFormat: 0

BUT, if I go to "options" --> filters, and I check the built-in avi splitter... IT WORKS!!

So using MPC own avi-splitter works, using whatever the system default splitter is don't.
Anyone has a idea about what difference the avi-splitter might make? And what's the avi-splitter anyway? :confused:

mikeX
18th January 2005, 20:51
The AVI splitter is a small library that is used to extract video and/or audio from an .avi file, in order to feed them to the proper decoder for playback. Think of it as the first link in the .avi playback chain ;). If you wanted to play an .ogm file (Ogg Media) you would want an ogm splitter, etc, etc...
The problem is this: Windows comes bundled with it's own AVI splitter, hence it's ability to playback .avi files out of the box (where it fails for more recent multimedia container formats, such as .ogm, .mkv,.mp4, etc).
I think the problem with this splitter is that it can't handle the OpenDML extension to the AVI file format (which should be the one Mencoder uses).
You can find the alternative splitter Media Player Classic is using in the URL I mentioned (Avi Splitter). To install it, simply extract the file to a folder such as C:\WINDOWS (WINNT for w2k) or C:\WINDOWS\SYSTEM32, click "Run" from the Start Menu, and type: "regsvr32 avisplitter.ax" (without the quotes). You should get a success pop up message.
The file should play with Windows Media Player now as well...

jon.schaffer
18th January 2005, 23:16
Just to add the results of my test:
[Windows SP1]

Media Player Classic plays fine
BSPlayer displays: Unknown file format (XVID)
VirtualDub opens fine (just the B-frame error message for the first frame)
VLC Player 0.8.1 works fine
Windows Media Player: fails

• I then registered the alternative AVI splitter from Gabest:
BSPlayer still fails (only the sound works)
Windows Media Player 7 works

trep
19th January 2005, 09:06
Thanks again to all :)

This time MikeX's solution almost nailed the problem :)

As Jon.Schaffer said, BSplayer still refuses to work - I'll try to find out why, I'll report back here if something new turns out.

Still, I'd like to know more about why the "default" splitter fails with mencoder-encoded XviD files - this sounds like a bug somewhere. Anybody knows where should I report a bug like this (so to have some chance to be actually listened to :D )?

celtic_druid
19th January 2005, 11:52
I tried remuxing the file with VDubMod, mencoder (under windows) and AVIMuxGUI. Each time the file just behaved like the original.

Default splitter belongs to MS, so I guess any solution involving that is out.

ak
19th January 2005, 21:18
Dunno, if it's common practice to write locale to avi header, but replacing "en_US.UTF-8/LC_M" with 00 in hex editor made DS avi splitter happy.

trep
19th January 2005, 22:37
Originally posted by ak
Dunno, if it's common practice to write locale to avi header, but replacing "en_US.UTF-8/LC_M" with 00 in hex editor made DS avi splitter happy.

I'll try and report - if someone want to check it out the sample with the LOCALE edited out is in the usual place, named bryan_noLC.avi ;)

Thanks again to all! :)

jon.schaffer
19th January 2005, 22:55
[OFF TOPIC?]

As I said before, I registered Gabest's AVI splitter to test trep file... Now BSPlayer does not work anymore (unknown FourCC, for XviD as for DivX, Div3, etc.). I unregistered the Splitter, and BSPlayer still has problems ("Corrupted file... bla, bla") :confused:

Does someone (mikeX? :D) know how to re-install or re-register the default splitter correctly (as it seems there were trouble with it...)
[re-installing BSPlayer is - of course (!) - useless...]

Thanks

[/OFF TOPIC!]

Leak
19th January 2005, 23:16
Originally posted by jon.schaffer
Does someone (mikeX? :D) know how to re-install or re-register the default splitter correctly (as it seems there were trouble with it...)
[re-installing BSPlayer is - of course (!) - useless...]

Re-register quartz.dll in your System32 dir with regsvr32, like

cd \winnt\system32
regsvr32 quartz.dll

That should do the trick.

You can unregister the other one using

regsvr32 /u AviSplitter.ax

in the directory where AviSplitter.ax is.

np: Zorn - Sputnik (The City's Collapsing (But Not Tonight))

jon.schaffer
19th January 2005, 23:52
[My] Problem solved!

It wasn't Quartz.dll. It was Nero Decoder which took control without permission... However, thanks Leak for your kind answer!

trep
20th January 2005, 09:54
Originally posted by ak
Dunno, if it's common practice to write locale to avi header, but replacing "en_US.UTF-8/LC_M" with 00 in hex editor made DS avi splitter happy.

I'm waiting for more reports, but as now http://www.my-smileys.de/smileys2/thumbs.gifTHIS REALLY SEEMS TO WORK! http://www.my-smileys.de/smileys2/thumbs.gif

How can I let Linux XviD's developers know about it?
I think it should be trivial to let the locale's information out of the headers, and I think it's an XviD problem, and not a mencoder problem, because avi files don't have locale's infos in the header...

mikeX
20th January 2005, 13:28
transcode doesn't seem to write any locale info in the avi header. Mencoder (week old cvs) still does it though. I think that at most, it's a problem with mencoder's XviD export module (since choosing -ovc lavc I don't get any locale info in the header either), so I don't know if the XviD devs are responsible for it.
However you can try posting at the forums at http://www.xvid.org, or email the xvid development mailing list. You can also look for GomGom at #xvid (irc.freenode.net), he used to be the maintainer of the transcode/mencoder xvid export modules.

ak
20th January 2005, 14:34
Yeah I think it's better to file a bug at http://bugzilla.mplayerhq.hu/ or post at mplayer-cygwin or dev.

BTW I just found out ghex can dump to html, couldn't resist :)
http://4nykey.nm.ru/tmp/ffmpeg.html (an xvid avi created with ffmpeg)
http://4nykey.nm.ru/tmp/mencoder.html (mencoder)

trep
20th January 2005, 15:11
XviD forum are closed to new registrations :mad: I don't understand them.

I've posted a bug report @ "MPlayer-users: general support mailing list for questions related to MPlayer and bug reports", if this doesn't work I'll try bugzilla.

Thanks!

jon.schaffer
20th January 2005, 19:37
THIS REALLY SEEMS TO WORK!

Yes, bryan_noLC.avi works now even with BSPlayer...

trep
21st January 2005, 08:32
From MPlayer-users mailing list (http://mplayerhq.hu/pipermail/mplayer-users/2005-January/050940.html):

> So it seems that the default Windows avi-splitter filter can't handle the headers of
> XviD mencoder-encoded files because those headers contain a string with LOCALE
> information. In this picture you can see (in an hex-editor) the header of a
> XviD file

actually it is just some random crap, has nothing to do with locale...

[...]
> So it can't be so difficult to patch this "bug" (I don't know if it's in XviD or
> in Mencoder).

No, it's in windows ;-). It seems the avi-splitter tries to interpret
even parts of the BITMAPINFOHEADER structure that are not needed/make no
sense with this format (like size of palette).
I made MPlayer set all these to 0, please try latest CVS.

I'll try it soon, I'll let the forum know how it turns out :)

hob4bit
8th June 2006, 14:28
Hi, I have the same. When I use MPlayer 20060608 (latest) with
XvID 1.1.0. MY videos cannot play in WMP. They also don't work
in Virtual Dub 1.6.14 and Video Converter 7.1.

I have Xvid 1.1.0 codec for Windows and can play using Tmpegenc,
MPlayer 20050928 (win) and VLC (win). Is there soemthign funny
about AVIs produced by MPlayer? How do we patch the source as
described in this thread.

Thanks

trep
12th June 2006, 17:54
Hi Hob4bit,

as far as I know, at the time (more than a year ago) these messages were written mencoder was correctly patched. I made many files since then and they all worked nicely on windows. On the other hand, it's been some months since I last used it, so the bug may have crept in again. You should post about it in the mencoder mailing list - I'm out of this business at the moment.

In any case, you CAN fix the movies themselves. Here's how:

1) You will need an hex-editor: I don't use Windows, but I was informed from a reliable source that one of these free hex-editors will be enough for what we're trying to do:

ftp://ftp.sunet.se/pub/simtelnet/win95/editor/hexfre20.zip
http://www-physics.mps.ohio-state.edu/~prewett/hexedit/hexedit.exe

2) We are going to work on the .avi file, so if you are not 100% sure of what you're doing please do a backup copy of the file.

3) Open the avi file in the hex-editor. You will see something like this:

http://img99.exs.cx/img99/6775/hex18ln.jpg

Note the highlighted part: that's the junk that make Windows' avi-splitter stumble. We only have to delete it: to do that we overwrite that part with ASCII zeroes (not the character 0). After zeroing out the offending string, you should see something like this:

http://img99.exs.cx/img99/2844/hex26cm.jpg

4) Save the file. It will now work flawlessy. Ask in the forum if you have doubts ;).