req converting video to flash video examples

Discussion in 'ASP .Net' started by David Buckley, Apr 22, 2008.

  1. Does anyone have any example code of converting any type of video to flash
    video at all using asp.net 2.0 c# web applications. God Bless
    David Buckley, Apr 22, 2008
    #1
    1. Advertising

  2. This is some instructions and code I copied from somebody's blog post and
    saved. I haven't tested it, but it looks like it will get you to first base:

    FFMPEG
    Step - 1

    Just download FFMPEG module from the internet. The latest version of FFMPEG
    will be a zip file which contains all the soorce code,
    FFMPEG.exe, FLVTOOL.exe and more. Extract those files into your application
    directory. FFMPEG.exe basically convert the video files into flv and
    FLVTOOL insert the metadata to the flv files. So that the video files will
    have all the video information.
    Without the metadata the video files won't be able to stream properly.

    Step -2

    Assign the exepath and directories.


    AppPath = Request.PhysicalApplicationPath 'Get the application path
    inputPath = AppPath & "videos\org_video" 'Path of the original file
    outputPath = AppPath & "videos\conv_video" 'Path of the converted file
    imgpath = AppPath & "videos\thumbs" 'Path of the generated thumanails
    prevpath = AppPath & "videos\preview" 'Path of the preview file


    Now the main thing is the command line that executes ffmpeg.exe on the
    server...

    string cmd as string = " -i """ & newPath & """ """ & outputPath & "\" & out
    & """" '-i specifies the input file


    Here newpath is the path of the source video file, outputpath is path of the
    converted video and out is the filename.

    The above command line will convert the video into flv format. Now if you
    like to get high quality flv then use the following code..

    Dim fileargs As String = "-i " & newPath & " -acodec mp3 -ab 64k -ac 2 -ar
    44100 -f flv -deinterlace -nr 500 -croptop 4 -cropbottom 8 -cropleft 8
    -cropright 8 -s 640x480 -aspect 4:3 -r 25 -b 650k -me_range 25 -i_qfactor
    0.71 -g 500 " & outputPath & "\" & out & ""

    The above code will generate high quality flv. Now to insert metadata into
    those generated flv file use the following command line Dim filebuffer As
    String = "-U """ & outputPath & "\" & out & """"

    To create thumbnail use the following code.... Dim imgargs As String = " -i
    """ & newPath & """ -f image2 -ss 1 -vframes 1 -s 80x60 -an """ & imgpath &
    "\" & thumbnm & """"

    -i = input file -f = file format -vframe = video frame -s = size
    Now create a function which can execute those command line

    Dim proc As New System.Diagnostics.Process()
    proc.StartInfo.FileName = exepath 'Path of exe that will be
    executed, only for "filebuffer" it will be "flvtool2.exe"
    proc.StartInfo.Arguments = cmd 'The command which will be executed
    proc.StartInfo.UseShellExecute = False
    proc.StartInfo.CreateNoWindow = True
    proc.StartInfo.RedirectStandardOutput = False
    proc.Start()

    Step - 3 ----
    --Peter
    To be a success, arm yourself with the tools you need and learn how to use
    them.

    Site: http://www.eggheadcafe.com
    http://petesbloggerama.blogspot.com
    http://ittyurl.net


    "David Buckley" wrote:

    > Does anyone have any example code of converting any type of video to flash
    > video at all using asp.net 2.0 c# web applications. God Bless
    >
    Peter Bromberg [C# MVP], Apr 22, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bernie
    Replies:
    0
    Views:
    543
    Bernie
    Sep 5, 2004
  2. Kaspar Minosiants

    [REQ] Good source examples of J2EE

    Kaspar Minosiants, Jul 23, 2003, in forum: Java
    Replies:
    0
    Views:
    345
    Kaspar Minosiants
    Jul 23, 2003
  3. Joshua
    Replies:
    8
    Views:
    6,039
    Joshua
    Sep 29, 2004
  4. tg
    Replies:
    1
    Views:
    1,555
    Travis Newbury
    May 9, 2006
  5. Matt
    Replies:
    0
    Views:
    424
Loading...

Share This Page