static Transcoder CreateDecoder(string inputFile) { Transcoder transcoder = new Transcoder() { AllowDemoMode = true }; var inSocket = new MediaSocket() { File = inputFile, }; transcoder.Inputs.Add(inSocket); var outSocket = new MediaSocket() { File = null, // Pull StreamType = StreamType.UncompressedVideo }; outSocket.Pins.Add(new MediaPin() { StreamInfo = new VideoStreamInfo() { StreamType = StreamType.UncompressedVideo } }); transcoder.Outputs.Add(outSocket); return(transcoder); }
static Transcoder CreateEncoder(VideoStreamInfo inputVideo, VideoStreamInfo outputVideo, string outputFile) { Transcoder transcoder = new Transcoder() { AllowDemoMode = true }; var inSocket = new MediaSocket() { File = null, //Push StreamType = StreamType.UncompressedVideo, }; inSocket.Pins.Add(new MediaPin() { StreamInfo = inputVideo }); transcoder.Inputs.Add(inSocket); var outSocket = new MediaSocket() { File = outputFile, }; outSocket.Pins.Add(new MediaPin() { StreamInfo = outputVideo }); transcoder.Outputs.Add(outSocket); return(transcoder); }
static MediaSocket CreateOutputSocket(Options opt) { MediaSocket socket = new MediaSocket(); socket.File = null; socket.Stream = null; socket.StreamType = StreamType.Aac; socket.StreamSubType = StreamSubType.AacRaw; MediaPin pin = new MediaPin(); socket.Pins.Add(pin); AudioStreamInfo asi = new AudioStreamInfo(); pin.StreamInfo = asi; asi.StreamType = StreamType.Aac; asi.StreamSubType = StreamSubType.AacRaw; // You can change the sampling rate and the number of the channels //asi.Channels = 1; //asi.SampleRate = 44100; return(socket); }
static MediaSocket ConfigureOutputSocket(Options opt) { MediaSocket socket = new MediaSocket(); socket.File = opt.OutputFile; MediaPin pin = new MediaPin(); socket.Pins.Add(pin); VideoStreamInfo vsi = new VideoStreamInfo(); pin.StreamInfo = vsi; VideoStreamInfo overlayVsi = new VideoStreamInfo(); overlayVsi.StreamType = StreamType.Png; pin.Params.Add(Param.Video.Overlay.Mode, AlphaCompositingMode.Atop); pin.Params.Add(Param.Video.Overlay.LocationX, opt.PositionX); pin.Params.Add(Param.Video.Overlay.LocationY, opt.PositionY); pin.Params.Add(Param.Video.Overlay.BackgroundAlpha, 1); pin.Params.Add(Param.Video.Overlay.ForegroundAlpha, opt.Alpha); pin.Params.Add(Param.Video.Overlay.ForegroundBufferFormat, overlayVsi); pin.Params.Add(Param.Video.Overlay.ForegroundBuffer, new MediaBuffer(System.IO.File.ReadAllBytes(opt.Watermark))); return(socket); }
public ElementaryStream(StreamType streamType, int width, int height, double fps) { vsi = new VideoStreamInfo(); pin = new MediaPin(); socket = new MediaSocket(); // set video stream properties vsi.StreamType = streamType; if (width > 0) { vsi.FrameWidth = width; } if (height > 0) { vsi.FrameHeight = height; } if (fps > 0.0) { vsi.FrameRate = fps; } // provide pin with stream info pin.StreamInfo = vsi; // set socket properties socket.StreamType = StreamType.H264; // set socket pin socket.Pins.Add(pin); }
public static MediaSocket MediaSocketFromPreset(string presetName) { // custom presets if (presetName == "custom-mp4-h264-704x576-25fps-aac") { return(CustomOutputSocket(704, 576, 25)); } else if (presetName == "custom-mp4-h264-704x576-12fps-aac") { return(CustomOutputSocket(704, 576, 12)); } else if (presetName == "custom-mp4-h264-352x288-25fps-aac") { return(CustomOutputSocket(352, 288, 25)); } else if (presetName == "custom-mp4-h264-352x288-12fps-aac") { return(CustomOutputSocket(352, 288, 12)); } else { // built-in presets return(MediaSocket.FromPreset(presetName)); } }
public void Init(MediaSocket socket, string filename) { if (socket == null || string.IsNullOrEmpty(filename)) { return; } infile = new System.IO.FileStream(filename, FileMode.Open, FileAccess.Read); StreamInfo sinfo = socket.Pins[0].StreamInfo; mediaType = sinfo.MediaType; switch (mediaType) { case MediaType.Video: Init(sinfo as VideoStreamInfo); break; case MediaType.Audio: Init(sinfo as AudioStreamInfo); break; default: throw new Exception("Unsupported: unknown media type"); } eos = false; }
static public bool setTranscode(Transcoder transcoder, string imgFile, Options opt) { using (var info = new MediaInfo()) { info.Inputs[0].File = imgFile; if (!info.Open()) { PrintError("MediaInfo open", info.Error); return(false); } // prepare input socket var inSocket = MediaSocket.FromMediaInfo(info); inSocket.File = null; inSocket.Stream = null; // prepare output socket var outSocket = InitOutputSocket(opt, inSocket.Pins[0].StreamInfo); transcoder.Inputs.Add(inSocket); transcoder.Outputs.Add(outSocket); DeleteFile(opt.OutputFile); if (!transcoder.Open()) { PrintError("Transcoder open", transcoder.Error); return(false); } } return(true); }
static bool encode(Options opt) { DeleteFile(opt.OutputFile); MediaSocket inSocket = CreateInputSocket(opt); MediaSocket outSocket = CreateOutputSocket(opt); // create Transcoder using (Transcoder transcoder = new Transcoder()) { transcoder.AllowDemoMode = true; transcoder.Inputs.Add(inSocket); transcoder.Outputs.Add(outSocket); bool res = transcoder.Open(); PrintStatus("Transcoder open", transcoder.Error); if (!res) { return(false); } res = transcoder.Run(); PrintStatus("Transcoder run", transcoder.Error); if (!res) { return(false); } transcoder.Close(); PrintStatus("Transcoder close", transcoder.Error); } return(true); }
static MediaSocket CreateInputSocket(Options opt) { MediaSocket socket = new MediaSocket(); socket.StreamType = StreamType.UncompressedVideo; socket.File = null; socket.Stream = null; MediaPin pin = new MediaPin(); socket.Pins.Add(pin); VideoStreamInfo vsi = new VideoStreamInfo(); pin.StreamInfo = vsi; vsi.StreamType = StreamType.UncompressedVideo; vsi.ScanType = ScanType.Progressive; vsi.FrameWidth = opt.Width; vsi.FrameHeight = opt.Height; vsi.ColorFormat = opt.Color.Id; vsi.FrameRate = opt.Fps; return(socket); }
// return error message or null if success public static string ConvertFileWithPreset(string inputFile, string outputFile, string outputPreset, EventHandler <TranscoderContinueEventArgs> onContinue, EventHandler <TranscoderProgressEventArgs> onProgress, EventHandler <TranscoderStatusEventArgs> onStatus ) { using (MediaInfo mediaInfo = new MediaInfo()) { mediaInfo.Inputs[0].File = inputFile; if (!mediaInfo.Open()) { return(FormatErrorMessage(mediaInfo.Error)); } using (Transcoder t = new Transcoder()) { // In order to use the OEM release for testing (without a valid license) the transcoder demo mode must be enabled. t.AllowDemoMode = true; if (onContinue != null) { t.OnContinue += onContinue; } if (onProgress != null) { t.OnProgress += onProgress; } if (onStatus != null) { t.OnStatus += onStatus; } MediaSocket insocket = MediaSocket.FromMediaInfo(mediaInfo); t.Inputs.Add(insocket); MediaSocket outsocket = MediaSocket.FromPreset(outputPreset); if (outsocket == null) { return("Cannot create output preset"); } outsocket.File = outputFile; t.Outputs.Add(outsocket); if (!t.Open()) { return(FormatErrorMessage(t.Error)); } if (!t.Run()) { return(FormatErrorMessage(t.Error)); } t.Close(); } } return(null); // no error }
public bool Open(string imageOverlay, StreamType imageType, VideoStreamInfo uncompressedVideo) { var inSocket = new MediaSocket() { File = null, // Push StreamType = StreamType.UncompressedVideo, }; inSocket.Pins.Add(new MediaPin() { StreamInfo = uncompressedVideo }); t.Inputs.Add(inSocket); var outSocket = new MediaSocket() { File = null, // Pull StreamType = StreamType.UncompressedVideo }; outSocket.Pins.Add(new MediaPin() { StreamInfo = uncompressedVideo }); SetOverlayParamsToPin(outSocket.Pins[0], imageOverlay, imageType); t.Outputs.Add(outSocket); return(t.Open()); }
static bool Encode(Options opt) { DeleteFile(opt.OutputFile); MediaSocket inSocket = new MediaSocket(); inSocket.File = opt.InputFile; MediaSocket outSocket = CreateOutputSocket(opt); // create Transcoder using (Transcoder transcoder = new Transcoder()) { transcoder.AllowDemoMode = true; transcoder.Inputs.Add(inSocket); transcoder.Outputs.Add(outSocket); if (!transcoder.Open()) { PrintError("Transcoder open", transcoder.Error); return(false); } if (!transcoder.Run()) { PrintError("Transcoder run", transcoder.Error); return(false); } transcoder.Close(); } return(true); }
static bool EncodeImageToMpeg2Video(string imageFile, string outputFile, string encodingPreset) { Transcoder transcoder = new Transcoder(); // In order to use the OEM release for testing (without a valid license) the transcoder demo mode must be enabled. transcoder.AllowDemoMode = true; try { File.Delete(outputFile); // Configure Input { MediaInfo info = new MediaInfo(); info.InputFile = imageFile; if (!info.Load()) { PrintError("MediaInfo load", info.Error); return(false); } MediaSocket socket = MediaSocket.FromMediaInfo(info); transcoder.Inputs.Add(socket); } // Configure Output { MediaSocket socket = MediaSocket.FromPreset(encodingPreset); socket.File = outputFile; transcoder.Outputs.Add(socket); } // Encode Images if (!transcoder.Open()) { PrintError("Transcoder open", transcoder.Error); return(false); } if (!transcoder.Run()) { PrintError("Transcoder run", transcoder.Error); return(false); } transcoder.Close(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); return(false); } finally { transcoder.Dispose(); } return(true); }
static bool Encode(Options opt) { try { File.Delete(opt.OutputFile); } catch { } using (var transcoder = new Transcoder()) { // Transcoder demo mode must be enabled, // in order to use the OEM release for testing (without a valid license). transcoder.AllowDemoMode = true; // Configure input // The input stream frame rate determines the playback speed var instream = new VideoStreamInfo { StreamType = PrimoSoftware.AVBlocks.StreamType.UncompressedVideo, FrameRate = opt.YuvFps, FrameWidth = opt.YuvWidth, FrameHeight = opt.YuvHeight, ColorFormat = opt.YuvColor.Id, ScanType = ScanType.Progressive }; var inpin = new MediaPin { StreamInfo = instream }; var insocket = new MediaSocket { StreamType = PrimoSoftware.AVBlocks.StreamType.UncompressedVideo, File = opt.YuvFile }; insocket.Pins.Add(inpin); transcoder.Inputs.Add(insocket); // Configure output var outsocket = MediaSocket.FromPreset(opt.OutputPreset.Name); outsocket.File = opt.OutputFile; transcoder.Outputs.Add(outsocket); bool res = transcoder.Open(); PrintError("Open Transcoder", transcoder.Error); if (!res) return false; res = transcoder.Run(); PrintError("Run Transcoder", transcoder.Error); if (!res) return false; transcoder.Close(); } return true; }
static bool Transcode(Options opt) { using (Transcoder transcoder = new Transcoder()) { transcoder.AllowDemoMode = true; MediaSocket inSocket = CreateInputSocket(opt); MediaSocket outSocket = CreateOutputSocket(opt); transcoder.Inputs.Add(inSocket); transcoder.Outputs.Add(outSocket); DeleteFile(opt.OutputFile); if (!transcoder.Open()) { PrintStatus("Transcoder open", transcoder.Error); return(false); } for (int fileCount = 0; ; fileCount++) { string pattern = "au_{0:0000}.h264"; string fileName = string.Format(pattern, fileCount); string filePath = Path.Combine(opt.InputDir, fileName); if (!File.Exists(filePath)) { fileName = string.Format(pattern, fileCount - 1); Console.WriteLine("Decoded " + fileCount + " files." + "(last decoded file: " + fileName + ")"); break; } var sample = new MediaSample(); sample.Buffer = new MediaBuffer(File.ReadAllBytes(filePath)); if (!transcoder.Push(0, sample)) { PrintStatus("Transcoder push", transcoder.Error); return(false); } } if (!transcoder.Flush()) { PrintStatus("Transcoder flush", transcoder.Error); return(false); } Console.WriteLine("Output file: " + opt.OutputFile); transcoder.Close(); return(true); } }
static Transcoder createTranscoder(Options opt) { var transcoder = new Transcoder() { AllowDemoMode = true }; using (MediaInfo info = new MediaInfo()) { info.Inputs[0].File = opt.InputFile; if (!info.Open()) { PrintError("MediaInfo open: ", info.Error); return(null); } MediaSocket inSocket = MediaSocket.FromMediaInfo(info); transcoder.Inputs.Add(inSocket); int vIndex = 0; int aIndex = 0; for (int i = 0; i < inSocket.Pins.Count; i++) { int fileIndex; string type; if (inSocket.Pins[i].StreamInfo.MediaType == MediaType.Audio) { fileIndex = ++aIndex; type = "aac"; } else if (inSocket.Pins[i].StreamInfo.MediaType == MediaType.Video) { fileIndex = ++vIndex; type = "h264"; } else { continue; } MediaSocket outSocket = new MediaSocket(); MediaPin pin = (MediaPin)inSocket.Pins[i].Clone(); outSocket.Pins.Add(pin); outSocket.File = GenerateOutputFileName(opt.OutputFile, fileIndex, type); File.Delete(outSocket.File); transcoder.Outputs.Add(outSocket); } return(transcoder); } }
private static MediaSocket SocketFromPin(MediaPin pin) { var socket = new MediaSocket(); socket.Pins.Add((MediaPin)pin.Clone()); socket.StreamType = pin.StreamInfo.StreamType; socket.StreamSubType = pin.StreamInfo.StreamSubType; socket.Params = pin.Params; return(socket); }
static Transcoder GenerateOutputFileName(Options opt) { using (var info = new MediaInfo()) { info.Inputs[0].File = opt.InputFile; if (!info.Open()) { PrintError("MediaInfo open", info.Error); return(null); } MediaSocket inSocket = MediaSocket.FromMediaInfo(info); info.Close(); Transcoder transcoder = new Transcoder(); transcoder.AllowDemoMode = true; transcoder.Inputs.Add(inSocket); bool audio = false; bool video = false; for (int i = 0; i < inSocket.Pins.Count; ++i) { string fileName; if (inSocket.Pins[i].StreamInfo.MediaType == MediaType.Audio && !audio) { audio = true; fileName = opt.OutputFile + ".aud.mp4"; } else if (inSocket.Pins[i].StreamInfo.MediaType == MediaType.Video && !video) { video = true; fileName = opt.OutputFile + ".vid.mp4"; } else { inSocket.Pins[i].Connection = PinConnection.Disabled; continue; } MediaSocket outSocket = new MediaSocket(); outSocket.Pins.Add(inSocket.Pins[i]); DeleteFile(fileName); outSocket.File = fileName; transcoder.Outputs.Add(outSocket); Console.WriteLine("Output file: {0}", fileName); } return(transcoder); } }
private void SetupTranscoder() { transcoder = new PrimoSoftware.AVBlocks.Transcoder(); transcoder.AllowDemoMode = true; captureFramerate = Convert.ToInt32(cCaptureFramerate.Text); /* * Important! * Make sure the calculated viewport size is in pixels because it's used as video frame size. * The rendered viewport size includes the margins. */ var margin = viewport.Margin; var frameWidth = (int)(viewport.ActualWidth * dpiScaleX + margin.Left + margin.Right); var frameHeight = (int)(viewport.ActualHeight * dpiScaleY + margin.Top + margin.Bottom); /* * Round down to even frame size. * This is required by the AVBlocks Transcoder */ captureFrameWidth = frameWidth / 2 * 2; captureFrameHeight = frameHeight / 2 * 2; var preset = cOutputPreset.SelectedItem as PresetDescriptor; var output = MediaSocket.FromPreset(preset.Name); output.File = cOutputFile.Text; AdjustVideoOutput(output, captureFramerate); transcoder.Outputs.Add(output); var input = new MediaSocket() { StreamType = StreamType.UncompressedVideo }; input.Pins.Add(new MediaPin() { StreamInfo = new VideoStreamInfo() { StreamType = StreamType.UncompressedVideo, FrameWidth = captureFrameWidth, FrameHeight = captureFrameHeight, ColorFormat = ColorFormat.BGR32, ScanType = ScanType.Progressive, } }); transcoder.Inputs.Add(input); File.Delete(output.File); }
private List <string> EncodeInputFiles(string tmpFolder) { LogEvent("Encoding started."); List <string> encodedFiles = new List <string>(); for (int i = 0; i < m_settings.InputFiles.Count; i++) { using (var transcoder = new Transcoder()) { // In order to use the OEM release for testing (without a valid license) the transcoder demo mode must be enabled. transcoder.AllowDemoMode = true; transcoder.OnContinue += new EventHandler <TranscoderContinueEventArgs>(transcoder_OnContinue); transcoder.OnProgress += new EventHandler <TranscoderProgressEventArgs>(transcoder_OnProgress); string inputFile = m_settings.InputFiles[i]; string outputFile = System.IO.Path.Combine(tmpFolder, System.IO.Path.GetFileNameWithoutExtension(inputFile) + ".mpg"); if (File.Exists(outputFile)) { File.Delete(outputFile); } LogEvent("Encoding " + outputFile); var outputSocket = MediaSocket.FromPreset(m_settings.EncodingPreset); outputSocket.File = outputFile; transcoder.Outputs.Add(outputSocket); var inputSocket = new MediaSocket(); inputSocket.File = inputFile; transcoder.Inputs.Add(inputSocket); if (!transcoder.Open()) { throw new EncoderException(transcoder.Error); } if (!transcoder.Run()) { throw new EncoderException(transcoder.Error); } encodedFiles.Add(outputFile); } } LogEvent("Encoding completed."); return(encodedFiles); }
static bool Encode(Options opt) { DeleteFile(opt.OutputFile); MediaSocket inSocket = new MediaSocket(); inSocket.File = opt.InputFile; MediaSocket outSocket = CreateOutputSocket(opt); bool success = false; // create Transcoder using (Transcoder transcoder = new Transcoder()) { transcoder.AllowDemoMode = true; transcoder.Inputs.Add(inSocket); transcoder.Outputs.Add(outSocket); if (!transcoder.Open()) { PrintError("Transcoder open", transcoder.Error); return(false); } using (FileStream outputFile = File.OpenWrite(opt.OutputFile)) { MediaSample outputSample = new MediaSample(); int outputIndex = -1; while (transcoder.Pull(out outputIndex, outputSample)) { MediaBuffer buffer = outputSample.Buffer; outputFile.Write(buffer.Start, buffer.DataOffset, buffer.DataSize); } ErrorInfo error = transcoder.Error; PrintError("Transcoder pull", error); if ((error.Code == (int)CodecError.EOS) && (error.Facility == ErrorFacility.Codec)) { // ok success = true; } } transcoder.Close(); } return(success); }
static bool DecodeAvcFile(Options opt) { // transcoder will fail if output exists (by design) DeleteFile(opt.OutputFile); var mediaInfo = new PrimoSoftware.AVBlocks.MediaInfo(); mediaInfo.Inputs[0].File = opt.InputFile; if (!mediaInfo.Open()) { PrintError("MediaInfo.Open()", mediaInfo.Error); return(false); } MediaSocket inSocket = MediaSocket.FromMediaInfo(mediaInfo); MediaSocket outSocket = CreateOutputSocket(opt); // create Transcoder using (Transcoder transcoder = new Transcoder()) { transcoder.AllowDemoMode = true; transcoder.Inputs.Add(inSocket); transcoder.Outputs.Add(outSocket); bool res = transcoder.Open(); PrintError("Transcoder open", transcoder.Error); if (!res) { return(false); } res = transcoder.Run(); PrintError("Transcoder run", transcoder.Error); if (!res) { return(false); } transcoder.Close(); PrintError("Transcoder close", transcoder.Error); if (!res) { return(false); } } return(true); }
static int Main(string[] args) { var opt = new Options(); if (!opt.Prepare(args)) { return((int)ExitCodes.OptionsError); } Library.Initialize(); MediaSocket inSocket = CreateInputSocket(opt); MediaSocket outSocket = CreateOutputSocket(opt); int exitCode = (int)ExitCodes.Success; // Set license information. To run AVBlocks in demo mode, comment the next line out // Library.SetLicense("<license-string>"); using (Transcoder transcoder = new Transcoder()) { transcoder.AllowDemoMode = true; transcoder.Inputs.Add(inSocket); transcoder.Outputs.Add(outSocket); DeleteFile(opt.OutputFile); if (transcoder.Open()) { PrintStatus("Transcoder open", transcoder.Error); if (!EncodeH264Stream(opt, transcoder)) { exitCode = (int)ExitCodes.EncodingError; } transcoder.Close(); PrintStatus("Transcoder close", transcoder.Error); } else { PrintStatus("Transcoder open", transcoder.Error); exitCode = (int)ExitCodes.EncodingError; } } Library.Shutdown(); return(exitCode); }
static MediaSocket CreateOutputSocket(Options opt) { MediaPin pin = new MediaPin(); MediaSocket socket = new MediaSocket(); socket.Pins.Add(pin); VideoStreamInfo vsi = new VideoStreamInfo(); vsi.ScanType = ScanType.Progressive; pin.StreamInfo = vsi; return(socket); }
static bool parse_h264_stream(Options opt) { DeleteDirectory(opt.OutputDir); MediaSocket inSocket = new MediaSocket(); inSocket.File = opt.InputFile; inSocket.StreamType = StreamType.H264; MediaSocket outSocket = CreateOutputSocket(opt); using (Transcoder transcoder = new Transcoder()) { transcoder.Inputs.Add(inSocket); transcoder.Outputs.Add(outSocket); var res = transcoder.Open(); PrintError("transcoder open", transcoder.Error); if (!res) { return(false); } int inputIndex = 0; MediaSample accessUnit = new MediaSample(); if (!MakeDir(opt.OutputDir)) { Console.WriteLine("cannot create output directory: " + opt.OutputDir); return(false); } while (transcoder.Pull(out inputIndex, accessUnit)) { // Each call to Transcoder::pull returns one Access Unit. // The Access Unit may contain one or more NAL units. var au_buffer = accessUnit.Buffer; Console.WriteLine("AU #" + au_index + ", " + au_buffer.DataSize + " bytes"); WriteAuFile(opt.OutputDir, au_index, au_buffer); PrintNalus(au_buffer); ++au_index; } } return(true); }
private static void SetRealTimeVideoMode(MediaSocket socket) { foreach (MediaPin pin in socket.Pins) { if (pin.StreamInfo.MediaType == PrimoSoftware.AVBlocks.MediaType.Video) { pin.Params[Param.Video.FrameRateConverter.Use] = Use.On; pin.Params[Param.Video.FrameRateConverter.RealTime] = true; if (pin.StreamInfo.StreamType == StreamType.H264) { pin.Params[Param.Encoder.Video.H264.FixedFramerate] = false; } pin.Params[Param.HardwareEncoder] = HardwareEncoder.Auto; } } }
static MediaSocket CreateOutputSocket(Options opt) { MediaSocket socket = new MediaSocket(); socket.File = opt.OutputFile; socket.StreamType = StreamType.UncompressedVideo; MediaPin pin = new MediaPin(); socket.Pins.Add(pin); VideoStreamInfo vsi = new VideoStreamInfo(); pin.StreamInfo = vsi; vsi.StreamType = StreamType.UncompressedVideo; vsi.ColorFormat = ColorFormat.YUV420; return(socket); }
static MediaSocket CreateOutputSocket(Options opt) { MediaSocket socket = new MediaSocket(); socket.File = opt.OutputFile; socket.StreamType = StreamType.H264; socket.StreamSubType = StreamSubType.AvcAnnexB; MediaPin pin = new MediaPin(); socket.Pins.Add(pin); VideoStreamInfo vsi = new VideoStreamInfo(); pin.StreamInfo = vsi; vsi.StreamType = StreamType.H264; vsi.StreamSubType = StreamSubType.AvcAnnexB; return(socket); }
static MediaSocket CreateOutputSocket(Options opt) { MediaSocket socket = new MediaSocket(); socket.File = opt.OutputFile; socket.StreamType = StreamType.Aac; socket.StreamSubType = StreamSubType.AacRaw; MediaPin pin = new MediaPin(); socket.Pins.Add(pin); AudioStreamInfo asi = new AudioStreamInfo(); pin.StreamInfo = asi; asi.StreamType = StreamType.Aac; asi.StreamSubType = StreamSubType.AacRaw; return(socket); }