简体   繁体   English

表达式编码器:编码后更改文件名

[英]Expression encoder: change file name after encoding

I'm using Microsoft Expression Encoder and this is my code 我正在使用Microsoft Expression Encoder,这是我的代码

using (LiveJob job = new LiveJob())
        {
            // Creates file source for encoding
            LiveFileSource fileSource = job.AddFileSource(DataDirectory);

            // Sets playback to loop on reaching the end of the file
            fileSource.PlaybackMode = FileSourcePlaybackMode.Jump;


            // Sets this source as the current active one
            job.ActivateSource(fileSource);

            job.ApplyPreset(LivePresets.VC1IISSmoothStreamingLowBandwidthStandard);


            PushBroadcastPublishFormat format = new PushBroadcastPublishFormat();
            format.PublishingPoint = new Uri(PublishPoint);
            job.PublishFormats.Add(format);

            // Starts encoding
            job.StartEncoding();
   }

this code encode a list of files in a directory when he finish one he jump to the next what I want to do is change the file name when it's encoded before passing to th other one 这段代码编码一个目录中的文件列表,当他完成一个文件时,他跳到下一个我要做的是在编码之前更改文件名,然后传递给另一个

I have added this Methode I don't know if it work or no 我添加了这个Methode,我不知道它是否有效

public void liveJob_Status(object sender, EncodeStatusEventArgs e)
    {
        if (e.Status == EncodeStatus.Jumped)
        { LiveFileSource file = (LiveFileSource)e.LiveSource; 
          string name = file.Name;
          string modified_name = "Encode" + name;

          File.Move(DataDirectory + @"\" + name, DataDirectory + @"\" + name.Replace(name, modified_name)); 
        }
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM