locked
Importing mpeg TS into ASF container RRS feed

  • Question

  • Hi,

    At runtime, I need to prepare a raw MPEG-TS stream with the end goal of applying PlayReady DRM to the file.  The first step in this process (as I understand it) is getting the audio and video streams into an ASF container.  The audio I'm working with is a52 5.1 48000hz bitrate 448 kb/s, and video is h264 1920x1080 @ 59.9 FPS

    My streaming system Looks like (Network Source MPEG-TS => (ASF Packaging) => Rendering)

    Ideally, I would like to just repackage these streams into an ASF container, transcoding is unnecessary (from my point of view), if anything, the video quality could be reduced by dropping the resolution and/or framerate to help with performance.

    I have experimented with Expression Encoder, and Windows Media Encoder, both of which seem to either a.) go far too slow for real time rendering or b.) mangle the quality. However, they do "work".

    Does anyone have any tips and or direction on how to accomplish what i'm attempting to do?   In the meantime I will continue to search the forums for helpful information.

    Thanks for your time.
    Thursday, March 4, 2010 9:47 PM

Answers

  • The sink writer accepts IMFSample objects that contain buffers of stream data.  Each IMFSample would need to be timestamped correctly; it is possible that with MPEG2 you would not be able to generate the right timestamps for each sample without doing some detailed parsing of the stream.  If you have the MPEG2 demuxed into IMFSample objects with the right timestamps, the sink writer (with the ASF sink) will take care of generating the right ASF objects for the container and for each sample.

    PIFF would be good for you because it was designed with PlayReady in mind, but I am not aware of any playback applications that actually support playing it.  You are also still stuck finding an app that will do a remux into the PIFF format, or writing the remuxing yourself.

    • Marked as answer by sickb13 Wednesday, May 26, 2010 3:53 AM
    Tuesday, May 25, 2010 11:52 PM

All replies

  • It is certainly possible to cram MPEG2 data into an ASF file, but I do not know that you could do it in a way that would allow mainstream players to play it.  If you also control the playback application for your scenario, that would not be a problem.

    The ASF container can store any video data that can be represented by a BITMAPINFOHEADER structure.  The problem I forsee is that there is no widely recognized fourCC for MPEG2 to put into the compression field of the BITMAPINFOHEADER.  You might very well be able to generate a parsable ASF file, but no player would be able to recognize what codec to use to play it.

    If you want to give it a try, you can use the MF sink writer to mux raw data into an ASF file.  You should call AddStream with the media type of the input data, but do not call SetInputMediaType so an encoder will not be inserted.  There are samples of using the sink writer in the Windows SDK and on the MF blog linked from this forum.
    Saturday, March 6, 2010 3:03 AM
  • I probably should read more carefully.  H264 video should work fine in an ASF container, I have done this before.  You would need to find a wave format tag for the a52 audio format.  I am not aware of a standard format tag for a52.
    Thursday, March 11, 2010 12:02 AM
  • Hi Matt,

    Sorry for the long delay in adding to this thread - I had lost track that I had posted it.  Are you saying that using just the MF Sink Writer and typical "AddStream" is all that is needed after demuxing the video from the Transport Stream container?  As far as you know, is it "smart" enough to translate the packets into correctly time stamped Sample Objects in the ASF file?  I'm going to give this a spin very shortly.  The other option I'm looking into was suggested to me by the PlayReady team; to use the "new" PIFF file format, which they seem to think is going to take over, especially for silverlight applications.

    Thanks again,

    K

    Friday, May 21, 2010 4:45 AM
  • The sink writer accepts IMFSample objects that contain buffers of stream data.  Each IMFSample would need to be timestamped correctly; it is possible that with MPEG2 you would not be able to generate the right timestamps for each sample without doing some detailed parsing of the stream.  If you have the MPEG2 demuxed into IMFSample objects with the right timestamps, the sink writer (with the ASF sink) will take care of generating the right ASF objects for the container and for each sample.

    PIFF would be good for you because it was designed with PlayReady in mind, but I am not aware of any playback applications that actually support playing it.  You are also still stuck finding an app that will do a remux into the PIFF format, or writing the remuxing yourself.

    • Marked as answer by sickb13 Wednesday, May 26, 2010 3:53 AM
    Tuesday, May 25, 2010 11:52 PM