Connecting Push Surce filter and MPEG2 Video Encoder in Directshow - directshow

I'm trying to encode raw video frames into mpeg2 video using MPEG2 Encoder in Directshow. Filter CLSID_CMPEG2EncoderVideoDS from file wmcodecdsp.h.
I've created my own push source filter which inject raw frame to the filter graph. The input frame format is RGB24. However my filter graph is failing when I'm trying to connect outpin of Push source filter to the input of MPEG2 video encoder.
The filter graph has following structure.
Push Source ---> MPEG2 Video Encoder ---->AVI Muxer--->Filer Write (container format .avi).
I found the actual cause of failure is due to mismatch of media format between output pin of Push filter and input pin of MPEG2 Encoder.
The media format for output pin of Push filter is
Formattype = FORMAT_VideoInfo.
Major Type = MEDIATYPE_Video.
Minor Type = MEDIASUBTYPE_RGB24.
cbformat = 88.
However the media format at input pin of MPEG2 Encoder is different for minor type and cbformat (basically the GUIDs are not matching). Is it possible to set media format for MPEG2 Encoder manually by using SetMediaFormat(). On MSDN site it is mentioned that MPEG2 Encoder support RGB24 input format.
I've tried my filter graph with other encoder like MJPEG compressor. It works fine.
Please share your thoughts.
Thanks and Regards
Pradeep

Related

What exactly is "bulk data" in WADO-RS standard?

