PDA

View Full Version : Update needed for FLV splitter


clsid
22nd August 2007, 17:51
The guliverkli project (Media Player Classic, etc) contains a DirectShow source filter for FLV.

This filter works very well with the videos that can be found on the various video websites (youtube, etc).

Adobe has released a new beta version of their Flash player. New features include the ability to do fullscreen playback and also support for MP4 files.

There also seems to be a change to the FLV format. The following sample file does not play properly with the FLV splitter:
http://labs.adobe.com/technologies/flashplayer9/fullscreendemo/backcountry_bombshells_4min_HD_1500_96.flv
The video track is not recognized.

I am not sure what exactly is different about this file. It is possibly just a matter of some data in the file's header being different, like a tag or codecid that the FLV splitter is not yet able to process.

According to GSpot the file contains a FLV4 (=VP6) video track, which is normally already supported by the splitter.

Maybe one of the smart people here can figure it out.

I can build new binaries of the filter and also MPC if someone writes a patch.

Taurus
22nd August 2007, 18:43
Yeah,this is what I recognized on several clips too.
I thought my setup was burked and changed around almost everything that came to my mind, but no avail.
So it must be part of the splitter, as VP6 files play ok.
Only wrapped in the flv shell they are burked.(Only sound).

Moitah
22nd August 2007, 23:43
I think the structure of the FLV is fine, but the VP6 data stored inside is strange. It looks like the bytes that hold the width/height appear 2 bytes later than FLV Splitter expects. I hacked FLV Extract a bit to set the width/height in the extracted AVI correctly, and ffdshow is able to play the video a bit... you can make out the frames but it has weird colored blocks (like decoding a corrupt video) and eventually it crashes. I thought maybe there were just 2 extra bytes at the beginning of each frame so I had FLV Extract trim off the first 2 bytes, but then it doesn't play at all. I'm not sure...

clsid
23rd August 2007, 00:10
Maybe this is useful:
http://rubyforge.org/projects/flvtool2/
From what I have read, this tool can show lots of info about FLV files.


I tried playing the sample file with ffmpeg rev10141 (http://ffdshow.faireal.net/mirror/ffmpeg/ffmpeg.rev10141.7z). The video plays, but with lots of artifacts and it will eventually crash.


I found the Flash File Format Specification v8 here:
http://www.schnarff.com/file-formats/index.html

Moitah
23rd August 2007, 00:30
I changed the FourCC of the extracted AVI to VP62 and tried playing it with the On2 VP6 VFW codec and it plays perfectly (upside down of course). So, something about the VP6 bitstream is different that FLV Splitter and the decoder in ffdshow doesn't understand.

clsid
23rd August 2007, 00:47
How did you extract it to an .avi file?

Does that file play properly using the internal VP62 decoder in MPC? That is based on different code than ffmpeg/ffdshow.

Moitah
23rd August 2007, 00:54
I used a modified version of FLV Extract which has the width/height hard-coded instead of trying to parse it from the VP6 bitstream. I'll try it with MPC's VP6 decoder soon.

Moitah
23rd August 2007, 01:02
With MPC's internal VP6 decoder it doesn't play at all.

Moitah
23rd August 2007, 01:44
Okay, I think maybe it's just a feature of VP6 that wasn't tested with libavcodec's decoder. The first byte of the keyframes are 0x79, where they are normally 0x78 in VP6 FLVs. In libavcodec's vp6.c, this is how that bit is read:

int separated_coeff = buf[0] & 1;

So I guess this separated_coeff feature of the decoder wasn't tested or something. This would also explain why the width/height were shifted 2 bytes forward, a little bit later in the code is:

if (separated_coeff || !s->filter_header) {
coeff_offset = AV_RB16(buf+2) - 2;
buf += 2;
buf_size -= 2;
}

So, the only change that would have to be made to FLV Splitter is to look ahead 2 bytes from where it normally does to find the width/height if the LSB of the first byte is set. The rest of the problem is in the VP6 decoder.

Moitah
23rd August 2007, 02:54
I don't feel like installing the DirectX SDK so I can compile FLV Splitter, therefore this is untested, but I made similar changes to FLV Extract and it works fine. You can try replacing:

if((m_pFile->BitRead(16) & 0x80fe) != 0x0046) break;

In FLVSplitter.cpp with:

if (m_pFile->BitRead(1)) {
// Delta (inter) frame
break;
}
m_pFile->BitRead(6);
bool fSeparatedCoeff = !!m_pFile->BitRead(1);
m_pFile->BitRead(5);
int filterHeader = m_pFile->BitRead(2);
m_pFile->BitRead(1);
if (fSeparatedCoeff || !filterHeader) {
m_pFile->BitRead(16);
}

That should fix FLV Splitter being unable to determine the width/height. If you have On2's VP6 VFW codec installed you can test it. Just look down about 15 more lines for the FourCC '4VLF' and change it to '26PV'.

Do you know where to report the decoder bug? On ffmpeg-devel or what?

clsid
23rd August 2007, 15:00
Thanks for the code. I'll try it immediately.

http://ffmpeg.mplayerhq.hu/bugreports.html


Edit: your patch works great! Now just ffmpeg needs to be fixed.

Kurtnoise
24th August 2007, 10:10
clsid: could you upload the patched splitter somewhere ? thank you...:)

clsid
24th August 2007, 13:27
I will upload it later today and post a link in my patched MPC thread.

WeaponX
25th August 2007, 20:00
backcountry_bombshells_4min_HD_1500_96.flv crashes clsid's new mpc build (2007-08-24). It plays for 3 seconds then a message pops up saying "Media Player Classic has encountered a problem and needs to close..." It plays my other .flv files successfully with no problems. I'm using ffdshow tryouts beta 3 rev1324.

Anyone else has problems with the file using the new mpc build (2007-08-24)?

Moitah
25th August 2007, 20:06
The VP6 decoder in libavcodec has trouble with this file, that's why it's crashing. clsid said it crashes in a recent ffmpeg build, and I tried it in one of the VLC 0.9.0 nightlies which can't decode it properly either (corrupt looking frames).

clsid
25th August 2007, 22:14
This issue is listed on the ffmpeg issue tracker, so hopefully it will get fixed sometime soon.

shae
12th May 2008, 21:41
What is the latest/recommended DShow FLV splitter? I'm facing a similar yet different problem. Maybe it's not a splitter problem at all, I'm not entirely sure.

DShow players can play audio from FLVs, but not video.

MPC 6.4.9.1 plays also the video.

I tried the 2006/03/20 FLV splitter from guliverkli and another one from gabest which might be newer (v1.0.0.2 from 5/9/2007, not sure where I found it).

I'm using the ffdshow tryouts beta 4a (rev1723, 2007/12/24), VP* and FLV* decoding is enabled (both DS and VFW).

EDIT: Found the solution: guliverkli2 includes version 1.0.0.4 of the splitter. (What's "guliverkli" anyway? :)