Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Libraries

    Hsalf 0.0.1

    Download button

    No screenshots available
    Downloads: 84  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Nam T. Nguyen | More programs
    MIT/X Consortium Lic... / FREE
    September 23rd, 2011, 21:13 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    Hsalf description

    A pure Python library to read and write Flash files (SWF)

    Hsalf is a pure Python library to write and read Flash files (SWF).

    Hsalf supports SWF file, both compressed and uncompressed formats.

    Example

    This example prints out file version, frame rate, and all tag codes:

    from hsalf import swf
    f = swf.SwfFile('screen.swf')
    print f.header.file_header.version
    print f.header.frame_header.frame_rate

    for tag in f.iter_body():
     print tag.tag_code


    This function extracts frames from a Screen Video from a Flash movie:

    def extract_screen_video(file_name, stream_id, dst_dir='.'):
     import os
     import Image

     swf = SwfFile(file_name)
     last_img = None
     for tag in swf.iter_body():
     if isinstance(tag, VideoFrameTag) and tag.stream_id == stream_id:
     svp = ScreenVideoPacket().deserialize(
     StringIO(tag.video_data))
     if svp.frame_type == KEY_FRAME:
     last_img = Image.new('RGB',
     (svp.image_width, svp.image_height))
     img = svp.to_image(last_img)
     img.save('{0}{1}{2:05d}.png'.format(dst_dir, os.sep,
     tag.frame_num))
     last_img = img


    There are some sample scripts to extract other materials from SWF file in scripts directory.


    Product's homepage

    Requirements:

    · Python

      


    TAGS:

    SWF reader | SWF writer | Python library | Flash | SWF | reader

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM