0

after some troubleshooting I finally got a working piece of C#-Code to transcode a media file to a mp4 file with vlclib.

using (var shellFile = ShellObject.FromParsingName(files[4]))
                {
                    //Set target framerate 
                    targetFrameRate = (shellFile.Properties.System.Video.FrameRate.Value / 1000 == 24) ? 24 : 30;
                    //Keep the Audio SampleRate to avoid problems in transcoding
                    targetAudioSampleRate = (int)shellFile.Properties.System.Audio.SampleRate.Value;

                    var vlcLibDirectory = new DirectoryInfo(System.IO.Path.Combine(Directory.GetCurrentDirectory(), "libvlc", IntPtr.Size == 4 ? "win-x86" : "win-x64"));

                    var mediaPlayerOptions = new string[]
                    {
                        "--file-logging", "-vvv", "--logfile=Logs.log","--no-repeat", "--no-loop",
                    };
                    var options = new string[]
                    {
                        ":sout=#transcode{vcodec=mp4v,venc=x264{cfr=40},acodec=mpga,vb=100,fps=" + targetFrameRate + ",scale=1,ab=128,channels=2,samplerate=48000}:standard{access=file,mux=ts,dst=" + destinationPath + "\\test.mp4" + "}",":sout-keep"
                    };
                                   
                    this.vlcPlayer.SourceProvider.CreatePlayer(vlcLibDirectory,mediaPlayerOptions);

                    this.vlcPlayer.SourceProvider.MediaPlayer.Play("file:///"+files[4], options);
                    
                    //Add Stopped Event to get notified when the transcoding finished
                    this.vlcPlayer.SourceProvider.MediaPlayer.Stopped += MediaPlayer_Stopped;                   
                }

My only issue is that my transcoded files, e.g. the test.mp4 has no properties in the windows file explorer (see image for reference).

Could anybody point me in the right direction what I'm missing here?

details of test.mp4 in explorer

1 Answers1

0

Problem solved.....

the following tweaks did it for me:

"vcodec=x264,venc=x264,acodec=mp3" and "mux =mp4".

Now the transcoded file has all the properties.