VideoHelp Forum

+ Reply to Thread
Results 1 to 4 of 4
  1. Hi guys,

    So, i'm working on a project to encode videos from Adobe Premiere Pro projets in H264 using x264.
    I've done multiples versions of the programm, one in batch, one in python, but i'd like to do one in C# because it's a compilable langage (don't know if that's well said, I'm french sorry ^^).

    So I try to encode, it starts, but at some point the program stops encoding. I had that problem with the program in python compiled with cx_Freeze to get an executable, but if i run the executable compiled with cx_freeze in Admin, well, it works, so I tried with this executable but, not workin'.

    I've used this code to make the encoding :

                ProcessStartInfo processStartInfo = new ProcessStartInfo("cmd", commandLine);
                processStartInfo.RedirectStandardOutput = true;
                processStartInfo.RedirectStandardError = true;
                processStartInfo.WindowStyle = ProcessWindowStyle.Normal;
                processStartInfo.UseShellExecute = false;
    I'm not gonna lie, i'm new to C#, so this code, i've found it on the internet by searching how to execute a program with C# (and I know this isn't the right way to learn !)

    So I hope one or more of you will have an answer that could help, sorry for my english, I'm french and, have great day / night !
    Last edited by Keller501; 21st Jul 2014 at 17:55. Reason: Corrections
    Quote Quote  
  2. Banned
    Join Date
    Oct 2004
    Search Comp PM
    Your English is fine. "Compilable language" is fine, but "...this isn't the right why to learn" should be "... this isn't the right way to learn". "... it starts, but at point the program stops encoding" is vague and requires some kind of modifier, like "... it starts, but at some point the program stops encoding". If I could help you with C# I would. We only have a small number of members here who have experience with it, but maybe one of them will read this and reply. Don't worry about your English. Your mistakes are few and very small. Native speakers can do worse and sometimes do.
    Quote Quote  
  3. Thanks for the corrections, actually, when I re-read myself, I see that I've been writing the wrongs words x).
    Quote Quote  
  4. I really don't know much about c# (c++ programmer), but the:
    ProcessStartInfo processStartInfo = new ProcessStartInfo("cmd", commandLine);
    part looks kind for wrong here, shouldn't it be something more like:
    Process process = new Process(); // create a new process
    // adjust the start info of that process
    process.StartInfo.RedirectStandardOutput = true;
    process.StartInfo.RedirectStandardError = true;
    process.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
    process.StartInfo.UseShellExecute = false;
    process.StartInfo.FileName = "Command to process";
    string stdOutput = process.StandardOutput.ReadToEnd(); //grab output
    string errOutput = process.StandardError.ReadToEnd(); //grab output
    process.WaitForExit(); // wait for process to end
    -> quick google search provides even some nice examples
    users currently on my ignore list: deadrats, Stears555
    Quote Quote