コード例 #1
0
        private void OnConvertAudioClick(object sender, RoutedEventArgs e)
        {
            // تبدیل آهنگ به آهنگ
            // نبدیل ویدیو به آهنگ
            ffmpeg.ConvertAudio(txtInputFile.Text, txtOutputFile.Text);
            // کد زیر و بالا یکی است
            //ffmpeg.ConvertAudio(txtInputFile.Text, txtOutputFile.Text, AudioFileType.Mp3);
            // صدای خروجی با این کد ضعیف خواهد بود!
            // برای تنظیم کیفیت خروجی صدا از کد رویداد زیر استفاده کنید


            // نمونه فایل ورودی:
            // C:\abc.ogg یا C:\abc.mp4
            // نمونه فایل خروجی
            // C:\xyz.mp3
        }
コード例 #2
0
        private void button6_Click(object sender, EventArgs e)
        {
            fFmpeg.ConvertAudio(textBox1.Text, textBox2.Text, AudioFileType.M4a);
            return;



            Process process = new Process();

            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.RedirectStandardError  = true;
            process.StartInfo.FileName = Application.StartupPath + FFmpegPath;
            //--txt_format text -i input_file out.srt


            //process.StartInfo.Arguments = $"-txt_format text -i {textBox1.Text} out.srt";
            process.StartInfo.Arguments = textBox3.Text;
            // -vn -an -codec:s srt
            //process.StartInfo.Arguments = $"-i {textBox1.Text} -c:s copy sub.srt";

            //process.StartInfo.Arguments = $"-i {textBox1.Text} -an -vcodec copy {textBox2.Text}";
            //process.StartInfo.Arguments = $"-i {textBox1.Text} -map single_highest_quality_video_stream_from_all_inputs -map single_highest_quality_audio_stream_from_all_inputs {textBox2.Text}";
            process.StartInfo.UseShellExecute       = false;
            process.StartInfo.CreateNoWindow        = true;
            process.StartInfo.RedirectStandardError = true;
            process.Start();
            new Thread(new ThreadStart(() =>
            {
                StreamReader sr = process.StandardError;
                while (!sr.EndOfStream)
                {
                    var v = (sr.ReadLine());
                    SSS(v);
                }
                //new Action(() => { richTextBox2.Text += sr.ReadToEnd(); }).Invoke();
            })).Start();
        }