Search code examples
c#processvlctranscodingtranscode

VLC command line - Transcode


I wanted to transcode a video with simple Windows Forms program.

I'm creating process with arguments.

My code:

        string vlc = @"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe";
        string dest=@"C:\Users\pc\Desktop\test.mp4";

        ProcessStartInfo p = new ProcessStartInfo
        {
            FileName = vlc,
            Arguments = @"% vlc C:/video.mpg :sout=#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100}:std{access=file{no-overwrite},mux=mp4,dst="+dest+"}"
        };
        Process x = Process.Start(p);
        x.WaitForExit();

The problem is that it not working. The program launches VLC and there's nothing happening or getting errors from VLC


Solution

  • I recently asked a Similar Question,

    If you want to see the Generated Stream Output String, Use Open Network Stream and change your tab to File.

    Instead of clicking Play, expand the drop down to choose Stream.

    Follow the Wizard directions to set up your destination File and transcoding Options.

    Before streaming you will get the string that you can use....

    For example:

    :sout=#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100}:file{dst=C:\\Users\\Public\\Videos\\Sample Videos\\test.mp4,no-overwrite} :sout-keep