Log in

View Full Version : LAV Filters - DirectShow Media Splitter and Decoders


Pages : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 [92] 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508

nevcairiel
11th August 2011, 10:28
AYUV output uses a "slow" algorithm, because its not a format natively supported by swscale.

Its a two step process, due to the requirement for dithering:
- Convert the 4:4:4 10bit to 4:4:4 8bit using swscale dithering
- Manually reorder the bytes to fit the AYUV layout, in pure C code, no optimizations yet

I haven't actually compared performance yet, but its certainly possible that this two step operation is much slower then using a one-step operation like YV12 or RGB32, which are natively supported by swscale.

I actually benchmarked this now:
Using a H264 4:4:4 10bit 1920x1080 movie, on a Core i7 2600K - in a debug build, release builds will be faster.

These times are *per frame*


Y410 (native) 7.5ms
AYUV 9.8ms
RGB32 20.8ms
YUY2 19.8ms
YV12 20.5ms
NV12 30.4ms


Granted, i just spent some time optimizing the AYUV/Y410 path before doing the measurements.
However, i do not see the higher processing requirements for AYUV.

These numbers show some interesting things, though. For example, it would be impossible to play this movie smoothly if it was 60fps, unless you renderer supports native 4:4:4 input. I am using a bicubic scaler for down-sampling the chroma, i'm sure the numbers for YUY2/YV12/NV12 would be alot lower if i switched to bilinear or even point scaling.

Also, swscale is not multi-threaded right now, but it could be in the future, so we'll see about that.
PS:
Why is there no planar 4:4:4 pixel format? That would be far more efficient then AYUV...

Edit:
Updated Y410 numbers after optimizing the path as well

clsid
11th August 2011, 15:10
Performance is better now with AYUV, but not yet good enough for smooth playback with EVR CP. Judging from your benchmark results, it is probably the mixer in MPC that is not liking AYUV very much.

clsid
11th August 2011, 15:12
Does it still stutter for you guys when you play AVI Files?
I does for me when i cut an MKV file with Direct Stream into an AVI file, and then play it, it stutter about all the time.
Maybe itīs a bug or unstable with that scenario, so thought it would be nice to tell about it:)
Keep up the Work Near Carrier, and i tried the Nightly Build by Underground aswell;)H.264 inside AVI stutters here as well. Seems to be a frame order problem.

nevcairiel
11th August 2011, 15:14
Performance is better now with AYUV, but not yet good enough for smooth playback with EVR CP. Judging from your benchmark results, it is probably the mixer in MPC that is not liking AYUV very much.

EVR-CP looks completely broken here with AYUV input. I don't think EVR-CP works much with AYUV at all.


H.264 inside AVI stutters here as well. Seems to be a frame order problem.
The H264 in AVI i tried works just fine. But in general, its not a recommended way to store H264.

clsid
11th August 2011, 15:24
You are right. Tested with a b0rked sample. Deleted now.

What exactly is broken for you with AYUV and EVR? Wrong colors? Here it is just the performance that sucks.

nevcairiel
11th August 2011, 15:41
I figured out why it was broken. Using "Half Floating Point Processing" causes AYUV to break, if i disable it it works. I also don't get any dropped frames on my system with the 24fps clip, but i have a high-end gamer GPU and a very fast CPU in this system. :p

clsid
11th August 2011, 15:55
I have a i7 2600K and a GTX570 here.
Just a few dropped frames on the BBB444p10.mkv sample. But the stats graph isn't smooth. Green line skyrockets, then drops back to normal, skyrockets again, etc.

nevcairiel
11th August 2011, 16:01
AYUV with "Force 10-bit Input" looks extra good.
http://images.gammatester.com/pics/db6c226b80fb614a2fe01fbf11bd1866.png

clsid
11th August 2011, 16:08
For those who appreciate modern art ... :P

The 10-bit and float stuff in current MPC is broken. Jan Willem is trying to fix that.

Mercury_22
11th August 2011, 18:16
I can't get thumbnail in WMP / WMC or Explorer using LAVSplitter & LAVVideo for OGV, FLV(H.263), WEBM (LAVSplitter with other decoder it's working for this one so it's a VP8 LAVVideo problem) files while using MPC-HC standalone or "official" (http://xiph.org/dshow/downloads/) splitters and decoders I can get thumbnail in WMP / WMC or Explorer

Can you please fix this?