[Referring to http://dicom.nema.org/medical/dicom/2016e/output/chtml/part18/sect_6.5.html]
When we are talking about WADO-RS, NEMA mentions that:
Every request (we'll leave out /metadata & /rendered requests for now) can have accept-type of three types:
1. multipart/related; type="application/dicom" [dcm-parameters]
------- (DICOM File format as mentioned in PS3.10)
2. multipart/related; type="application/octet-stream" [dcm-parameters]
------- (Bulk data)
3. multipart/related; type="{media-type}" [dcm-parameters]
------- (Bulk data)
For all these accept types, response is created as multipart with each part corresponding to a particular Instance. Now I understand the first case (application/dicom) in which we'll have fill each response part with each SOP Instance's .dcm counterpart. (for e.g., if the WADO RS is for a Study, then the multipart response will have one part for each SOP Instance's Dicom File Stream)
But when it comes to the bulk data I have few questions:
What exactly is bulk-data in WADO-RS standard? Is it only the 7FE00010 tag, or is it all the binary tags of an SOP Instance combined into one single binary data?
If it is just 7FE00010, then there will be one http response part each for every SOP Instance. Then how will the WADO-RS client come to know which bulk data is of which SOP Instance?
Information about this is limited on the internet. Hence asking here.
If any one has any article about this, that's welcome too.
Ps: I am new to DICOM/DICOMWeb
What I've generally used is to look at what's included (or should it be excluded?) in the Composite Instance Retrieve Without Bulk Data service class:
(7FE0,0010) Pixel Data
(7FE0,0008) Float Pixel Data
(7FE0,0009) Double Float Pixel Data
(0028,7FE0) Pixel Data Provider URL
(5600,0020) Spectroscopy Data
(60xx,3000) Overlay Data
(50xx,3000) Curve Data
(50xx,200C) Audio Sample Data
(0042,0011) Encapsulated Document
(5400,1010) Waveform Data (within a (5400,0100) Waveform Sequence)

Exporting AVI Videos from Adobe Flash CS6 using an automated script (JSFL)

I have a bunch of .fla CS6 files that I need to export to avi (after setting up the resolution, compression settings etc) manually. I am wondering if this can be achieved via a JSFL script or similar.
Appreciate the help.
Have a look the JSFL Reference: document.exportVideo() is what you're after:
from the docs:
Usage
exportVideo( fileURI [, convertInAdobeMediaEncoder] [,
[ transparent] [, stopAtFrame] [, stopAtFrameOrTime] )
Parameters
fileURI A string, expressed as a file:/// URI, that specifies the
fully qualified path to which the video is saved.
convertInAdobeMediaEncoder A boolen value that specifies whether or
not to send the recorded video to Adobe Media Encoder. The default
value is true, which sends the video to Adobe Media Encoder. This
parameter is optional.
transparent A boolean value that specifies
whether or not the background should be included in the video. The
default value is false, which includes the movie background in the
video. This parameter is optional. stopAtFrame A boolean value that
specifies whether the video should be recorded until it reaches a
certain frame or a specific time. The default value is true, stop when
a certain frame is reached. This parameter is optional.
stopAtFrameOrTime If stopAtFrame is true, this is an int specifying
the number of frames to record. If stopAtFrame is false, this is the
number of milliseconds to record. The default value is 0 which, if
stopAtFrame is true, will record all the frames in the main timeline.
This parameter is optional.
Returns Nothing.
Description Method;
exports a video from the document and optionally sends it to Adobe
Media Encoder to convert the video
Example
The following example illustrates the use of this method:
fl.getDocumentDOM().exportVideo("file:///C|/myProject/myVideo.mov");
I can't remember if that is in AVI format, however you should be able to convert the video. Setting the second parameter (convertInAdobeMediaEncoder) to true should send the video to Media Encoder for conversion, however it will be a lot less straight forward to automate that (very convoluted, but not impossible)
Alternatively I would recommend looking into exporting a PNG sequence that you can then convert to any video format you would like with ffmpeg or similar tools, baring in mind you could trigger the conversion process from JSFL (via FLfile.runCommandLine for example).
In short:
use the JSFL reference (e.g. document.exportVideo(), etc.)
prototype with a simple through away script and a short timeline
test/fix/clean/comment code for the full version of the script after all your questions are answered by prototypes

ASN.1 decoding of TCAP GSM messages

I'm trying to decode the TCAP GSM messages and wanted to undertand few things on the ASN.1 struct for few of the elements.
Wanted to understand what does the values in the rectangle brace [] indicate? (shown highlighted in the image above).
Here is the link to the ETS standard which I'm using to extract this info.
look page at 773 for more details.
Any help in making me understand the same is aprreciated.
It's a TAG number. You can read more about encoding of a TAG value here.
If you look at the insertSubscriberData structure you have imsi, msisdn and category of the same type (OCTET STRING) and all are optional. TAG number is necessary tool to distinguish what value was encoded because sender will not encode the value if it is null. When the decoder gets binary data and has to reconstruct the insertSubscriberData structure it needs to know if it is reading imsi, msisdn or category. Based on the tag number it knows what part of the structure it is.
While decoding the arguments of MAP sequence, you access the child elements of sequence using the tag values but bear in the mind that they do not have to be sequential, optional tags might not have been set by encoded party.
e.g. sample code using bounty castle
DLSequence sequence = (DLSequence)derTaggedObject.getObject();
for(int i =0; i < sequence.size(); i++){
DERTaggedObject seqElement = (DERTaggedObject)sequence.getObjectAt(i);
switch (seqElement.getTagNo()) {
case MSCRecordType:
TCAP and MAP ASN.1 module definitions can be found on this github page.

File extension for 'application/ole' attachment

Email messages in RTF format can have embedded in-line attachment. MAPI gives file name of inline attachment but without extension. How to know the extension?
MAPI gives content-description as 'Picture (Device Independent Bitmap)'. I can depend on this data to compute file extension as BMP. But this works for BMP but not for PDF, WORD, EXEL. I would like to know if there is a solution (like looking in to REGISTRY) that works for everything without me changing the code for every file type.
Mime headers generated by reading MAPI properties of attachment. You see that attachment is missing extension.
Content-Disposition: inline; filename=ATT87266
Content-Transfer-Encoding: Base64
content-type: application/ole;name="Picture (Device Independent Bitmap)"
content-description: Picture (Device Independent Bitmap)
Embedded OLE attachments are not files, they are IStorage COM storage. If you look at an OLE attachment with OutlookSpy (I am its author - click IMessage button, go to the GetAttachmentTable, double click on the attachment), you will see that there is no PR_ATTACH_DATA_BIN binary property where the regular by-value attachments are stored; what you have instead is PR_ATTACH_DATA_OBJ object (PT_OBJECT) property. You can open it in OutlookSpy by right clicking and selecting IMAPIProp::OpenProperty, then selecting IStorage as the interface.
The OLE storage will contain several streams that contain flags used by Outlook, metafile used to render the object when viewing it, and the actual data used by whatever OLE server was used to create the OLE attachment. You can look at the storage CLSID to figure out the application used to create the attachment. Once you know that, you can extract the raw file data from the application-specific storage stream inside that IStorage.

Display DB blob type in Flex

My Mysql database stores images (in PNG, JPG)of our personnel and it's field type is set to longblob.
Is there any possibility to load blob data type using HttpService and render it in Image component in Flex .??? ^..^
I'm eager to know about as it comes in handy in the nearest future!!!
You can, but I don't see the point of storing your images in a DB.
Simplest way to get it into an Image is to load the blob, convert to a ByteArray which you can set as the source of of said Image.
If you override HttpService you can use it to receive binary data. If you don't want to override HttpService you have the option of encoding you binary data in base64 before sending it.
But if have the option to store the images in a directory on the server and just send links to the client - that would be a better solution.

Resources