locked
Not Converting from avi to flv using FFmpeg RRS feed

  • Question

  • User655436493 posted

    Hi, I am trying to convert the avi file to flv but its not converting, Its creating the .flv file in the folder but its corrupted I guess, its not opening that file.

    Is there anything wrong in my code?

    Thanks,

    .aspx:

    <tr>
                                                <td>
                                                    File :
                                                </td>
                                                <td>
                                                    <asp:FileUpload ID="upload_imgstatic" runat="server" />only jpg or jpeg
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="2">
                                                    <br />
                                                    <asp:Button ID="Button1" runat="server" Text="Save" OnClick="save_CommandStatic" /><hr />
                                                </td>
                                            </tr>


    .cs:

    protected void save_CommandVideopersonal(object sender, EventArgs e)
        {
           
                // tb_artist tb_name tb_album tb_genre FileUpload1
                if (upload_videopersonal.HasFile)
                {
                    string ext = Path.GetExtension(upload_videopersonal.FileName).ToLower();
                    //if (ext == ".flv")
                    {
                        string defext = ".flv";
                        string filename = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                        string filepath = "FuneralPersonalVideos/" + filename + ext;
                        upload_videopersonal.SaveAs(Server.MapPath("~/" + filepath));
                        //filename = filepath;

                        string video = Server.MapPath("~/" + "FuneralPersonalVideos/" + filename + ext); //@"D:\Projects\testapp\Uploads\videowmv.wmv";

                        string mpg = Server.MapPath("~/" + "FuneralPersonalVideos/" + filename + defext);  //@"D:\Projects\testapp\Uploads\videoflv.flv";

                        string cmd = " -i " + "" + video + " " + " " + "" + mpg + "" + "";

                        System.Diagnostics.Process proc = new System.Diagnostics.Process();

                        proc.StartInfo.FileName = Server.MapPath("~/" + "ffmpeg/ffmpeg.exe");//@"D:\Projects\Gastro\bin\ffmpeg";

                        proc.StartInfo.Arguments = cmd;

                        proc.StartInfo.UseShellExecute = false;

                        proc.StartInfo.CreateNoWindow = true;

                        proc.StartInfo.RedirectStandardOutput = false;

                        proc.Start();


                        //upload_videopersonal.SaveAs(mpg);

                        int eid = Convert.ToInt32(Session["AdminEventID"]);
                        //CommonFunctions.CreateThumbnail(filename, this.Page);
                        //db.InsertFuneralPersonalVideo(eid, tb_titlevideopersonal.Text, filename);
                        CommonFunctions.JavaScriptAlertMessage("Your Video has been uploaded.", this.Page);
                        tb_titlevideopersonal.Text = "";
                    }
                    //else
                    //    CommonFunctions.JavaScriptAlertMessage("Only flv files allowed!", this.Page);
                    grid_videopersonal.DataBind();
                }
            
        }

    Wednesday, February 10, 2010 2:16 PM

Answers

  • User-1659704165 posted

    Hi,

    this paramter

    ffmpeg -i  <in.avi> -metadata title="my title" <out.flv>

    oR

    http://ffmpeg.org/ffmpeg-doc.html

    chk the above link

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 11, 2010 12:42 AM