Samples and reg files (http://www.multiupload.com/ATSL6EH0HN)

P.S. For this formats there's no need for any "media foundation hack" to be able to see thumbnails just the necessary registry

clsid
11th August 2011, 18:41
Here is just the reg tweak:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.flv\ShellEx\{BB2E617C-0920-11D1-9A0B-00C04FC2D6C1}]
@="{c5a40261-cd64-4ccf-84cb-c394da41d590}"

Many people like to have thumbnails, so it would be awesome if your filters would be compatible.

ffdshow's code might give some hints for the necessary workarounds. I don't think Explorer supports stuff like dynamic format change.

nevcairiel
11th August 2011, 18:43
I have no idea how thumbnails are generated in explorer or in WMP, and i really have no motivation to find out.
You cannot really debug explorer, its not like it behaves like any normal player.

If someone else wants to figure out why it isnt working - be my guest.

clsid
11th August 2011, 19:03
That sucks :(

Maybe if you get bored sometimes, you could have a look at TffdshowDecVideo.cpp. I suspect the allowOutChange stuff is relevant. There is also a workaround for powerpoint there that might be helpful.

mastrboy
11th August 2011, 19:47
If you get bored i rather you consider putting some work into mkv ordered chapters support ;)

Mercury_22
11th August 2011, 22:40
I have no idea how thumbnails are generated in explorer or in WMP, and i really have no motivation to find out.
You cannot really debug explorer, its not like it behaves like any normal player.

If someone else wants to figure out why it isnt working - be my guest.

Too bad ! :mad:
But I don't think MPC's or xiph's splitters and decoders are "doing" something special for thumbnails generation
Anyway if you'll find some free time at some point here is the source code for opencodecs_0.85.17777 (http://downloads.xiph.org/releases/oggdsf/opencodecs_0.85.17777_src.7z) too

nevcairiel
11th August 2011, 22:53
I did debug some, and it turns out the interface used to query for video frames does in fact not support the VIDEOINFOHEADER2 format - and thats the only one exposed by LAV Video at this time.
I may add support for VIDEOINFOHEADER (without the 2) in the future, maybe that allows grabbing frames already.

Reference: http://msdn.microsoft.com/en-us/library/dd390180(v=vs.85).aspx

Mercury_22
11th August 2011, 23:09
I did debug some, and it turns out the interface used to query for video frames does in fact not support the VIDEOINFOHEADER2 format - and thats the only one exposed by LAV Video at this time.
I may add support for VIDEOINFOHEADER (without the 2) in the future, maybe that allows grabbing frames already.

Reference: http://msdn.microsoft.com/en-us/library/dd390180(v=vs.85).aspx

