-1

I am making a converter using the ffmepg library via c # form. I can convert all my videos to whatever format I want. But I get the following error in mpeg2, mpeg, mpeg4 formats. My code is;

if (comboBox1.Text == "mpeg2")
            {
                var convert = new NReco.VideoConverter.FFMpegConverter();
                convert.ConvertMedia(VideoPath, MusicPath, "mpeg2");
                MessageBox.Show("convert is okey");
            }

**is my fault; **NReco.VideoConverter.FFMpegException: 'C:\Users\zbaran\Videos\New folder\ converted Alan Walker, Sabrina Carpenter & Farruko - On My Way.webm.mpeg2: Invalid argument (exit code: 1)'

what should I do? Please Help! But the other format is working. I havent any error.

Zeynep Baran
  • 37
  • 1
  • 7

1 Answers1

2

I had a look at the documentation: https://www.nrecosite.com/doc/NReco.VideoConverter/ and it seems like they have a Format class. The string they use for mpeg is just "mpeg". So, this should work:

convert.ConvertMedia(VideoPath, MusicPath, "mpeg");

or this

convert.ConvertMedia(VideoPath, MusicPath, Format.mpeg);

mpeg4 would be

convert.ConvertMedia(VideoPath, MusicPath, "mp4");
d4zed
  • 478
  • 2
  • 6
  • 16
  • Yes thank you so much! mpeg mpg2 and mpeg4 because I think there are separate formats I wrote as I mentioned above. Thanks a lot mpeg4 mp4 as we should think? – Zeynep Baran Oct 15 '19 at 10:33
  • Great! I'm not really that familiar with these formats and differences, but in the Format class they provide, there are only Format.mpeg and Format.mp4 – d4zed Oct 15 '19 at 10:36
  • Thank you again for your help! – Zeynep Baran Oct 15 '19 at 12:11
  • Does it support 4k resolution? I also have the code but I get the error again; 'var ffmpeg = new NReco.VideoConverter.FFMpegConverter(); ffmpeg.ConvertMedia(VideoPath, null, MusicPath, null, new ConvertSettings() { CustomOutputArgs = "-s 4k" }); ' – Zeynep Baran Oct 15 '19 at 13:06
  • or;var ffmpeg = new NReco.VideoConverter.FFMpegConverter(); ffmpeg.ConvertMedia(VideoPath, null, MusicPath, null, new ConvertSettings() { CustomOutputArgs = "-s uhd2160" }); like this – Zeynep Baran Oct 15 '19 at 13:07