locked
Write orientation info into the recorded MP4 file

    Question

  • Hey guys,

    I'm working on a webcam application that can take snapshots and record on tablet devices.

    For photos, I refer to the simple imaging sample to insert the desired orientation value for System.Photo.Orientation.

    And it works like a charm.

    However, for MP4 videos, I cannot find any method to achieve it.

    I found http://msdn.microsoft.com/en-US/library/windows/apps/windows.storage.fileproperties.videoproperties.orientation, but it is read-only.

    Besides, the built-in Camera app can correctly output video files with correct orientation for every display orientation.

    I guess the Camera app writes proper matrix structure into it.

    Can you tell me whether there is any existing function that writes orientation info into video file?

    A thousand thanks!


    • Edited by noobrocks Tuesday, August 07, 2012 12:45 PM
    Tuesday, August 07, 2012 12:40 PM

Answers

All replies

  • No idea?

    I guess I have to edit the bytes of the MP4 file in my JavaScript...

    It will be quite troublesome.

    Thursday, August 09, 2012 2:53 AM
  • Hello Noob,

    This should work:

    MediaCapture.SetEncoderProperty

    http://msdn.microsoft.com/en-us/library/windows/apps/windows.media.capture.mediacapture.setencoderproperty.aspx

    MF_MT_GEOMETRIC_APERTURE attribute

    http://msdn.microsoft.com/en-us/library/windows/desktop/ms701632(v=vs.85).aspx

    If this doesn't work please let me know.

    -James


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

    Thursday, August 09, 2012 9:00 PM
    Moderator
  • Thank James. I'll give it a try.

    But it looks to me that the attribute is used for setting the viewable video area, not the video orientation.

    Besides, I do not know what is the right way to call setEncoderProperty, especially the third arguement, MFVideoArea in JavaScript.

    mediaCapture.setEncoderProperty(Windows.Media.Capture.MediaStreamType.videoRecord, "{66758743-7e5f-400d-980a-aa8596c85696}", ???);
    Friday, August 10, 2012 7:42 AM
  • Hi,

    If I understand the requirement correctly, you can rotate the recorded vedio. Please refer to http://msdn.microsoft.com/en-us/library/windows/apps/hh452800.aspx for a sample.

    Best Regards,

    Ming Xu.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework

    • Marked as answer by Dino He Friday, September 14, 2012 9:33 AM
    Thursday, August 30, 2012 11:33 AM
    Moderator
  • Hello, I have the same question

    Has any one found the solution for this problem?

    From my observation, the built-in Camera app doesn't rotate the video, it only changes the VideoOrientation in videoproperties.

    I have got the orientation value of video file by using videoFile.Prpoerties.RetrievePropertiesAsync() with KeyWord "System.Video.Orientation"

    It's look like "System.Video.Orientation" is the value I should change and insert into video file, but I don't know the way to achieve that.

    Could any one kindly help me, thanks

    Tuesday, January 08, 2013 12:34 PM