I guess this apply to the VP8 / WEBM case (since it's working with other video decoder) but for OGV and FLV(H.263) it's something wrong with the splitter too cause even with other decoder (MPC's or xiph's ) it's not working :confused:

nevcairiel
11th August 2011, 23:10
The FLV works for me with LAV Splitter and ffdshow.
Note that on x64 windows you need to install the x64 filters for this to work in Explorer - but in WMP its still using the 32-bit, afaik.

Mercury_22
11th August 2011, 23:23
The FLV works for me with LAV Splitter and ffdshow.
Note that on x64 windows you need to install the x64 filters for this to work in Explorer - but in WMP its still using the 32-bit, afaik.

LAVSplitter with ffdshow works for me too for FLV(H.263)
So mpc's decoder it's working only with mpc's splitter :confused:

Well then only ogv has a problem in the splitter too

EDIT wrong again OGV it's working too with ffdshow

So you're right again :) it's just LAVVideo

CruNcher
12th August 2011, 07:15
LAVFilters-x86-git-fc7d418c13c0.7z (http://www.mediafire.com/?nv51696jut4o06v)

Your build fails with a lot of format playback resulting in a black screen @ for the Video playback (Lav Video) (tested VP6,Bink,Divx 3.1).
roytam1 his build is working

roytam1
12th August 2011, 07:56
my newer build: http://www.mediafire.com/file/5o0cg5hqy50n5d9/lavfilters-314a389af4a366a4cb00d0bc13695ae02b2130ee-win32.7z
China mirror http://u.115.com/file/dnhkfbi5

nevcairiel
12th August 2011, 09:57
LAVSplitter with ffdshow works for me too for FLV(H.263)
So mpc's decoder it's working only with mpc's splitter :confused:

Well then only ogv has a problem in the splitter too

EDIT wrong again OGV it's working too with ffdshow

So you're right again :) it's just LAVVideo

LAV Video now works for me as well, except on some H264 files, it appears to somehow fail on these, not sure why.

Mercury_22
12th August 2011, 10:45
LAV Video now works for me as well, except on some H264 files, it appears to somehow fail on these, not sure why.

AFAIK WMP / WMC & Explorer are using Media Foundation for H264 so unless you're disabling that (using CLSID's tool (http://forum.doom9.org/showthread.php?t=146910)) which I don't recommend due to some side effects
it's intriguing that it's working for you for some files :)
Anyway I can't test right now but I'll test this later although I'm sure it's working so once again :thanks: :thanks:

P.S. I guess this will make Lav Filters very popular in the codec packs now :p

clsid
12th August 2011, 13:59
Thanks for the VIH1 support!

The preferred filter settings of Win7 apply to all basic DirectShow apps, including GraphStudio, Explorer, and WMP/MC. So by default LAV Video won't get used for H.264. Perhaps you could add an option to replace fourcc AVC1 with CCV1 like haali does. That option was added exactly for the purpose of bypassing the MS decoder without the need of special registry tweaks.

There are only two downsides I can think of (and that is why it should be optional):
- It only works with a few decoders: LAV, ffdshow, MPC, and CoreAVC. But that could be considered an upside as well ;)
- It might interfere with streaming video to XBOX360 (and trigger trancoding instead). Maybe someone can confirm this?

nevcairiel
12th August 2011, 14:11
I don't like that custom media type approach, and i won't be doing it.

Superb
12th August 2011, 14:17
AFAIK WMP / WMC & Explorer are using Media Foundation for H264 so unless you're disabling that (using CLSID's tool (http://forum.doom9.org/showthread.php?t=146910)) which I don't recommend due to some side effects
it's intriguing that it's working for you for some files :)
Anyway I can't test right now but I'll test this later although I'm sure it's working so once again :thanks: :thanks:

P.S. I guess this will make Lav Filters very popular in the codec packs now :p
WMP uses DirectShow. One can see it when using DirectShowSpy and connecting to the filter graph.

Mercury_22
12th August 2011, 14:23
WMP uses DirectShow. One can see it when using DirectShowSpy and connecting to the filter graph.

WMP12 (windows 7) for H.264 (for thumbnail ) ?

Also I've tested and I can confirm it's working, but not for any H264 in mkv, or flv or... (no tweaks to disable Media Foundation here)

clsid
12th August 2011, 14:31
Media Foundation and the preferred DirectShow filter list are two separate things.

clsid
12th August 2011, 19:18
This sample crashes swscale with RGB24 output:
http://x264.nl/developers/Dark_Shikari/BBB444p10.mkv

nevcairiel
12th August 2011, 19:23
The only crash i get there is in the ffdshow raw video filter when trying to feed RGB24 through it, but swscale processes it fine.

clsid
12th August 2011, 19:29
Happens here with this graph:
file > LAV video > Color Space Converter > Video renderer
(with only RGB24 enabled in LAV settings)

nevcairiel
12th August 2011, 19:31
No problem here with that setup.

roytam1
13th August 2011, 01:04
I can reproduce it here in XP SP3.
- Opening a file in GraphStudio
- remove the "Video Renderer" filter
- readd Video Renderer from [Graph]->[Insert Video Renderer]->[Video Renderer]
- reconnect Video Renderer with LAV Video (Its output format are all checked by default and I did't change it)
* Color Space Converter is magically inserted in the middle, In pin is MEDIASUBTYPE_RGB32, XForm Out pin is MEDIASUBTYPE_ARGB32.
- Click Play button, access violation occurs in quartz.dll (i.e. the Color Space Converter)

roytam1
13th August 2011, 02:40
And for RV20+SVT sample, I found a serious situation. If an overlay mixer(system's Overlay Mixer, Overlay Mixer2, etc.) is involved in the graph, such sample will fail to display correctly, regardless the aspect ratio.
http://i.imgur.com/gp8nw.png
and 1337player subtitle mixer is the overlay mixer here.
You can download 1337player here: http://www.daansystems.com/1337player/

nevcairiel
13th August 2011, 09:57
Its the overlay mixers fault, its incapable of properly changing the input format. The main problem is that the splitter claims the movie is 640x352, and the decoder corrects that to 320x352 - however the overlay mixer does not manage to deal with that, and still wants a 640 pixel wide image.
Overlay mixer is outdated, and i really have no plans to add alot of magics just for it. Use a modern player if you want to use my modern filters.

roytam1
13th August 2011, 10:20
Its the overlay mixers fault, its incapable of properly changing the input format. The main problem is that the splitter claims the movie is 640x352, and the decoder corrects that to 320x352 - however the overlay mixer does not manage to deal with that, and still wants a 640 pixel wide image.
Overlay mixer is outdated, and i really have no plans to add alot of magics just for it. Use a modern player if you want to use my modern filters.

THe problem is that DirectShow framework is a system-wide thing. Not only media player will use it, but also games, transcoders, screen recorders, etc.
Unlike ffdshow, which has white/blacklist to control who can use the decoder, and LAV Video's "weird" behavior that it tries to reconnect to the video renderer when the output size is changed, which leads to a stop of graph and returning a DirectShow error code 0x8004022a.
Such behavior can make some games get stuck in the opening movie.
I don't think correcting the output resolution by LAVVideo is wrong, but many DirectShow applications are unexpected in such behavior, simple DirectShow applications such as mplayer2 and amovie.ocx can demonstrate and not to mention the games.

nevcairiel
13th August 2011, 10:26
Its not weird behaviour to reconnect when output size changes, every decoder does that. How would it otherwise work? I have to let the renderer know that the image now has a different size, or very weird stuff will happen.

The only difference is that i will not start doing ugly hacks to support applications that should've been gone out of service 10 years ago. You want to use my filters, you better use a modern system to go with it.
I did however manage to fix the silly overlay mixer right now.

PS:
I cannot test "mplayer2" because its so old that its no longer present on my Windows. :p

PPS:
"System-wide" - many players allow using filters individually, and other tools are present to manage which filter is the preferred one on your system. If you absolutely have to use some broken software, set stuff up with that.

CruNcher
13th August 2011, 12:58
Nev no chance to get Lav Splitter working with Arcsofts Decoder for .ASF (sync), it's always funny how Cyberlink and Arcsoft stuff are interoperable with each other (Cyberlinks WMV Splitter (ff broken) + Arcsofts Decoder stays sync) (except they blocking each other for reason) but lav splitter sometimes doesn't fit in their dshow frameworks like with *.WMV . Though Cyberlink + Lav Splitter is currently very well working for .ts and H.264 at least, though their are scenarios especially when DXVA comes into play where Lav Cuvid is overall much better (non DXVA compliant streams) and others where it fails again (Deinterlacing).

nevcairiel
13th August 2011, 13:05
Wmv is way to unimportant to warrant much work. Stop watching cheap porn. :)

Use the WM ASF Reader.

CruNcher
13th August 2011, 13:15
I prefer Arcsofts ASF Reader instead though (but only because it's sync compared to lav Splitter, found no other issues so far) i dunno how the one in Vista/Win7 does, and only because 80% of all WMV content is Pron their is still stuff that isn't and devices that still use ASF and i don't use Pron for testing but WMV-HD Discs :D and i still prefer to directly play files for several reasons then to remux them all to .mkv which though slowly seems to be the only way to keep those for the future and editing in Open Source software.
It would be nice though to keep the dshow framework as sleek as possible and only use 3rd party stuff where it's absolutely (still) needed bugs aren't yet fixed (or other features missing) :)

nevcairiel
13th August 2011, 13:36
WM ASF Reader + LAV Video works fine for basically all WMV content.
So does WM ASF Reader + WMVideo Decoder DMO - not one 3rd party component. :) You have to remember, the Microsoft filters are the native decoders, everything else is third party.

CruNcher
13th August 2011, 13:47
The Problem in the combinations you mention is that WMV ASF Reader + WMVideo Decoder DMO doesn't support WMVA with DXVA but playbacks it only in Software @ least on XP (Microsoft seems to forgot it).
and LAV Video is Software only and Lav Cuvid doesn't work with WMV3 acceleration (only WVC1 and WMVA) and another Problem with Lav Video in those regards is that it doesn't separate any of the WMV parts but puts them into 1 package and so it takes the major state and flexible combination is almost impossible with MPC-HC.

nevcairiel
13th August 2011, 14:02
Hardware decoding for WMV3 is overrated - its such a simple format, any modern CPU can decode it without breaking a sweat. All the advanced features require advanced profile, which is only in VC-1

CruNcher
13th August 2011, 14:17
still there are less cycles used then using libav ;) and nope WMVA also uses them though Microsoft wish is they never released that intermediate to VC-1 AP ;) http://forum.doom9.org/showthread.php?t=112634


