2

EC4 SP2 SDKを使用してC#でアプリケーションをコーディングしています。

ファイルをメディアサーバーの公開ポイントに公開したい。公開ポイントでのセットアップと認証に関する2つの例を検索して見つけましたが、古いSDKからのものであるか、機能しません(コンソール用です)。基本的に、私のアプリケーションは、エンコードするものがないかのように、何もエンコードしません。degubモードのチェックポイントでは、ソースファイルとサーバーの正しいプロパティを確認できます。

エンコードプロセスの処理には0秒かかります。サーバーイベントのログを確認したところ、「セキュリティシステムが受信し、認証要求をデコードできませんでした」という警告が表示されます。私はこれ以上別れる知識がありません。どんな助けでもいただければ幸いです。

これはコードの一部です:

 private void broadcastSourceFileToMediaServer2()
    {             
        using (LiveJob job = new LiveJob())
        {
            String filetoencode = @"c:\temp\niceday.wmv";

            LiveFileSource filesource = job.AddFileSource(filetoencode);
            filesource.PlaybackMode = FileSourcePlaybackMode.Loop;
            job.ActivateSource(filesource);
            job.ApplyPreset(LivePresets.VC1Broadband4x3);

            //don't know which one is good to use 
            job.AcquireCredentials += new EventHandler<AcquireCredentialsEventArgs>(job_AcquireCredentials);
            _myUserName = "indes";
            _pw = PullPW("indes");              

            Uri url = new Uri("http://192.168.1.74:8080/live");
            PushBroadcastPublishFormat pubpoint = new PushBroadcastPublishFormat();
            pubpoint.PublishingPoint = url;

            pubpoint.UserName = _myUserName;
            pubpoint.Password = _pw;

            job.PublishFormats.Add(pubpoint);       

            job.PreConnectPublishingPoint();

            job.StartEncoding();
            statusBox.Text = job.NumberOfEncodedSamples.ToString();

            job.StopEncoding();
            job.Dispose();
        }
  }




    public static string _myUserName { get; set; }

    public static SecureString _pw { get; set; }

    //codificação de Password a enviar
    private static SecureString PullPW(string pw)
    {
        SecureString s = new SecureString();
        foreach (char c in pw) s.AppendChar(c);
        return s;
    }

 static void job_AcquireCredentials(object sender, AcquireCredentialsEventArgs e)
    {
        e.UserName = _myUserName;
        e.Password = _pw;
        e.Modes = AcquireCredentialModes.None;
    }
4

4 に答える 4

2

進捗状況:

サーバーで認証(少なくとも肯定的な監査イベントを取得)することができました。

私はこれから変更しました:

//don't know which one is good to use 
        job.AcquireCredentials += new EventHandler<AcquireCredentialsEventArgs>(job_AcquireCredentials);
        _myUserName = "indes";
        _pw = PullPW("indes");              

        Uri url = new Uri("http://192.168.1.74:8080/live");
        PushBroadcastPublishFormat pubpoint = new PushBroadcastPublishFormat();
        pubpoint.PublishingPoint = url;

        pubpoint.UserName = _myUserName;
        pubpoint.Password = _pw;

これに:

        job.AcquireCredentials += new EventHandler<AcquireCredentialsEventArgs>(job_AcquireCredentials);
        _myUserName = @"mediaservername\user";
        _pw = PullPW("user_password");              

        Uri url = new Uri("http://192.168.1.74:8080/live");
        PushBroadcastPublishFormat pubpoint = new PushBroadcastPublishFormat();
        pubpoint.PublishingPoint = url;

ユーザー名の前にドメイン(ドメインまたはコンピューター名のいずれか)を含める必要があるかどうかを片側に表示する場合。これにより、サーバーで失敗した監査イベントが変更されたため、手動のクレデンシャルpubpoint.usernameとpubpoint.Passwordを削除できました。

今、私は出力フォーマットの例外の欠如を扱っています。それに。

于 2011-11-12T13:58:15.810 に答える
1

SMOOTH Streaming を使用するのはどうですか。どうにかしてプロジェクトを進めることができましたが、PUBLISH スイッチ タイプを持つ部分まで、以下を見てください。ファイル部分を無視する

