View Full Version : LAV Filters - DirectShow Media Splitter and Decoders
nevcairiel
20th August 2010, 16:03
The readme mentions that it is needed to uninstall Haali. That is actually not needed at all. Simply use this registry key to enable use of LAVFSplitter:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Media Type\Extensions\.mkv]
"Source Filter"="{B98D13E7-55DB-4385-A33D-09FD1BA26338}"
I didn't want to do this, because it would result in the same shit that Haali is doing, and overriding any merit decisions the filter manager trys to do. It forces it to be used, which i don't really like.
I tried to set the registration process to delete those keys, but apparently that didn't work (yet)
May I suggest to enable runtime CPU detect and not force compilation for a specific CPU type. The filter currently does not work on older CPUs.
I've had it on for 0.1-0.4, but disabled it for 0.5. There isn't any asm code in the demuxers, and the compiler flags are set for cpus that at least have SSE, which should be reasonable. Runtime CPU detect only works for the inline asm functions in ffmpeg, which don't really exist in avformat, afaik.
On what system did it fail for you?
If its really an issue for many people i could turn SSE off as well, but SSE introduces a new floating point calculator, and optimized memcpy/memmove, which it uses quite alot to shuffle the data around.
clsid
20th August 2010, 18:35
It does delete that key during registration.
One reason why I personally like that key is because it allows to specify the desired splitters for specific file extensions. That's particularly useful when there are multiple splitters installed. It gives more freedom than the merit system alone.
It failed on an old Athlon CPU that hasn't got SSE. Such old systems are not very common anymore, so I can understand if you don't want to support them. I was just asking in case there was little performance difference.
nevcairiel
20th August 2010, 18:40
One reason why I personally like that key is because it allows to specify the desired splitters for specific file extensions. That's particularly useful when there are multiple splitters installed. It gives more freedom than the merit system alone.
I can probably do this with an installer at some point, so the user has a choice during installation. Can't really ask the users wishes with regsvr32 call, can i. :)
Underground78
20th August 2010, 19:07
I setup a google code project. Even though it doesn't support Git right now, i like their bug tracking and overall design. Maybe they'll add Git eventually, until then, Code stays on my own server. ;)
Please report your issues on the project page, thanks!
http://code.google.com/p/lavfsplitter/issues/list
Oh, i already posted some issues that i had on my list, so please check for duplicates before posting! =)
Good, it will make reporting easier ! Does reporting issues about TS File is useful even if it is not your priority ?
nevcairiel
20th August 2010, 19:19
As long as its not duration related, sure.
LloydA
21st August 2010, 06:46
I setup a google code project. Even though it doesn't support Git right now, i like their bug tracking and overall design. Maybe they'll add Git eventually, until then, Code stays on my own server. ;)
Please report your issues on the project page, thanks!
http://code.google.com/p/lavfsplitter/issues/list
Oh, i already posted some issues that i had on my list, so please check for duplicates before posting! =)
Out of curiosity, why aren't you using GitHub? It has all the features of Google Code, and then some more. It's free for open-source projects, has notification hooks for all popular services, issue-tracking, wiki for documentation, web-based editing when you're on the road, and much more.
nevcairiel
21st August 2010, 06:47
Out of curiosity, why aren't you using GitHub? It has all the features of Google Code, and then some more. It's free for open-source projects, has notification hooks for all popular services, issue-tracking, wiki for documentation, web-based editing when you're on the road, and much more.
I don't like their bug tracker. Its too simple. And google has the advantage that most people already have an account there, so its easier for everyone to report and respond to bugs.
LloydA
21st August 2010, 07:15
I don't like their bug tracker. Its too simple.
Many don't know this, but with the "Labels" feature of GitHub you can assign "Type", "Status" and "Priority" metrics just like in Google Code, with the added flexibility that you can define infinitely more steps. What else do you miss in GitHub?
And google has the advantage that most people already have an account there, so its easier for everyone to report and respond to bugs.
Many people, myself included, have separate accounts for different activities with Google services, so in all likelihood you'd have to switch your Google account when using the Issue tracker. So it doesn't make much of a difference having Yet Another Account for GitHub. Plus, signing up there is really quick.
But fair enough. I hope you'll review your decision down the road, GitHub makes collaborative work much easier and less painful when you look at the whole feature set. :)
nevcairiel
21st August 2010, 07:21
Has GitHub proper bugtracker repository integration? Like, i include the bug number in the commit message, and the commit shows up in the associated bug?
LloydA
21st August 2010, 07:44
Yes, and the issue/bug will also auto-link to the commit, and the commit will auto-link to the issue. Example: http://github.com/dbloete/ioctocat/issues/issue/20 (not mine)
nevcairiel
21st August 2010, 10:07
Since someone else also advocated for GitHub, i moved everything there before too many people find the gcode project.
You can find the project now on GitHub: http://github.com/Nevcairiel/LAVFSplitter
Please also report issues there, thanks!
Once again i copied the bugs from the gcode project over, in addition to the bugs i filled myself from feedback in this thread.
nevcairiel
21st August 2010, 20:00
Good news, i think i found a solution to the stuttering-at-startup problem. I'm not 100% sure its the right thing to do, but it seems like a sane change, so i guess we'll see in the next version how it behaves.
I also found some serious memory leaks that could've easily caused the crash issues people have been reporting, so i'm looking forward to feedback for 0.6, which will be out tomorrow i guess, still some things to fix =)
Sebastiii
21st August 2010, 23:13
Thank you :) great news need to give a try :)
Seb.
XhmikosR
22nd August 2010, 10:51
Does anybody know why the splitter cannot be registered with Inno Setup? Using a simple script like this (http://xhmikosr.1f0.de/patches/lavfsplitter/LAVFSplitter.iss) fails with a RegSvr32 failed with exit code 0x3 message.
Anyone?
EDIT: Never mind, just tried it with the latest git and it successfully registers. :)
Underground78
22nd August 2010, 15:12
Compiling
=============================
Compiling is pretty straight forward using VC++2010 (included project files).
It does, however, require that you build your own ffmpeg.
You need to place the full ffmpeg package in a directory called "ffmpeg" in the
main source directory (the directory this file was in). There are scripts to
build a proper ffmpeg included.
I recommend using my fork of ffmpeg, as it includes additional patches for
media compatibility:
http://git.1f0.de/gitweb?p=ffmpeg.git;a=summary
I am probably doing something wrong but I fail building ffmpeg lib ... In fact, "lib.exe" is not found and I do not know how to get it. I have found one "lib.exe" in "Microsoft Visual Studio 10.0\VC\bin" but it looks like it not the good one.
:thanks:
nevcairiel
22nd August 2010, 15:14
You need to add that the folder where the lib.exe is in into your path, obviously.
There is a batch file that should do that for you and start building
http://xhmikosr.1f0.de/patches/lavfsplitter/build.bat
Underground78
22nd August 2010, 15:26
Using vcvars32.bat has solved the problem. I previously had added "...\Microsoft Visual Studio 10.0\VC\bin" in the path but it was not sufficient. Thanks !
rack04
22nd August 2010, 18:22
Can someone please explain how to use this splitter with MPC-HC. Haali keeps being used even though I have set it to block in MPC-HC external filters and LAVFsplitter as preferred.
nevcairiel
22nd August 2010, 18:41
Haali is a bit stupid, you need to unregister (=uninstall) it, or it'll always be preferred. I have yet to find a easy way to disable its "always preferred"-ness..
rack04
22nd August 2010, 18:57
Haali is a bit stupid, you need to unregister (=uninstall) it, or it'll always be preferred. I have yet to find a easy way to disable its "always preferred"-ness..
Thanks for the information. When playing a file in MPC-HC how can I verify that the LAVFSplitter is being used?
Underground78
22nd August 2010, 19:39
Thanks for the information. When playing a file in MPC-HC how can I verify that the LAVFSplitter is being used?
Right click during playback, then go into Filters submenu and find the lastest entry, click on Properties, if it starts by "Filter : lavf dshow source filter" then it is really LAVFSplitter which is used.
nevcairiel
22nd August 2010, 20:42
LAVFSplitter 0.6
- Added support for E-AC3
- Fixed MPEG2 Media Types
- Added support for RealVideo in MKV
- Set proper aspect ratio in media type
- Fixed memory leaks in packet handling code
- Unicode support for stream names
- Threading changes for more fluid playback at startup
- Changed Flushing behaviour that solves a conflict with the MS DTV-DVD Decoder
- Better support for Vorbis audio
- Registers for the OGG Container Format
Download: 32-bit (http://files.1f0.de/lavf/LAVFSplitter-0.6.zip) & 64-bit (http://files.1f0.de/lavf/LAVFSplitter-0.6-x64.zip)
Note: The filename of the filter has changed, so you'll need to re-register it. This will also register it for the OGG format, which seems to work pretty good so far.
Please test! The stuttering on startup should be much better now, and hopefully some of the crash issues fixed.
Additionally i patched MPC-HC to properly forward Media Type changes on subtitles to downstream filters, this will require at least MPC-HC rev. 2298 to work properly if you use ffdshow for subtitles.
ffdshow was also updated to properly handle UTF-8 subtitles send by LAVFSplitter, this is in ffdshow rev. 3537. Please make sure to have both these components updated to at least these revisions before reporting subtitle related issues, thanks!
Underground78
22nd August 2010, 20:43
Thanks ! :)
I have been playing with the code today and I wonder why you choose to use avg_frame_rate rather than r_frame_rate ?
I have few samples (TS File mostly) whose frame rate was incorrectly detected by LAVFSplitter but not by VLC and mplayer. I saw that r_frame_rate was correct so I had a look to VLC and mplayer source code and they do use r_frame_rate rather than avg_frame_rate. I modified a bit the code (http://pastebin.org/727131) to do more testing and so far all the samples I have tested have worked.
Also I have been tracking down a bug with incorrect aspect ratio with some TS file but it is highly strange, ffprobe does detect the AR correctly but using a debug build of LAVFSplitter I see that the aspect ratio is not detected. I use ffprobe compiled at the same time than the libs used by the splitter and looking at ffprobe code I can't see why it does not work.
nevcairiel
22nd August 2010, 20:50
r_frame_rate was set to 24.000 fps on some 23.976 movies, which seemed a bit weird, and avg_frame_rate contained the proper rates.
I can change it back if avg_frame_rate is broken in many cases.
Underground78
22nd August 2010, 21:21
r_frame_rate was always set to 24.000 fps on 23.976 movies, which seemed a bit weird, and avg_frame_rate contained the proper rates.
I can change it back if avg_frame_rate is broken in many cases.
I tried some 23.976 movies and it works so I don't know what is best ...
About the aspect ratio problem, looking at VLC and mplayer, it seems something like this could make sense :
diff --git a/src/Demuxers/LAVFGuidHelper.cpp b/src/Demuxers/LAVFGuidHelper.cpp
index 06dae3d..ddfa505 100644
--- a/src/Demuxers/LAVFGuidHelper.cpp
+++ b/src/Demuxers/LAVFGuidHelper.cpp
@@ -311,11 +311,17 @@ VIDEOINFOHEADER2 *CLAVFGuidHelper::CreateVIH2(const AVStream* avstream, ULONG *s
// Calculate aspect ratio
AVRational r = avstream->sample_aspect_ratio;
+ AVRational rc = avstream->codec->sample_aspect_ratio;
if (r.den > 0 && r.num > 0 && (r.den > 1 || r.num > 1)) {
int num = 0, den = 0;
av_reduce(&num, &den, (int64_t)r.num * vih->bmiHeader.biWidth, (int64_t)r.den * vih->bmiHeader.biHeight, 255);
vih2->dwPictAspectRatioX = num;
vih2->dwPictAspectRatioY = den;
+ } else if (rc.den > 0 && rc.num > 0 && (rc.den > 1 || rc.num > 1)) {
+ int num = 0, den = 0;
+ av_reduce(&num, &den, (int64_t)rc.num * vih->bmiHeader.biWidth, (int64_t)rc.den * vih->bmiHeader.biHeight, 255);
+ vih2->dwPictAspectRatioX = num;
+ vih2->dwPictAspectRatioY = den;
} else {
vih2->dwPictAspectRatioX = vih->bmiHeader.biWidth;
vih2->dwPictAspectRatioY = vih->bmiHeader.biHeight;
VLC always uses codec->sample_aspect_ratio and mplayer uses it as a fall-back if sample_aspect_ratio fails. It fixes some of the aspect ratio problems I have.
nevcairiel
22nd August 2010, 21:25
As a fallback looks good, i can surely add this.
Edit: Commited to Git
rack04
22nd August 2010, 21:49
MPC-HC_r2300
ffdshow_rev3540
LAVFSplitter 0.6
madVR 0.27
If I right click and select filters it shows:
Default DirectSound Device
madVR Renderer
ffdshow Audio Decoder
Audio - AC3, 5.1, 48000 Hz (libavcodec)
ffdshow Video Decoder
English (ac3, 48000 Hz, 5.1, s16, 640 kb/s)
Any idea why the Video Decoder is being listed as such?
nevcairiel
22nd August 2010, 21:50
Thats ffdshow being funny. Don't ask me why they show it there, but well, they just do.
I never understood why, and last time i asked i just got yelled at, go try your luck :p
As a quick note, don't use the ffdshow menu to change streams, it somehow makes everything break with the splitter.
STaRGaZeR
22nd August 2010, 21:50
Some limited testing with 0.6:
- MKVs with TrueHD tracks freeze, but the timer goes on.
- MKVs with subs start like before in the No subs option. However, if you turn them on, they'll be displayed ~5-15 secs, or even more, after they should. Seeking fixes the delay. You can see it with the Avatar sample I posted earlier, but it's a bit short.
- E-AC3 works fine.
- Stuttering at startup seems fixed :)
nevcairiel
22nd August 2010, 21:57
- MKVs with subs start like before in the No subs option. However, if you turn them on, they'll be displayed ~5-15 secs, or even more, after they should. Seeking fixes the delay. You can see it with the Avatar sample I posted earlier, but it's a bit short.
I noticed the delay too, but i thought i only saw it with the MPC-HC internal renderer. Anyhow, not sure what is causing this, will try to debug it later.
STaRGaZeR
23rd August 2010, 00:02
These two issues didn't happen with 0.5, so it has to be something in between the two versions.
nevcairiel
23rd August 2010, 07:13
These two issues didn't happen with 0.5, so it has to be something in between the two versions.
Thanks, i have an idea what to look for then. :)
hoborg
23rd August 2010, 12:58
Looks like 0.6 fixed a lot of issues, good work!
This time i tested some simple audio formats - *.MP3, *.FLAC, *.DTS, *.OGG, and various audio in MKV kontainer (*.MKA). All formats create correct graph, but if i hit play, Graphstudio crash (all formats).
nevcairiel
23rd August 2010, 13:00
Files without video?
I'm not sure i fixed playing files without a video stream yet, i'll put it on the list, thanks for testing =)
hoborg
23rd August 2010, 13:01
Files without video?
Yes, audio only.
nevcairiel
23rd August 2010, 13:06
I suppose i can add their media types as well when i fixed that, eh.
hubblec4
23rd August 2010, 16:17
i miss a trayicon in the toolbar to change the audio,- or subtitlestreams like in the haali splitter.
is it possible to get this feature in future?
liquidskin76
23rd August 2010, 16:25
- MKVs with TrueHD tracks freeze, but the timer goes on.
I see something similar, in that TrueHD movies stutter like mad.
The good news is that the stuttering at the start of other vids has gone!
Thanks nev for your hard work.
nevcairiel
23rd August 2010, 16:41
Yeah, i see that TrueHD issue. Not sure whats up with that. The other splitters i looked at just treat it as normal AC3 and it works just fine. I'll debug more. :)
nevcairiel
23rd August 2010, 17:17
I fixed a bug that caused my TrueHD sample to not play at all (and probably some other streams as well), but turns out the bitstream must be broken somehow, when decoded its full of artifacts.
Mine was from a retail bluray, so it could just be the TS demuxer being broken again. I should remux a short sample into mkv or find one to test with.
STaRGaZeR
23rd August 2010, 17:22
My files are BDs remuxed to MKV, and they were fine with 0.5, maybe the changes you made to the buffers?
nevcairiel
23rd August 2010, 17:43
Some other change i did could've already fixed that. But i am still looking for a quick sample to verify that is not ts/m2ts, just to be sure.
Turns out, remuxing a m2ts file is not done with 3 clicks, i have to download several tools =( I never really cared for remuxing things before.. meh
STaRGaZeR
23rd August 2010, 17:53
eac3to + mkvmerge is where the beacon is, eac3to from the command line (with scripts to make things easy if you don't want to type the stuff all the time) and then mkvmerge it's not 3 clicks, maybe 10 or so :p
hubblec4
23rd August 2010, 18:27
eac3to + mkvmerge is where the beacon is, eac3to from the command line (with scripts to make things easy if you don't want to type the stuff all the time) and then mkvmerge it's not 3 clicks, maybe 10 or so :p
thats right.
bluray to mkv is an easy job and you have the best quallity.
for the most of movies i use this way.
nevcairiel
23rd August 2010, 18:51
Good news: I found the change thats causing TrueHD to break.
Bad news: Its the change that was meant to fix the stutter issue =(
I'll dig into that, i guess.
Edit:
After reverting the old "fix" i still don't see the stuttering issue. Possible another change i did also fixed it. I even increased the number of buffers to some incredibly high amount, and they slowly filled up.
So i'll keep the fix disabled and release a new version for testing, maybe i was just too blind to see it!
PS:
git bisect ftw
nevcairiel
23rd August 2010, 19:20
LAVFSplitter 0.7
- Further improvements to aspect ratio detection
- Restore old FPS detection
- Adjusted flushing to fix subtitle delays
- Reverted a timing change that broke TrueHD
Download: 32-bit (http://files.1f0.de/lavf/LAVFSplitter-0.7.zip) & 64-bit (http://files.1f0.de/lavf/LAVFSplitter-0.7-x64.zip)
Please pay attention to the stuttering problem, it may be back in this version. The fix i previously applied completly broke TrueHD playback, but i couldn't reproduce the issue anymore, so maybe one of the other optimizations fixed it too.
I didn't work on the other things i wanted to get done because i want feedback on the stuttering thing as soon as possible.
So next version will have new features again. :)
STaRGaZeR
23rd August 2010, 20:22
I don't get any stuttering with 0.7, TrueHD and subtitle delay is fixed. Looks good :)
BTW, did you do anything to the SSA fonts? I get correct fonts in some files, but incorrect in others!
nevcairiel
23rd August 2010, 20:25
I don't think i could even do anything to change the fonts of SSA subs.
I think i changed the mediatype from SSA to ASS some time ago, if that changes anything.
I should patch up ffmpeg to differentiate between SSA and ASS, so its always the correct thing.
What exactly is the problem? Files with embedded fonts? Or system fonts that just don't get choosen correctly?
STaRGaZeR
23rd August 2010, 20:39
Files with embedded fonts, like that Haruhi sample.
I just noticed in one of your commits that ffdshow is not happy if you send TrueHD as TrueHD, can you PM me a build that sends it as TrueHD? Maybe I can debug it.
nevcairiel
23rd August 2010, 21:00
Its not only ffdshow, MPC-HC internal as well, but sure, i'll send it your way.
I just noticed that i can teach it to send 2 media types now, so it can always fall back to the AC3 media type if needed. =)
I send you a PM with the adjusted .ax, just take the av* dlls from 0.7
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.