A: Indeed it did. Microsoft began working on its implementation of WMV AP before VC-1 spec was finalized. That codec (FourCC: WMVA) shipped with WMP10 (Format SDK 9.5), but as final changes to the VC-1 spec were made, WMVA got out of sync with the official spec. Today WMVA is no longer VC-1 compliant and is generally considered deprecated.

And this is the reason why in no decoder it should be put into a package but seperated if you want to have full flexibility of choice


A: Yes, it does. In order to differentiate it from SP/MP codec (FourCC: WMV3) and the non-VC1-compliant AP codec (FourCC: WMVA) and avoid issues with legacy decoders, the VC-1 compliant WMV9 Advanced Profile codec uses a new FourCC code: WVC1.

1 Scenario would be you want WMV3, WMVA and WVC1 Hardware Decoded and WMV1/2 Software via Lav Video that wouldn't be possible as marking the WMV checkbox in Lav Video would take over everything in certain cases if you have the other Decoder over it and prefered it's still fine but if you for a certain reason need a third one it gets problematic.
In this case ffdshow is the rescue as they have separated them accordingly :) WMV1/7, WMV2/8, WMV3/9, VC-1 (WVC1,WMVA), WMVP so here you just disable what you need don't need and want another decoder to be decoded and in the chain search it will easily fallback as it gets no connection and use the next decoder you have set (most importantly this also would work from a Generic dshow application like mplayer2.exe without any merrit prefer system so for example if you want to have a special transcoding chain not forced inside the application and a playback framework forced inside a application for example MPC-HC).

