1

I'm encoding video via IMFSinkWriter having multiple audio streams.

Question: Is there any way to set the target stream names so they are shown by players supporting this feature? For example, here is a screenshot of a capable player playing the encoded video with no stream names set.

Notes: I've been unable to find any documentation on this subject. Currently I'm writing to an MP4 container, but if this can be easily achieved with other containers supported by MF, don't hesitate to post your thoughts. Finally, the code will run in a UWP app, so WinRT limitations apply (e.g. no access to the underlying topology).

pastelix
  • 11
  • 2
  • 1
    Have you tried to set MF_SD_STREAM_NAME? https://learn.microsoft.com/en-us/windows/win32/medfound/mf-sd-stream-name – Simon Mourier Sep 23 '20 at 16:11
  • @Simon, yes, my first try was to set MF_SD_STREAM_NAME on the encoding attributes when calling AddStream, but that doesn't work (unsurprisingly). I tried many other stuff like getting access to the underlying stream and setting the attribute there, but nothing seems to work. Unfortunately there's no documentation available and google doesn't help much. Hopefully the ones who implemented the feature read this and shed some light. – pastelix Sep 23 '20 at 17:23
  • It's only on a stream descriptor. Do you have any reproducing sample? – Simon Mourier Sep 23 '20 at 17:37
  • Unfortunately not. However, as I said, this is more of a documentation issue. Indeed, descriptors are the usual mechanism to expose stream props at decoding time, but I don't think there's any API to set descriptors during encoding. – pastelix Sep 23 '20 at 18:17
  • @pastelix do you have a link for the WinRT IMFSinkWriter.AddStream API? I've only ever seen it exposed as Win32 and despite a fair bit of searching I couldn't locate it. – sipsorcery Sep 23 '20 at 21:02
  • https://learn.microsoft.com/en-us/windows/win32/api/mfreadwrite/nn-mfreadwrite-imfsinkwriter The API is supported in UWP (see at the bottom of the page) and it works great, except for the feature in this question. I'm using C++/CX.. Regarding encoding properties, I meant SetInputMediaType (sorry about the confusion, but that can't be the solution anyway). – pastelix Sep 24 '20 at 05:46
  • Here's a similar unanswered question: https://stackoverflow.com/questions/51033401/how-to-specify-language-list-object-in-windows-media-foundation-sdk This one is for the language attribute, but the solution should be similar for stream names. – pastelix Sep 24 '20 at 05:53
  • The question does not need WinRT mention. You should probably try language attribute `MF_SD_LANGUAGE` instead of stream name, as far as I remember some attribute worked for MP4s. Overall the question is not stated correctly: there is no universal attribute that does the thing for every container format: it actually depends on which attributes are effectively supported by the sinks participating in the pipeline. Event fragmented MP4 sink might have different behavior from MP4 sink. – Roman R. Sep 24 '20 at 07:33
  • WinRT is relevant because not everything is allowed in that environment (e.g. access to the underlying topology). FWIW, I also tried MF_SD_LANGUAGEE and got the same results. What you say it's true regarding the fact that not all containers support all attributes; however, I'm asking how to set stream names (which the MP4 container does support), starting from an IMFSinkWriter, under the limitations of WinRT. I think that correctly states my problem. – pastelix Sep 24 '20 at 10:23
  • My point is that WinRT MP4 sink is unlikely to be different from plain desktop sink. If you exclude WinRT from the question nothing would change. Also you don't show the code and I believe passing language has nothing to do with encoding parameters. And there are no descriptors there either. I think you should be looking for a media type attribute. – Roman R. Sep 24 '20 at 11:39
  • @Roman: Removing the WinRT tag might be a good idea to increase the audience, even though differences with desktop do exist (e.g. you can’t query any service from the underlying topology). Adding code to the question may also help increasing the target audience to those who would be willing to help by trial-and-error, just like I'm doing now. If I ever get there myself, I’ll certainly post the solution and the relevant code snippet here. However, I posted this question in the hope that someone having the actual knowledge would answer it :-). – pastelix Sep 24 '20 at 16:09
  • I had a quick look at stock media sink - I am under impression it does not support stream names or languages – Roman R. Sep 24 '20 at 21:38

0 Answers0