locked
MediaTranscoder cannot transcode 1080p50 MTS video

    Question

  • I would like to transcode an MTS H.264 video file with a 1920x1080 resolution at 50 fps to MP4 using the MediaTranscoder (Windows.Media.Transcoding). If I specify the same dimension and frame rate  for the output and set MediaTranscoder.AlwaysReencode to true, PrepareFileTranscodeAsync fails with an UnknownFailure reason.

    If I leave AlwaysReencode set to false it works, however the resulting file seems to be corrupted: It's not seekable.
    Re-Encoding avoids this problem, but I can re-encode it only if I alter the width, height, or frame rate. However, I'd rather leave them as they are.

    I testet it using the Transcode Windows SDK sample.

    Thursday, June 26, 2014 9:20 AM

All replies

  • I'll ask our media guy to check this out.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Friday, June 27, 2014 12:35 PM
    Moderator
  • Hello,

    I think we need some additional information.

    Can you please supply the full input and output media types including all attributes relevant to the minor type? Feel free to use the GUID for data but please include the MF defined const name for the attribute (i.e. MF_MT_MAJOR_TYPE).

    Keep in mind that MPEG2 Transport Streams do not represent a file format. Because of this there are many implementations of MPEG2 TS file representations. Because of this your particular implementation may not work as expected with the underlying MF topology.

    Thanks,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Friday, June 27, 2014 7:34 PM
    Moderator
  • Hello James,

    thanks for your reply.

    I used a sample Video from a German camera review website. You can download it from here: http://www.videoaktiv.de/Testvideos/Panasonic/Testvideo-Panasonic-HC-X-929.html 

    Use the link to the file Panasonic_HC_X_929.MTS.

    At the moment I don't know the exact subtype, but these are the media file info:

    General
    ID                                       : 1 (0x1)
    Complete name                            : C:\Users\Markus\Downloads\VIDEO_Panasonic_HC_X_929.MTS
    Format                                   : BDAV
    Format/Info                              : Blu-ray Video
    File size                                : 116 MiB
    Duration                                 : 38s 867ms
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 24.9 Mbps
    Maximum Overall bit rate                 : 28.0 Mbps

    Video
    ID                                       : 4113 (0x1011)
    Menu ID                                  : 1 (0x1)
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L4.2
    Format settings, CABAC                   : Yes
    Format settings, ReFrames                : 2 frames
    Format settings, GOP                     : M=3, N=24
    Codec ID                                 : 27
    Duration                                 : 38s 840ms
    Bit rate mode                            : Variable
    Bit rate                                 : 23.5 Mbps
    Maximum bit rate                         : 25.0 Mbps
    Width                                    : 1 920 pixels
    Height                                   : 1 080 pixels
    Display aspect ratio                     : 16:9
    Frame rate                               : 50.000 fps
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.227
    Stream size                              : 109 MiB (94%)

    Audio
    ID                                       : 4352 (0x1100)
    Menu ID                                  : 1 (0x1)
    Format                                   : AC-3
    Format/Info                              : Audio Coding 3
    Mode extension                           : CM (complete main)
    Format settings, Endianness              : Big
    Codec ID                                 : 129
    Duration                                 : 38s 880ms
    Bit rate mode                            : Constant
    Bit rate                                 : 384 Kbps
    Channel(s)                               : 2 channels
    Channel positions                        : Front: L R
    Sampling rate                            : 48.0 KHz
    Bit depth                                : 16 bits
    Compression mode                         : Lossy
    Delay relative to video                  : -40ms
    Stream size                              : 1.78 MiB (2%)

    The output Parameters are:

    Container: MP4
    Video: H.264
    Size: 1920x1080
    Framerate: 50fps

    I used the Transcoding Media sample from the Windows SDK, the "Custom" scenario. I modified two things:

    1. Added .mts to the file picker's file type filter
    2. Added AlwaysReencode = true before PrepareFileTranscodeAsync

    Please tell me if you need more information. Thanks again for your interest.

    Markus

    Saturday, June 28, 2014 8:29 PM
  • Hello,

    There is certainly something strange going on here. It looks to be a problem with transmuxing and "AlwaysReencode". I'm really concerned about the transmuxing creating an output file that won't seek properly. This should not occur and you should not need to reencode the file.

    I spent some time debugging this today and I can't figure out what is going on. Let me talk to some engineers and get back to you in a day or two.

    Thanks,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Tuesday, July 01, 2014 1:03 AM
    Moderator
  • Hello James,

    Do you have any new insights?

    I just tested an MTS file with 25fps (1920x1080) and got the same issue with the AlwaysReencode=true setting as long as I use the same output dimension and frame rate as the original file. Here is a link to a sample video from the same site as above: http://www.videoaktiv.de/Testvideos/JVC/Testvideo-JVC-GZ-E-105.html (the button Video Donwload).

    Of course, I'd rather prefer transmuxing to re-encoding as long as I can seek accurately in the output file. But for now, I'd be happy if I could get re-encoding to work.

    Markus

    Monday, July 07, 2014 11:26 AM
  • The situation improved on Windows 10 Preview. Now I can transcode the MTS files with the AlwaysReencode=true option, no more errors there.

    However, I am still not able to produce a usable MP4 file with AlwaysReencode=false, i.e. just transmuxing. I can play back the MP4 output file and I can even seek, but seeking takes a ridiculously long time. Seeking 20 seconds into the video takes 14 seconds, seeking to the 30 sec position takes almost 30 seconds. Seems like it always scans the file from the start for the correct frame.

    I can only hope that problem will be fixed too.

    Friday, October 10, 2014 2:27 PM
  • Hello,

    Thanks for reporting this new problem. Sounds like the file is not being indexed. I will pass this along.

    Thanks,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Monday, October 13, 2014 10:29 PM
    Moderator