Subtitles and dxva (1 Viewer)

sonix1977nl

Portal Member
June 10, 2008
24
8
I have written a custom directshow source filter, which outputs an bitmap with alpha channel with the text "Hello world!" rendered in a subtitle kind of way. By connecting the decoder (MPCVideoDec with DXVA enabled) to pin 1 on the VMR9 filter and my custom filter on pin 2, I get that text rendered over the video. By both running with DXVA enabled and disabled and watching CPU usage, I can confirm that my method works in combination with DXVA enabled.

This could form the basic for a directshow filter that converts a subtitle stream into bitmaps with alpha channel with the subtitles rendered in those. That way we could have DXVA enabled and subtitles. Since it is a directshow filter, it could be used by many different players.
 

damaster

Portal Pro
November 23, 2007
412
35
Canada Canada
I have written a custom directshow source filter, which outputs an bitmap with alpha channel with the text "Hello world!" rendered in a subtitle kind of way. By connecting the decoder (MPCVideoDec with DXVA enabled) to pin 1 on the VMR9 filter and my custom filter on pin 2, I get that text rendered over the video. By both running with DXVA enabled and disabled and watching CPU usage, I can confirm that my method works in combination with DXVA enabled.

This could form the basic for a directshow filter that converts a subtitle stream into bitmaps with alpha channel with the subtitles rendered in those. That way we could have DXVA enabled and subtitles. Since it is a directshow filter, it could be used by many different players.
Incredibly awesome! I'm willing to test it out if you want. You've got a PM.
 

Johan

Portal Pro
April 19, 2006
443
11
44
Sweden Sweden
This is extremely good news! I have postponed my purchase of a new graphic card since I have no use of dxva if I can not have subs. My CPU is able to handle 720p files sort of (100% cpu load) but as soon as I add subs it gets out of sync.

I hope your effort will lead to some great things. Then I finally can get a new graphics card! :)
 

sonix1977nl

Portal Member
June 10, 2008
24
8
I have only tested it on Windows XP without EVR, since I currently dislike Vista for my development/gaming PC. ;) But don't get excited to early. It's a promising start. But I have no idea how hard it actually is to interpret the subtitle stream for example. So it probably will take some time, depending on my skills and how much time I can and am willing to put into it. I'll try to upload my sample + source code ASAP so that others can fiddle around with it.
 

Johan

Portal Pro
April 19, 2006
443
11
44
Sweden Sweden
I guess that you can use the source for interpreting the subs from others? FFDShow and Vobsub is opensource I think(?)

I am really looking forward for this filter. And I since it is a filter it can be used with all video softwares for PC and not only MP (I assume).
 

sonix1977nl

Portal Member
June 10, 2008
24
8
I'll have a look at them later. But I first have to see if I it is possible to get the source filter automatically render at the same resolution as the video file. After that I can actually have a look at the actual subtitles.
 

sonix1977nl

Portal Member
June 10, 2008
24
8
Unfortunately, for rendering many subtitle formats correctly, the subtitle renderer (like VobSub) seems to need information about resolution of the video and aspect ratio. These are normally only available from the decoder output, which is probably one of the reasons why VobSub connects on the decoder output pin. So I don't know how viable this approach is. :(
 

tourettes

Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    Unfortunately, for rendering many subtitle formats correctly, the subtitle renderer (like VobSub) seems to need information about resolution of the video and aspect ratio. These are normally only available from the decoder output, which is probably one of the reasons why VobSub connects on the decoder output pin. So I don't know how viable this approach is. :(
    You could add an interface to the filter that can be called from MP code (as MP knows the video resolution and aspect rate). Also I think the video renderer can be queried for such information (not 100% sure, but highly likely).
     

    sonix1977nl

    Portal Member
    June 10, 2008
    24
    8
    As far as I can tell, you can also get that info from the output pin on the splitter. But only one connection is possible from a pin, so maybe I need to make some kind of filter that repeats the input stream from a splitter to multiple output pins. Or have the subtitle filter do that. Somewhat like Vobsub, but with the difference that it is placed between the splitter and the decoder instead of the decoder and the renderer.

    If someone has some info about the things you suggested, I would be happy to hear about it.
     

    Users Who Are Viewing This Thread (Users: 0, Guests: 1)

    Top Bottom