For example i want ffdshow to force WMV1/2 and everything else i want to force Arcsoft and for .ts i want to force Lav Cuvid (as it doesn't support WMV3) ;) i would put Lav Cuvid on the top enable VC-1 and down bellow ffdshow with only WMV1/2 enabled bellow (Software Fallback) than i put Arcsoft (it should switch for WMV3 inside ASF with DXVA, normaly it would force everything but as ffdshow is above it the chain will never reach it for WMV1/2) :)

You can see this example in action here http://forum.doom9.org/showpost.php?p=1518423&postcount=4516 <- it shows the great flexibility of dshow (in a managed enviroment).

So now it works by logic (you also have to put the Splitter in the correct order) and is switching depending on the connections it can do or cant with Lav Video that isn't possible yet as it would force everything to itself bellow Lav Cuvid.

roytam1
13th August 2011, 14:39
My nightly builds are now available here: http://roy.orz.hm/lavf-w32-nightlies/

nevcairiel
13th August 2011, 14:42
1 Scenario would be you want WMV3, WMVA and WVC1 Hardware Decoded and WMV1/2 Software via Lav Video that wouldn't be possible as marking the WMV checkbox in Lav Video would take over everything in certain cases even if you have the other Decoder over it and prefered. In this case ffdshow is the rescue as they have seperated them :) WMV1/7, WMV2/8, WMV3/9, VC-1 (WVC1,WMVA), WMVP

Just put the DXVA codec on a higher priority, then it'll get used, and if it refuses, fallback to the software decoder.

As a general rule, go from specific to general. That works in so many cases in life. :p

roytam1
13th August 2011, 14:57
Just put the DXVA codec on a higher priority, then it'll get used, and if it refuses, fallback to the software decoder.

As a general rule, go from specific to general. That works in so many cases in life. :p

For here, I'd prefer grouping RV30 and RV40 together, but not grouping RV1-3 together.
For RV1-2, binary decoder is still better than libavcodec at the moment.

nevcairiel
13th August 2011, 15:09
I changed the grouping to group WMV1/2 together and have a separate option for WMV3.
Also did RV1/2 and RV3/4. RV1/2 is disabled by default, while RV3/4 is active.

CruNcher
13th August 2011, 15:12
For here, I'd prefer grouping RV30 and RV40 together, but not grouping RV1-3 together.
For RV1-2, binary decoder is still better than libavcodec at the moment.

Yep exactly such scenarios VC-1 Interlaced would be another one or H.264 4:2:2 ;) not 4:4:4

nevcairiel
13th August 2011, 15:56
H264 4:2:2 is virtually non-existant, and ffmpeg is otherwise truely one of the best H264 decoders out there. I've been told ffmpeg will only get support for 4:2:2 if x264 supports encoding it one day.

LAV Video will now try to detect the interlace flag in the VC-1 sequence header and refuse connection if its found. Works fine for the samples i tried it on.