Resize encoded video by c# codes SDK

Answered Resize encoded video by c# codes SDK

  • Tuesday, October 02, 2012 6:34 PM
     
     

    I am using EE 4 Pro  and a live job in C# code as LiveJob job = new LiveJob();  ... to stream video.

    I'd like to know how to use C# source codes with EE 4 Pro SDK to resize encoded video during encoding process. 

    For example, if I have an original video whose dimensions are 6 in X 9 in, I would like to know how use C# source codes to resize encoded video.

    In details, in scaled smaller versions  with rates of 1/6, 1/3, and 1/2 , I will get  1 in X 1.5 in; 2 in X 3 in ; and  3 in X 4.5 in encoded videos, and they are saved out as 3 encoded video files.

    Or in scaled bigger versions with rate of 1.5 and 2, I will get  9 in X 13 in;  and 12 in X 18 in coded videos, and they are saved out as 2 encoded video files.

    Thank you.

All Replies

  • Monday, October 08, 2012 12:59 PM
     
     Answered Has Code

    Here is my version of resizing, but I'm doing it with VOD videos. But I don't thing there will be a big difference.

                        MP4OutputFormat mp4Format = new MP4OutputFormat();
                        mp4Format.VideoProfile = new Microsoft.Expression.Encoder.Profiles.HighH264VideoProfile();
                        mp4Format.AudioProfile = new Microsoft.Expression.Encoder.Profiles.AacAudioProfile();
                        mp4Format.VideoProfile.AspectRatio = new System.Windows.Size(16, 9);
                        mp4Format.VideoProfile.AutoFit = true;
                        mp4Format.VideoProfile.Size = new System.Drawing.Size(1920, 1080);
                        mp4Format.VideoProfile.Bitrate = new Microsoft.Expression.Encoder.Profiles.VariableUnconstrainedBitrate(6000);
    
                        mediaItem.VideoResizeMode = VideoResizeMode.Letterbox;
                        mediaItem.OutputFormat = mp4Format;


    Please mark as reply if helped.
    Also visit my blog http://msguy.net/

  • Monday, October 08, 2012 1:02 PM
     
     

    Also I've uploaded some code snippets in gallery, it's about how did I achieve best results in video encoding with EE.

    Please check it out if you have a time.

    http://code.msdn.microsoft.com/Encoding-video-using-2712e0ba


    Please mark as reply if helped.
    Also visit my blog http://msguy.net/

  • Monday, October 08, 2012 7:38 PM
     
      Has Code

    Here is my version of resizing, but I'm doing it with VOD videos. But I don't thing there will be a big difference.

                        MP4OutputFormat mp4Format = new MP4OutputFormat();
                        mp4Format.VideoProfile = new Microsoft.Expression.Encoder.Profiles.HighH264VideoProfile();
                        mp4Format.AudioProfile = new Microsoft.Expression.Encoder.Profiles.AacAudioProfile();
                        mp4Format.VideoProfile.AspectRatio = new System.Windows.Size(16, 9);
                        mp4Format.VideoProfile.AutoFit = true;
                        mp4Format.VideoProfile.Size = new System.Drawing.Size(1920, 1080);
                        mp4Format.VideoProfile.Bitrate = new Microsoft.Expression.Encoder.Profiles.VariableUnconstrainedBitrate(6000);
    
                        mediaItem.VideoResizeMode = VideoResizeMode.Letterbox;
                        mediaItem.OutputFormat = mp4Format;


    Please mark as reply if helped.
    Also visit my blog http://msguy.net/

    Thank you Micheal, 

    I will try those suggestions.