Developers
Exposed Interfaces
Among with interfaces that are usual for DirectShow source filter (IBaseFilter, IFileSourceFilter, IAMFilterMiscFlags, ISpecifyPropertyPages
), filter exposes few other standard and custom interfaces. They are listed below. Not all methods of these interfaces are implemented. Unimplemented ones return E_NOIMPL
.
IAMMediaContent
Implemented methods:
get_Title
Returns video title. One line of the text.get_Description
Returns video description. Multi-line text.
Returned text is ready to use, i.e. there are no URL encoding, HTML entities or tags.
IAMNetworkStatus
Unsupported since version 2.0.
1.1.1-1.10
Implemented methods:
get_BufferingProgress
Filter uses it to report total downloading progress of all media streams. When optionDownloading the clip
is turned off (and thus no such info can be provided) or optionEnable buffering notification
is turned off, it will returnS_FALSE
and zero progress.
IAMOpenProgress
Implemented methods:
AbortOperation
Downloadding of the video page and subtitles, analysis and any other actions related to media file URLs retrieval (but not their download) are done inIFileSourceFilter::Load
method.AbortOperation
can be used to cancel this process. It does not take any action and returnsE_UNEXPECTED
at any other time except during theLoad
method.
ISupportedSites
1.4.3+
This interface provides info about supported sites and exposes the way to test whether particular URL is supported or not.
This is custom interface, detailed description can be found in the archive below.
IPropertyBag, IPropertyBag2
1.6.1+
Using these interfaces filter exposes additional metadata.
List of exposed fields:
Name | Description |
---|---|
title | Original video title on the site |
description | Video description on the site |
channel_title | The title of the channel to which belongs the video. In most cases this is display name of the user but not always: channels on Youtube may not be associated with a user. Also in case of Youtube this is a display name of the channel. I.e. it does not have to be unique so different channels can have the same display name |
channel_url | URL of the channel containing this video. Unlike channel_title , this URL is unique for each channel |
upload_date | Upload date in format YYYY-MM-DD |
view_count | Number of times that the video has been viewed |
thumbnail_url | URL to the video thumbnail |
like_count, dislike_count | Number of people who liked/disliked the video |
Note, since version 2.0 field dwHint
field of PROPBAG2
structure is unused.
Settings Overriding
Unsupported since version 2.0.
1.5-1.10
All quality-related settings and few other settings can be overridden. This can be done either by custom URL parameters or programmatically via IPropertyBag/IPropertyBag2 interfaces. The latter is available starting from version 1.8.2. If some parameter is presented using both ways, URL parameter takes precedence.
Value of URL parameter can be URL-encoded if need. Example of custom URL parameter (select 720p video):
https://youtube.com/watch?v=xXxxXXxxXxx&ys_video_resolution=720p
The same with IPropertyBag:
if (CComQIPtr<IPropertyBag> bag = filter) { CComVariant value("720p"); bag->Write(L"ys_video_resolution", &value); }
When using IPropertyBag/IPropertyBag2, configuration should be done before calling IFileSourceFilter::Load(). All values (including numeric ones) should be passed as strings.
All parameters reflect appropriate options in filter properties, no more, no less. All overridden options that was found are be reported in Log
(tab in the filter properties).
Below is complete list of parameters with mapping to appropriate option. If not stated explicitly, expected value is the same as in appropriate option from the filter properties. For check boxes expected values are 0 and 1 (unchecked and checked respectively).
URL param | Mapped option | Value |
---|---|---|
ys_show_in_systray | Show icon in system tray | |
ys_show_err_wnd | (v1.8+) Show error window when failed to open a clip | |
ys_video_resolution | Preferred video resolution | smallest / 144p / 240p / 360p / 480p / 720p / 1080p / 1440p / 2160p / 3072p / best |
ys_audio_bitrate | Preferred audio bitrate | auto / 32k / 64k / 128k / 192k / 256k / best |
ys_prefer_hfr | (v1.7+) Prefer high frame rate videos | |
ys_prefer_hdr | (v1.7+) Prefer high dynamic range videos | |
ys_prefer_3d | Prefer 3D videos | |
ys_subs_download | Download subtitles | Read note below |
ys_manual_select | Manual quality selection | never / always / hold_shift / hold_alt / hold_ctrl |
ys_ignore_formats | Formats to ignore | |
ys_formats_priority | Priority of formats | |
ys_format_over_quality | Format takes precedence over quality | |
ys_enable_dash | Enable Youtube DASH streams | |
ys_muxing_exceptions | Muxing exceptions | |
ys_audio_only | Audio-only output | |
ys_max_width | (v1.7+) Maximum width of the video | |
ys_analysis_strategy | Getting info about clip | fast / medium / precise |
ys_analysis_limit | Limit of the part size | |
ys_predownload | Downloading the clip | |
ys_notify_buffering | Enable buffering notification | |
ys_tmpdir_type | Temporary directory (type) | wintemp / custom |
ys_tmpdir_path | Temporary directory (path) | full path to the directory if ys_tmpdir_type=custom |
Download subtitles
Prior to version 1.6 i.e. prior to auto-translated subtitles support and precise subtitles selection it had three possible values: never, all, except_asr
. There all
means regular subtitles + ASR and except_asr
means only regular subtitles. In version 1.6 these values are still acceptable for back compatibility with exactly the same meaning i.e. auto-translated subtitles are not included in results.
Since 1.6 using this parameter can be specified any set of subtitles using next form:
sub1;sub2;sub3;...;subN
where subX has format type_num=lang_tag
.
Value of type_num | Meaning |
---|---|
0 | Regular subtitles |
1 | ASR |
2 | Auto-translated |
Values of lang_tag
are: special word _all
(match any subtitle of given type) or language code (ISO 639-1 or 639-2, lowercase) appended by optional script code (ISO 15924, first letter uppercase, the rest lowercase) and/or optional country code (ISO 3166-1 alpha-2 (uppercase) or numeric). Subtitle becomes selected if its language tag contains any of provided language tags. 'Contains' means substring match, case-sensitive i.e. using generic C function it would be NULL != strstr(original_lang_tag, param_lang_tag)
.
For example, to download all regular subtitles, never download ASR, download English and Chinese (Traditional) auto-translated subtitles this parameter would be:
2=en;0=_all;2=zh-Hant