@Kailash Sahu , you could try the following code to drag files to listbox and convert it to the mp4 files.
Code:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
listBox1.AllowDrop=true;
}
private void button1_Click(object sender, EventArgs e)
{
string[] clist = listBox1.Items.OfType<string>().ToArray();
FFMpegConverter converter = new FFMpegConverter();
foreach (var item in clist)
{
converter.ConvertMedia(item, Path.Combine("D:\\",Path.GetFileNameWithoutExtension(item)+".gif"), NReco.VideoConverter.Format.gif);
}
}
private void listBox1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy;
}
private void listBox1_DragDrop(object sender, DragEventArgs e)
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
foreach (string file in files)
listBox1.Items.Add(file);
}
}
Based on my test, it can convert gif to mp4 successfully at the same time.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.