internal bool StartStream()
{
    Busy = true;
    // Instantiates a new job for encoding
    //  

    //***************************************Live Stream Archive******************************
    if (blnRecordFromFile)
    {

        // Sets up publishing format for file archival type
        FileArchivePublishFormat fileOut = new FileArchivePublishFormat();



        //  job.ApplyPreset(LivePresets.VC1512kDSL16x9);

        // Gets timestamp and edits it for filename
        string timeStamp = DateTime.Now.ToString();
        timeStamp = timeStamp.Replace("/", "-");
        timeStamp = timeStamp.Replace(":", ".");

        // Sets file path and name
        string path = "C:\\output\\";
        string filename = "Capture" + timeStamp + ".ismv";
        if (!Directory.Exists(path))
            Directory.CreateDirectory(path);

        fileOut.OutputFileName = Path.Combine(path, filename);

        // Adds the format to the job. You can add additional formats as well such as
        // Publishing streams or broadcasting from a port
        job.PublishFormats.Add(fileOut);

    }
    //******************************END OF Stream PORTION****************************************

    ////////////////////////////////////////////////////////////////////////////////////////////////////
    //*************************************** Process Files or Live Stream******************************
    if (blnRecordFromFile)
    {
        job.ApplyPreset(LivePresets.VC1IISSmoothStreaming720pWidescreen);

        job = new LiveJob();
        // Verifies all information is entered
        if (string.IsNullOrWhiteSpace(sourcePath) || string.IsNullOrWhiteSpace(destinationPath))
            return false;

        job.Status += new EventHandler<EncodeStatusEventArgs>(StreamStatus);

        LiveFileSource fileSource;
        try
        {
            // Sets file to active source and checks if it is valid
            fileSource = job.AddFileSource(sourcePath);
        }
        catch (InvalidMediaFileException)
        {
            return false;
        }

        // Sets to loop media for streaming
        //   fileSource.PlaybackMode = FileSourcePlaybackMode.Loop;

        // Makes this file the active source. Multiple files can be added 
        // and cued to move to each other at their ends
        job.ActivateSource(fileSource);
    }
    //******************************END OF FILE PORTION****************************************


    // Sets up variable for fomat data
    switch (publishType)
    {
        case Output.Archive:
            // Verifies destination path exists and if not creates it
            try
        {
            if (!Directory.Exists(destinationPath))
                Directory.CreateDirectory(destinationPath);
        }
            catch (IOException)
            {
                return false;
            }

            FileArchivePublishFormat archiveFormat = new FileArchivePublishFormat();

            // Gets the location of the old extention and removes it
            string filename = Path.GetFileNameWithoutExtension(sourcePath);

            // Sets the archive path and file name
            archiveFormat.OutputFileName = Path.Combine(destinationPath, filename + ".ismv");
            job.PublishFormats.Add(archiveFormat);
        break;

        case Output.Publish:
            // Setups streaming of media to publishing point 
            job = new LiveJob();

            // Aquires audio and video devices
            Collection<EncoderDevice> devices = EncoderDevices.FindDevices(EncoderDeviceType.Video);
            EncoderDevice video = devices.Count > 0 ? devices[0] : null;
            for (int i = 0; i < devices.Count; ++i)
                //  devices[i].Dispose();
                devices.Clear();

            devices = EncoderDevices.FindDevices(EncoderDeviceType.Audio);
            EncoderDevice audio = devices.Count > 0 ? devices[0] : null;
            for (int i = 1; i < devices.Count; ++i)
                devices[i].Dispose();
            devices.Clear();

            // Checks for a/v devices
            if (video != null && audio != null)
            {


                //job.ApplyPreset(Preset.FromFile(@"C:\Tempura\LivePreset3.xml"));
                job.ApplyPreset(LivePresets.H264IISSmoothStreamingLowBandwidthStandard);
                job.OutputFormat.VideoProfile.SmoothStreaming = true;
                deviceSource = job.AddDeviceSource(video, audio);

                // Make this source the active one
                job.ActivateSource(deviceSource);
            }
            else
            {
                error = true;
            }

            PushBroadcastPublishFormat publishFormat = new PushBroadcastPublishFormat();
            try
        {
            // checks the path for a valid  publishing point
            publishFormat.PublishingPoint = new Uri(destinationPath);

        }
            catch (UriFormatException)
            {
                return false;
            }

            // Adds the publishing format to the job

            try
        {




            // job.ApplyPreset(LivePresets.VC1IISSmoothStreaming480pWidescreen);
            job.PublishFormats.Add(publishFormat);
            job.PreConnectPublishingPoint();
        }
            catch (Exception e)
            {
                MessageBox.Show(e.StackTrace.ToString());
            }

        break;
        default:
        return false;
    }
    job.StartEncoding();

    return true;
}
于 2012-03-07T05:31:29.353 に答える
0

悲しいことに、私はコメントするのに十分な担当者がいないので、答えとしてそれを書かなければなりません。

ライブジョブを開始しているため、ストリーミングするには、StartEncodingの直後にjob.StopEncoding()を呼び出さないでください。通常は、イベントを使用してエンコードを停止すると思います。エンコードを開始してすぐに停止した場合、出力がないか、出力が非常に小さいのは論理的です。

于 2012-09-11T17:07:44.347 に答える
0

コードを次のように変更しましたが、うまく機能しているようです。あなたの問題は、LiveJob クラスのインスタンスを破棄したことだと思います。ストリーム全体のエンコードが完了する前に、インスタンスを存続させておく必要があります。なので、using部分を変更してStopEncodingを外してDisposeすればOKです。

    private void broadcastSourceFileToMediaServer2()
    {
        LiveJob job = new LiveJob();
        String filetoencode = @"c:\temp\niceday.wmv";

        LiveFileSource filesource = job.AddFileSource(filetoencode);
        filesource.PlaybackMode = FileSourcePlaybackMode.Loop;
        job.ActivateSource(filesource);
        job.ApplyPreset(LivePresets.VC1Broadband4x3);

        //don't know which one is good to use 
        job.AcquireCredentials += new EventHandler<AcquireCredentialsEventArgs>(job_AcquireCredentials);
        _myUserName = "indes";
        _pw = PullPW("indes");              

        Uri url = new Uri("http://192.168.1.74:8080/live");
        PushBroadcastPublishFormat pubpoint = new PushBroadcastPublishFormat();
        pubpoint.PublishingPoint = url;

        pubpoint.UserName = _myUserName;
        pubpoint.Password = _pw;

        job.PublishFormats.Add(pubpoint);       

        job.PreConnectPublishingPoint();

        job.StartEncoding();
        statusBox.Text = job.NumberOfEncodedSamples.ToString();
    }

    public static string _myUserName { get; set; }

    public static SecureString _pw { get; set; }

    //codificação de Password a enviar
    private static SecureString PullPW(string pw)
    {
        SecureString s = new SecureString();
        foreach (char c in pw) s.AppendChar(c);
        return s;
    }

    static void job_AcquireCredentials(object sender, AcquireCredentialsEventArgs e)
    {
        e.UserName = _myUserName;
        e.Password = _pw;
        e.Modes = AcquireCredentialModes.None;
    }
于 2012-02-23T10:13:42.613 に答える