Humanitarian aid in Kharkov, Ukraine

My friend remains in Kharkov, Ukraine, the city experiencing ongoing shelling and destruction.

He is running a team of over 40 volunteers whose daily activity is delivery of food and medication to people throughout the city and villages around. They supply over 2000 people with essentials weekly.

Donations and funds to fuel the support are greatly appreciated, and are directly used for humanitarian aid. Please share the information, and I highly recommend these people to those who seek how to pass help directly to those helping civilians in hotspots.

I leave contact and other details below:

Continue reading →

Suspended (or closed?)

As my city of Kharkov, on the North-East of Ukraine, is attacked by MLRS and artillery, I am not really sure that I would want to continue when the fog of war is gone. Thanks everyone for reading over years!

True media of local events, “open in web” gets you the stream if you don’t use Telegram: https://t.me/truexanewsua Pictures and videos of military damage to civil infrastructure, which is happening right now.

Beyond the Possible

I am replaying a pretty much regular MPEG TS recording taken from air, just with a MPEG TS rollover condition inside.

  1. Microsoft Media Foundation – ? FAIL
  2. Microsoft Movies & TV Application – ? FAIL (obviously because of #1 above, but let me double this down)
  3. Media Player Classic MPC-HC – ? FAIL
  4. VLC – ? FAIL
  5. DirectShow with one commercial MPEG demultiplexer filter – ? FAIL
  6. GStreamer 1.18 – ? FAIL

Oh, come on! Anyone? The recording is absolutely known to be one hundred percent valid!

Sounds like we have a new industry standard.

Microsoft Media Foundation drops sample times at MPEG TS rollover at 30.000s on audio leg, but not on video.

YouTube video contains content… blocked on copyright grounds

Previous post embedded a video clip, hosted by YouTube, with a 37 seconds recording of Microsoft Edge window playing another YouTube clip. The video clearly showed UI part of browser and YouTube web page besides the video. Audio was a re-encoded re-capture of playback audio, however obviously matching algorithm would do a positive here because audio was captured excellently. The clip itself had a link to original content in the description & also linked blog post. Essentially, the 37s fragment of 205s song displayed that capture and recording of a separate window using OS API and tooling produces a decent MP4 file.

Then this happened:

After a manual review, a copyright owner has claimed some material in your video.

As a result, your video has been blocked, and can no longer be played on YouTube.

This is not a copyright strike. This claim does not affect your account status.

Video title: DxgiTakeWindowSnapshot’s WGC & Loopback Audio Recording

So it is a copyright infringement nowadays to show a screen-rip of half a minute trim of playback of 1/6th of music video with clear indication of source and purpose, and MANUAL REVIEWER confirmed that.

But okay, the song is rather good.

DxgiTakeWindowSnapshot & Window Recording w/ Audio

I am sometimes using a rework of earlier DxgiTakeSnapshot application for one specific purpose mentioned below. In addition to Desktop Duplication API, recent version of Windows offer a similar (in sense of acquisition of external video content) API: Windows.Graphics.Capture (hereinafter “WGC”), and the new rework is using this API to capture visual content as a snapshot or, now, as a video stream.

I will skip the technical details and just link Robert Mikhayelyan’s Win32CaptureSample project on GitHub, which is perhaps the best place to ask questions about this new API.

The today’s application takes a snapshot of given monitor, window or process windows (each window separately) similar to original DxgiTakeSnapshot application, and this might be worth a separate post, but at this time I just wanted to mention an quick hack with -Video command line argument.

The hack uses the API along with taking audio currently played and records the audiovisual stream into MP4 file until you stop it with Control+Break.

For example, this way I recorded video below by recording browser window with YouTube playback. I started the app first to quickly identify HWND of interest.

C:\>DxgiTakeWindowSnapshot.exe -Process msedge.exe
DxgiTakeWindowSnapshot.exe 20210717.1-16-g34e6c97 (Release)
34e6c972dad5568347d44e58ab0338b7daa1dba7
HEAD -> video, origin/video
2021-11-20 21:07:46 +0200
--
Found process 023228 "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
Found 2 windows for process 023228
Trying to capture window 0x0000000000A608E0, Filatov & Karas - ????? ? ?????? (Live @????????? ) - YouTube - Personal - Microsoft??? Edge
Trying to capture window 0x00000000016D066E, Filatov & Karas - Don???t Be So Shy (RuSongTV - Turkey) - YouTube and 3 more pages - Personal - Microsoft??? Edge
Found process 013944 "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
Found 0 windows for process 013944

C:\>DxgiTakeWindowSnapshot.exe -Window 0x0000000000A608E0 -Video
DxgiTakeWindowSnapshot.exe 20210717.1-16-g34e6c97 (Release)
34e6c972dad5568347d44e58ab0338b7daa1dba7
HEAD -> video, origin/video
2021-11-20 21:07:46 +0200
--
Trying to capture window 0x0000000000A608E0, Filatov & Karas - ????? ? ?????? (Live @????????? ) - YouTube - Personal - Microsoft??? Edge
Stopping: CTRL_C_EVENT

(see next post on why video below is blocked here)

Original content: Filatov & Karas – ????? ? ?????? (Live @????????? )

The application is currently hardcoding produced video as 1920×1080@60 with 10 MBps bitrate, and is subject to certain limitations because of quick and hacky implementation:

  • as mentioned, 1920×1080@60 with 10 MBps video bitrate (& max documented bitrate for stock AAC audio encoder)
  • video might be letterboxed to preserve aspect ratio (default behavior of Media Foundation XVP)
  • compatible Media Foundation video encoder which is expected to be discoverable as default (hardware encoding is used as designed)
  • a pretty much regular audio device expected, certain not so usual settings like 5.1 audio as shared format are likely to cause exceptions
  • the application picks default multimedia audio device for recording (actual code line is auto const Device = DefaultAudioEndpoint(eRender, eMultimedia);)

So that one specific purpose the application is good for is meeting recording: record a window with Google Meet session, Microsoft Teams or alike and you have a convenient copy of content for review or share.

As of now the application is recording only audio playback device, but not the microphone – I will reach this some time later.

If you want something more convenient, there is also Robert’s Simple Screen Recorder in Windows Store, however this will be video only yet with source code on GitHub.

DxgiTakeWindowSnapshot uses Media Foundation in old-school way: it creates a Microsoft Media Foundation Media Session pipeline with a few custom primitives and some stock ones, esp. video encoder, video processor and audio encoder it takes all this stuff off to record media…

Download links

Binaries:

Virtual Camera API in Windows 11 (Build 22000)

There is a new API coming with Windows 11. Finally we will get well defined way to register virtual cameras (perhaps for applications built against Windows Media Foundation API, not DirectShow): MFCreateVirtualCamera.

Creates a virtual camera object which can be used by the caller to register, unregister, or remove the virtual camera from the system.

Frame server reference is a good sign and suggests that an application might be able to register its own implementation, then system wide service would act as a proxy and expose the implementation to video capture applciations built to work with cameras.

MFVirtualCameraType_SoftwareCameraSource “The virtual camera is a software camera source.”

There already is a sample on GitHub for this API: Windows-Camera/Samples/VirtualCamera at master ยท microsoft/Windows-Camera (github.com)

Some other interesting things are also coming, e.g. “virtual audio device that supports audio loopback based on a process ID instead of the device interface path of a physical audio device” (AUDIOCLIENT_ACTIVATION_TYPE_PROCESS_LOOPBACK and friends). We will be able to re-capture individual process audio, whcih is a cool new one, but keep patience: new stuff is scheduled for Windows 10 Build 20348.