2

I'm trying to write a converter in C # using Nreco.VideoConverter. I've never had any experience with these before. I started researching this area because I was asked at work. My problem is; I can change the bitrate value in video converter. If you have a combobox or a specific value. But, if there is any value to enter from the textbox, I cannot adapt the code accordingly. Below is the code I use. Please help.

Code is;

  if (comboBox2.Text == "_1000kbit")
    {
    if (comboBox1.Text == "mp4" || comboBox1.Text == "mp4 1280 x 720 16 : 9" || comboBox1.Text == 
    "mp4 640 x 350 16 : 9" || comboBox1.Text == "mp4 720 x 540")
    {
     var ffmpeg = new NReco.VideoConverter.FFMpegConverter();
     ffmpeg.ConvertMedia(VideoPath, null, MusicPath, null, new ConvertSettings()
       {
       CustomOutputArgs = "-b:v 1000k -bufsize 1000k"
       });
       }

         }

but ı want do this;

 if (comboBox2.Text == "_1000kbit")
          {
           if (comboBox1.Text == "mp4" || comboBox1.Text == "mp4 1280 x 720 16 : 9" || 
            comboBox1.Text == "mp4 640 x 350 16 : 9" || comboBox1.Text == "mp4 720 x 540")
           {
              var ffmpeg = new NReco.VideoConverter.FFMpegConverter();
             ffmpeg.ConvertMedia(VideoPath, null, MusicPath, null, new ConvertSettings()
            {
          CustomOutputArgs = "-b:v"+textBox1.Text+"k -bufsize"+textBox1.Text+"k"
          });
          }

             }

So is it possible? how can i do it if possible? Because when I type it it says ffmpeg can't find the argument. By the way, I set the textbox value to int. Please help for this. Thank You.

What I have tried:

ı want do this; but is it possible or true I have no idea

Zeynep Baran
  • 37
  • 1
  • 7

1 Answers1

1

Try this

 CustomOutputArgs = String.Format("-b:v {0}k -bufsize {0}k", textBox1.Text);

Edit: Explaining problem in code Your CustomOutputArgs were turning out to be: -b:v1000k -bufsize1000k instead of -b:v 1000k -bufsize 1000k (Notice the spaces)

demoncrate
  • 390
  • 2
  • 14
  • In the code I've written this I have also fixed resolutions; Can I put resolutions like 1280: 720 into the code? E.g: CustomOutputArgs = String.Format("-s ega-b:v {0}k -bufsize [0}k", textBox4.Text – Zeynep Baran Oct 01 '19 at 14:23