A Flash Developer Resource Site

Page 4 of 8 FirstFirst 12345678 LastLast
Results 61 to 80 of 153

Thread: convert AVI, MPG, MOV -> swf

  1. #61

    Re: .swf to .avi

    Originally posted by gjkillam
    Hey Xn, Johnie & Tphilip
    On the .swf to .avi idea ...Do it Do it! Do it!
    I have already spoke with Xn on the subject!
    You said it would take a couple months? I was just wondering if its in the workz?
    Well actually takes about 20 lines of code and no more than 5 minutes to write a program that can convert swf to avi or any other format.

    Cheers,
    Lev

  2. #62
    Senior Member
    Join Date
    Oct 2000
    Posts
    197
    Jesse - people just keep replying to this thread. Maybe they're interested in this.

    Leviathan - So why don't you write it? Let's split it between us 10 lines each.

    Xn

  3. #63
    Originally posted by xnxnxn
    Leviathan - So why don't you write it? Let's split it between us 10 lines each.

    Xn
    Hi XN,
    well actually I did it a while ago, even if with initialization, finalization and some error checking code, it takes more than 20 lines, actually 77, white lines included. It's written in Delphi and you just need to import the ActiveX of the Flash player to compile it. It doesn't compress to AVI but saves the entire movie as a serie of progressively numbered bitmaps, one for each frame of the Flash movie. By just adding the Jpeg unit and other 5 lines of code it can compress bitmaps to Jpeg instead of plain BMP. There's plenty of free utilities that can assemble the bitmaps into an AVI, otherwise, I'm sure that you know that by adding support for DirectShow (part of DirectX) it is possible to assemble the bitmaps directly into AVI, MPEG, ASF and other formats, or even add a sound track, all this in further 30 lines of code.

    SwfConvert compiles to a command line application and it accepts two parameters: the first is the name of SWF to be converted and the second one is a directory name where the bitmaps have to be saved. Both names have to be fully qualified (have to include drive and path)

    I.e: swfconvert c:\movie.swf d:\frames\


    Not too bad, isn't it? I guess that now you will be more relaxed and even more ironic, knowing that you can spend all the time of the incoming summer at the beach, instead of spending two months making a SWF converter.

    Cheers,
    Lev



    P.S. If you don't have Delphi, you may load the application already compiled at
    http://www.barefootsoft.com/files/SwfConvert.zip





    program SwfConvert;
    {$APPTYPE CONSOLE}

    uses
    Windows, SysUtils, Controls, Messages, Forms, ActiveX, Graphics,
    ShockwaveFlashObjects_TLB;

    type
    TMovieContainer = class
    FPhWnd : HWND;
    FlashPlayer : TShockwaveFlash;
    procedure WndProc(var Message : TMessage);
    end;

    var
    MC : TMovieContainer;
    Bmp : TBitmap;
    BmpWidth, BmpHeight, NumFrames, Idx : integer;
    DestDir, BmpName : string;

    procedure TMovieContainer.WndProc(var Message : TMessage);
    begin
    with message do
    Result := DefWindowProc(FPhWnd, Msg, wParam, lParam);
    end;

    begin
    CoInitialize(nil);
    MC := TMovieContainer.Create;
    MC.FPhWnd := AllocateHWnd(MC.WndProc);

    if ParamCount < 2 then exit;

    DestDir := ParamStr(2);

    //Created and instance of player without showing it
    MC.FlashPlayer := TShockwaveFlash.CreateParented(MC.FPhWnd);

    with MC.FlashPlayer do
    begin
    Playing := False;
    Movie := ParamStr(1);

    //Width and Height need to be set anyway
    Width := 400;
    Height := 400;

    BmpWidth := Width;
    BmpHeight := Height;

    NumFrames := TotalFrames;
    end;

    Bmp := TBitmap.Create;

    with Bmp do
    begin
    PixelFormat := pf24Bit;
    Width := BmpWidth;
    Height := BmpHeight;
    end;

    for Idx := 1 to NumFrames do
    begin
    MC.FlashPlayer.PaintTo(Bmp.Canvas.Handle, 0, 0);
    BmpName := DestDir + IntToStr(Idx) + '.bmp';
    Bmp.SaveToFile(BmpName);
    MC.FlashPlayer.Forward;
    end;

    //Free Allocate resources
    CoUninitialize;
    Bmp.Free;
    DeAllocateHWnd(MC.FPhWnd);
    MC.FlashPlayer.Free;
    MC.Free;
    end.

  4. #64
    Senior Member
    Join Date
    Jul 2000
    Posts
    503
    Yah, but every couple weeks it jumps to the top and, all excited about some new features being added or something, I go to check it and no posts are added...kind of spooky ;-).

    In any case, thanks for the APP, it is a nice little util.

    --Jesse

  5. #65
    Senior Member
    Join Date
    Dec 2000
    Posts
    152
    Leviathan

    I tried to run your program but got a major error. Some kind of loop which required me to ctrl-alt-delete out of it.

    I ran it from my desktop using the following command.

    C:\WINDOWS\Desktop\SwfConvert\SwfConvert.exe C:\WINDOWS\Desktop\SwfConvert\test.swf C:\WINDOWS\Desktop\SwfConvert\

    I got the images into the directory but then the loop started.


    Also, does this only work for .swf or can you do this for .avi, mov, asf etc...?


    [Edited by Javakitty on 05-09-2001 at 01:53 AM]

  6. #66
    Originally posted by Javakitty
    Leviathan

    I tried to run your program but got a major error. Some kind of loop which required me to ctrl-alt-delete out of it.
    ......
    I got the images into the directory but then the loop started.


    Sorry, at he last minute I've sent an old version of it which wans't releasing properly the resources allocated. I've uploaded the new one at the same address above.


    Also, does this only work for .swf or can you do this for .avi, mov, asf etc...?
    Not with this one, but have a look at the Microsoft DirectX site http://www.microsoft.com/directx/ and download the SDK version of DirectX 8.0 (if you have any version after 6, it should work as well). Read the stuff about DirectShow and play with utilities like GraphEdit. It's quite difficult to grasp and master in the beginning, but I've found it extremely powerfull. You can then extract single frames and whole audio from all the supported media types and process them as you wish. QuickTime movies are supported only until version 2, for all the others (3, 4 and 5) you need separate API calls from Apple SDK.


    Cheers,
    Lev

  7. #67
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    Originally posted by JAEzell
    Yah, but every couple weeks it jumps to the top and, all excited about some new features being added or something, I go to check it and no posts are added...kind of spooky ;-).

    In any case, thanks for the APP, it is a nice little util.

    --Jesse
    I noticed that too. Its freaky- The thread is haunted.

    Levithan- Thanks for the code... Its nice that you are sharing.



  8. #68
    Member
    Join Date
    Apr 2001
    Posts
    49
    You can convert the movie to gif first then import the gif.

    A avi to gif convert is free of charge.

    http://www.tucows.com

  9. #69
    Senior Member
    Join Date
    Oct 2000
    Posts
    197
    Lev,

    It didn't work for me either.

    Xn

  10. #70
    Senior Member
    Join Date
    Jul 2000
    Posts
    503
    Xn, You stay up too late (or get up too early)...

    ;-)

    --Jesse

  11. #71
    Originally posted by xnxnxn
    Lev,

    It didn't work for me either.

    Xn

    The first version I posted wasn't working, so I've uploaded anorther one the next day, and that works.

    Cheers,
    Lev

  12. #72
    Senior Member flipsideguy's Avatar
    Join Date
    Dec 2000
    Location
    Sweden
    Posts
    834
    Does this seemingly awesome application convert my .mov into .swf as sequential images so I can control it over the timeline?

  13. #73
    Senior Member
    Join Date
    Jul 2000
    Posts
    503
    No, it is for getting frames of SWF file as sequential images, but it could be modified for quicktime, etc. with some additional libraries (read comments above).

    --Jesse

  14. #74
    Senior Member flipsideguy's Avatar
    Join Date
    Dec 2000
    Location
    Sweden
    Posts
    834
    Originally posted by JAEzell
    No, it is for getting frames of SWF file as sequential images, but it could be modified for quicktime, etc. with some additional libraries (read comments above).

    --Jesse
    So one can't control the video in an Fla? i.e. add type over it and build buttons to move forward/back?

  15. #75
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    Once you have the video converted to SWF then you should be able to import it into Flash and finish up from there (You loose your sound). I also want to point out that there is another method of doing this and it uses an active X container that holds the Movie so that you don't have to convert ( http://www.Flashants.com ) at all as long as the MOV format is under QT3 or under (Media player cannot play MOV V3 or higher because apple semi-closed the format when MS added MOV playback and creation to Media Player. They did this to stop Microsoft from doing what they did to Netscape to them with Quicktime).

    Depending on what you are doing you might consider this approach if the converted movie is larger than the original or the quality is not acceptable. QT's MOV, Mpeg, AVI, ETC are optimized for Bitmap streaming where as Flash is not. Some times you will find that the video format will work better than Flash (Becuase they were designed for the Raster Images where as Flash isn't) especially when you are working with the MOV format (Also note that the QT plug-in has about the same distribution as the Shokwave Player) which actually can support Flash, Java, Applescripts, QT Vector format, QT Cubic V-R Format, and over 200 different Media types. Flash doesn't like QT 5, Vid 2 SWF seems to not like QT 5 much either but will convert it.

  16. #76
    Senior Member flipsideguy's Avatar
    Join Date
    Dec 2000
    Location
    Sweden
    Posts
    834
    Thanks for that Johnie.

    However, I did buy vid2swf (and then found out that JavaKitty has a more visually appealing version with a nice interface, bummer). Anyway, I am please to see that once the file is imported into Flash, all the images in the sequence are placed on the time line (much like swish, swift et al). This is great. I've experimented with importing the file into an MC and applying actions to it. Good stuff. And as far as quality goes... well the quality can never be better than the quality of the original footage. I have the Kodak MC3 which shoots at 320x240 (perfect for streaming video) with acceptable (nowhere close to great) quality. So, no regrets buying this little 'gem' of a program. But I am saving up to buy Adobe After Effects 5 (swf export <---- CAN'T WAIT).

  17. #77
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    I've been told that Vid2SWF and Vid2Flash are the same program. Java Kitty has told me that at least. If you contact them they may let you have the new interface, although I prefer the old Vid2SWF interface. It takes all of the images and places them in a timeline then adds sound to it.

    As far as converting Video- Vid2Flash does a great job. So for Mpeg and AVI and MOV 3 and lower it is great. It however doesn't handle Flash Tracks, Wired Sprites, Qubic VR, Java, Applescripts, and the other more attractive features of MOV format 4 and 5. The truth is that MOV 5 format is actually closer to Shockwave format than a video format. Then on the other hand none of the other conversion programs handles those things either.

  18. #78
    Senior Member
    Join Date
    Feb 2001
    Posts
    140
    i have an alpha test version of an application at the moment that does conversions to the SWF file format. you can test it out if you want and tell me what you think.

  19. #79
    Senior Member
    Join Date
    Oct 2000
    Posts
    197
    Using the thread for promotion huh?

    Xn

  20. #80
    Junior Member
    Join Date
    May 2001
    Posts
    5

    Smile Re: Big Thing??

    Absolute quality mate!

    Do I need to but it then to get rid of the vid2flash from the swf?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center